aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
commit51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch)
tree91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /test
parentbb5e33f003797b67974a8893f7f2930fc51b8210 (diff)
downloadsrc-51072bd6bf79ef2bc6a922079bff57c31c1effbc.tar.gz
src-51072bd6bf79ef2bc6a922079bff57c31c1effbc.zip
Vendor import of libc++ release_39 branch r276489:vendor/libc++/libc++-release_39-r276489
Notes
Notes: svn path=/vendor/libc++/dist/; revision=303237 svn path=/vendor/libc++/libc++-release_39-r276489/; revision=303238; tag=vendor/libc++/libc++-release_39-r276489
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt20
-rw-r--r--test/libcxx/algorithms/version.pass.cpp (renamed from test/std/algorithms/version.pass.cpp)0
-rw-r--r--test/libcxx/atomics/atomics.flag/init_bool.pass.cpp (renamed from test/std/atomics/atomics.flag/init03.pass.cpp)10
-rw-r--r--test/libcxx/atomics/version.pass.cpp (renamed from test/std/atomics/version.pass.cpp)0
-rw-r--r--test/libcxx/compiler.py26
-rw-r--r--test/libcxx/containers/associative/map/version.pass.cpp (renamed from test/std/containers/associative/map/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/associative/set/version.pass.cpp (renamed from test/std/containers/associative/set/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp (renamed from test/std/containers/associative/tree_balance_after_insert.pass.cpp)3
-rw-r--r--test/libcxx/containers/associative/tree_key_value_traits.pass.cpp59
-rw-r--r--test/libcxx/containers/associative/tree_left_rotate.pass.cpp (renamed from test/std/containers/associative/tree_left_rotate.pass.cpp)3
-rw-r--r--test/libcxx/containers/associative/tree_remove.pass.cpp (renamed from test/std/containers/associative/tree_remove.pass.cpp)3
-rw-r--r--test/libcxx/containers/associative/tree_right_rotate.pass.cpp (renamed from test/std/containers/associative/tree_right_rotate.pass.cpp)3
-rw-r--r--test/libcxx/containers/container.adaptors/queue/version.pass.cpp (renamed from test/std/containers/container.adaptors/queue/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/container.adaptors/stack/version.pass.cpp (renamed from test/std/containers/container.adaptors/stack/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/gnu_cxx/hash_map.pass.cpp26
-rw-r--r--test/libcxx/containers/gnu_cxx/hash_set.pass.cpp26
-rw-r--r--test/libcxx/containers/sequences/array/version.pass.cpp (renamed from test/std/containers/sequences/array/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/deque/version.pass.cpp (renamed from test/std/containers/sequences/deque/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/forwardlist/version.pass.cpp (renamed from test/std/containers/sequences/forwardlist/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/list/db_back.pass.cpp (renamed from test/std/containers/sequences/list/db_back.pass.cpp)26
-rw-r--r--test/libcxx/containers/sequences/list/db_cback.pass.cpp (renamed from test/std/containers/sequences/list/db_cback.pass.cpp)24
-rw-r--r--test/libcxx/containers/sequences/list/db_cfront.pass.cpp (renamed from test/std/containers/sequences/list/db_cfront.pass.cpp)24
-rw-r--r--test/libcxx/containers/sequences/list/db_front.pass.cpp (renamed from test/std/containers/sequences/list/db_front.pass.cpp)26
-rw-r--r--test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp (renamed from test/std/containers/sequences/list/db_iterators_6.pass.cpp)27
-rw-r--r--test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp (renamed from test/std/containers/sequences/list/db_iterators_7.pass.cpp)27
-rw-r--r--test/libcxx/containers/sequences/list/db_iterators_8.pass.cpp (renamed from test/std/containers/sequences/list/db_iterators_8.pass.cpp)25
-rw-r--r--test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp (renamed from test/std/containers/sequences/list/db_iterators_9.pass.cpp)18
-rw-r--r--test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp29
-rw-r--r--test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp32
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp44
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp (renamed from test/std/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp)25
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp (renamed from test/std/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp)26
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp (renamed from test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp)24
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp (renamed from test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp)25
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp (renamed from test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp)25
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp (renamed from test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp)24
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp36
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp27
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp27
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp29
-rw-r--r--test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp33
-rw-r--r--test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp29
-rw-r--r--test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp29
-rw-r--r--test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp29
-rw-r--r--test/libcxx/containers/sequences/list/list.special/db_swap_1.pass.cpp36
-rw-r--r--test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp36
-rw-r--r--test/libcxx/containers/sequences/list/version.pass.cpp (renamed from test/std/containers/sequences/list/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/const_value_type.pass.cpp (renamed from test/std/containers/sequences/vector/const_value_type.pass.cpp)4
-rw-r--r--test/libcxx/containers/sequences/vector/db_back.pass.cpp (renamed from test/std/containers/sequences/vector/db_back.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_cback.pass.cpp (renamed from test/std/containers/sequences/vector/db_cback.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_cfront.pass.cpp (renamed from test/std/containers/sequences/vector/db_cfront.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_cindex.pass.cpp (renamed from test/std/containers/sequences/vector/db_cindex.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_front.pass.cpp (renamed from test/std/containers/sequences/vector/db_front.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_index.pass.cpp (renamed from test/std/containers/sequences/vector/db_index.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp (renamed from test/std/containers/sequences/vector/db_iterators_2.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp (renamed from test/std/containers/sequences/vector/db_iterators_3.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp (renamed from test/std/containers/sequences/vector/db_iterators_4.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp (renamed from test/std/containers/sequences/vector/db_iterators_5.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp (renamed from test/std/containers/sequences/vector/db_iterators_6.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp (renamed from test/std/containers/sequences/vector/db_iterators_7.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp (renamed from test/std/containers/sequences/vector/db_iterators_8.pass.cpp)0
-rw-r--r--test/libcxx/containers/sequences/vector/version.pass.cpp (renamed from test/std/containers/sequences/vector/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/unord/key_value_traits.pass.cpp59
-rw-r--r--test/libcxx/containers/unord/next_prime.pass.cpp (renamed from test/std/containers/unord/next_prime.pass.cpp)0
-rw-r--r--test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp (renamed from test/std/containers/unord/unord.map/db_iterators_7.pass.cpp)0
-rw-r--r--test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp (renamed from test/std/containers/unord/unord.map/db_iterators_8.pass.cpp)0
-rw-r--r--test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp (renamed from test/std/containers/unord/unord.map/db_local_iterators_7.pass.cpp)0
-rw-r--r--test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp (renamed from test/std/containers/unord/unord.map/db_local_iterators_8.pass.cpp)0
-rw-r--r--test/libcxx/containers/unord/unord.map/version.pass.cpp (renamed from test/std/containers/unord/unord.map/version.pass.cpp)0
-rw-r--r--test/libcxx/containers/unord/unord.set/insert_dup_alloc.pass.cpp48
-rw-r--r--test/libcxx/containers/unord/unord.set/version.pass.cpp (renamed from test/std/containers/unord/unord.set/version.pass.cpp)0
-rw-r--r--test/libcxx/depr/depr.c.headers/extern_c.pass.cpp (renamed from test/std/depr/depr.c.headers/extern_c.pass.cpp)0
-rw-r--r--test/libcxx/depr/depr.str.strstreams/version.pass.cpp (renamed from test/std/depr/depr.str.strstreams/version.pass.cpp)0
-rw-r--r--test/libcxx/diagnostics/assertions/version_cassert.pass.cpp20
-rw-r--r--test/libcxx/diagnostics/errno/version_cerrno.pass.cpp19
-rw-r--r--test/libcxx/diagnostics/std.exceptions/version.pass.cpp (renamed from test/std/diagnostics/std.exceptions/version.pass.cpp)0
-rw-r--r--test/libcxx/diagnostics/syserr/version.pass.cpp (renamed from test/std/diagnostics/syserr/version.pass.cpp)0
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp19
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp10
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp4
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp15
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp13
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp15
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp13
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp2
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp13
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp9
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp15
-rw-r--r--test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp101
-rw-r--r--test/libcxx/experimental/filesystem/lit.local.cfg3
-rw-r--r--test/libcxx/experimental/filesystem/version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp178
-rw-r--r--test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp42
-rw-r--r--test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp65
-rw-r--r--test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp45
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp22
-rw-r--r--test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp61
-rw-r--r--test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp53
-rw-r--r--test/libcxx/experimental/memory/memory.resource.synop/version.pass.cpp22
-rw-r--r--test/libcxx/experimental/optional/version.pass.cpp (renamed from test/std/experimental/optional/version.pass.cpp)0
-rw-r--r--test/libcxx/experimental/utilities/meta/version.pass.cpp (renamed from test/std/experimental/utilities/meta/version.pass.cpp)0
-rw-r--r--test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp7
-rw-r--r--test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp7
-rw-r--r--test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp7
-rw-r--r--test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp9
-rw-r--r--test/libcxx/experimental/utilities/utility/version.pass.cpp (renamed from test/std/experimental/utilities/utility/version.pass.cpp)0
-rw-r--r--test/libcxx/extensions/hash/specializations.fail.cpp (renamed from test/std/extensions/hash/specializations.fail.cpp)0
-rw-r--r--test/libcxx/extensions/hash/specializations.pass.cpp (renamed from test/std/extensions/hash/specializations.pass.cpp)0
-rw-r--r--test/libcxx/extensions/hash_map/const_iterator.fail.cpp (renamed from test/std/extensions/hash_map/const_iterator.fail.cpp)0
-rw-r--r--test/libcxx/extensions/nothing_to_do.pass.cpp (renamed from test/std/extensions/nothing_to_do.pass.cpp)0
-rw-r--r--test/libcxx/input.output/file.streams/c.files/version_ccstdio.pass.cpp (renamed from test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp)0
-rw-r--r--test/libcxx/input.output/file.streams/c.files/version_cinttypes.pass.cpp (renamed from test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp)0
-rw-r--r--test/libcxx/input.output/file.streams/fstreams/version.pass.cpp (renamed from test/std/input.output/file.streams/fstreams/version.pass.cpp)0
-rw-r--r--test/libcxx/input.output/iostream.format/input.streams/version.pass.cpp (renamed from test/std/input.output/iostream.format/input.streams/version.pass.cpp)0
-rw-r--r--test/libcxx/input.output/iostream.format/output.streams/version.pass.cpp (renamed from test/std/input.output/iostream.format/output.streams/version.pass.cpp)0
-rw-r--r--test/libcxx/input.output/iostream.format/std.manip/version.pass.cpp (renamed from test/std/input.output/iostream.format/std.manip/version.pass.cpp)0
-rw-r--r--test/libcxx/input.output/iostream.forward/version.pass.cpp (renamed from test/std/input.output/iostream.forward/version.pass.cpp)0
-rw-r--r--test/libcxx/input.output/iostream.objects/version.pass.cpp (renamed from test/std/input.output/iostream.objects/version.pass.cpp)0
-rw-r--r--test/libcxx/input.output/iostreams.base/version.pass.cpp (renamed from test/std/input.output/iostreams.base/version.pass.cpp)0
-rw-r--r--test/libcxx/input.output/stream.buffers/version.pass.cpp (renamed from test/std/input.output/stream.buffers/version.pass.cpp)0
-rw-r--r--test/libcxx/input.output/string.streams/version.pass.cpp (renamed from test/std/input.output/string.streams/version.pass.cpp)0
-rw-r--r--test/libcxx/iterators/trivial_iterators.pass.cpp24
-rw-r--r--test/libcxx/iterators/version.pass.cpp (renamed from test/std/iterators/version.pass.cpp)0
-rw-r--r--test/libcxx/language.support/cstdint/version.pass.cpp (renamed from test/std/language.support/cstdint/version.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp (renamed from test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp)3
-rw-r--r--test/libcxx/language.support/support.dynamic/version.pass.cpp (renamed from test/std/language.support/support.dynamic/version.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.exception/version.pass.cpp (renamed from test/std/language.support/support.exception/version.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.initlist/version.pass.cpp (renamed from test/std/language.support/support.initlist/version.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.limits/c.limits/version_cfloat.pass.cpp (renamed from test/std/language.support/support.limits/c.limits/version_cfloat.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.limits/c.limits/version_climits.pass.cpp (renamed from test/std/language.support/support.limits/c.limits/version_climits.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.limits/limits/version.pass.cpp (renamed from test/std/language.support/support.limits/limits/version.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.rtti/version.pass.cpp (renamed from test/std/language.support/support.rtti/version.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.runtime/version_csetjmp.pass.cpp (renamed from test/std/language.support/support.runtime/version_csetjmp.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.runtime/version_csignal.pass.cpp (renamed from test/std/language.support/support.runtime/version_csignal.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.runtime/version_cstdarg.pass.cpp (renamed from test/std/language.support/support.runtime/version_cstdarg.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.runtime/version_cstdbool.pass.cpp (renamed from test/std/language.support/support.runtime/version_cstdbool.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.runtime/version_cstdlib.pass.cpp (renamed from test/std/language.support/support.runtime/version_cstdlib.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.runtime/version_ctime.pass.cpp (renamed from test/std/language.support/support.runtime/version_ctime.pass.cpp)0
-rw-r--r--test/libcxx/language.support/support.types/version.pass.cpp (renamed from test/std/language.support/support.types/version.pass.cpp)0
-rw-r--r--test/libcxx/localization/c.locales/version.pass.cpp (renamed from test/std/localization/c.locales/version.pass.cpp)0
-rw-r--r--test/libcxx/localization/locale.categories/__scan_keyword.pass.cpp (renamed from test/std/localization/locale.categories/__scan_keyword.pass.cpp)0
-rw-r--r--test/libcxx/localization/locale.stdcvt/version.pass.cpp (renamed from test/std/localization/locale.stdcvt/version.pass.cpp)0
-rw-r--r--test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp35
-rw-r--r--test/libcxx/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp (renamed from test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp)0
-rw-r--r--test/libcxx/localization/locales/locale/locale.types/locale.id/id.pass.cpp (renamed from test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp)0
-rw-r--r--test/libcxx/localization/version.pass.cpp (renamed from test/std/localization/version.pass.cpp)0
-rw-r--r--test/libcxx/numerics/cfenv/version.pass.cpp (renamed from test/std/numerics/cfenv/version.pass.cpp)0
-rw-r--r--test/libcxx/numerics/complex.number/version.pass.cpp (renamed from test/std/numerics/complex.number/version.pass.cpp)0
-rw-r--r--test/libcxx/numerics/numarray/version.pass.cpp (renamed from test/std/numerics/numarray/version.pass.cpp)0
-rw-r--r--test/libcxx/numerics/numeric.ops/version.pass.cpp (renamed from test/std/numerics/numeric.ops/version.pass.cpp)0
-rw-r--r--test/libcxx/numerics/rand/rand.synopsis/version.pass.cpp (renamed from test/std/numerics/rand/rand.synopsis/version.pass.cpp)0
-rw-r--r--test/libcxx/selftest/test_macros.pass.cpp54
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp (renamed from test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db1.pass.cpp)0
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp (renamed from test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db2.pass.cpp)0
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp (renamed from test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db1.pass.cpp)0
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp (renamed from test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db2.pass.cpp)0
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp (renamed from test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db3.pass.cpp)0
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp (renamed from test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db4.pass.cpp)0
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp (renamed from test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type4.fail.cpp)25
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp34
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp (renamed from test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type3.fail.cpp)24
-rw-r--r--test/libcxx/strings/c.strings/version_cctype.pass.cpp (renamed from test/std/strings/c.strings/version_cctype.pass.cpp)0
-rw-r--r--test/libcxx/strings/c.strings/version_cstring.pass.cpp (renamed from test/std/strings/c.strings/version_cstring.pass.cpp)0
-rw-r--r--test/libcxx/strings/c.strings/version_cuchar.pass.cpp (renamed from test/std/strings/c.strings/version_cuchar.pass.cpp)0
-rw-r--r--test/libcxx/strings/c.strings/version_cwchar.pass.cpp (renamed from test/std/strings/c.strings/version_cwchar.pass.cpp)0
-rw-r--r--test/libcxx/strings/c.strings/version_cwctype.pass.cpp (renamed from test/std/strings/c.strings/version_cwctype.pass.cpp)0
-rw-r--r--test/libcxx/strings/iterators.exceptions.pass.cpp17
-rw-r--r--test/libcxx/strings/iterators.noexcept.pass.cpp12
-rw-r--r--test/libcxx/strings/version.pass.cpp (renamed from test/std/strings/version.pass.cpp)0
-rw-r--r--test/libcxx/test/config.py117
-rw-r--r--test/libcxx/test/format.py11
-rw-r--r--test/libcxx/test/target_info.py22
-rw-r--r--test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp53
-rw-r--r--test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp53
-rw-r--r--test/libcxx/thread/futures/futures.task/types.pass.cpp (renamed from test/std/thread/futures/futures.tas/types.pass.cpp)4
-rw-r--r--test/libcxx/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp (renamed from test/std/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp)0
-rw-r--r--test/libcxx/thread/thread.condition/version.pass.cpp (renamed from test/std/thread/thread.condition/version.pass.cpp)0
-rw-r--r--test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp35
-rw-r--r--test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp (renamed from test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp)0
-rw-r--r--test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp (renamed from test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp)0
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_annotations_not_enabled.pass.cpp26
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp25
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp26
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp23
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp30
-rw-r--r--test/libcxx/thread/thread.mutex/version.pass.cpp (renamed from test/std/thread/thread.mutex/version.pass.cpp)0
-rw-r--r--test/libcxx/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp (renamed from test/std/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp)0
-rw-r--r--test/libcxx/thread/thread.threads/thread.thread.class/types.pass.cpp (renamed from test/std/thread/thread.threads/thread.thread.class/types.pass.cpp)0
-rw-r--r--test/libcxx/thread/thread.threads/version.pass.cpp (renamed from test/std/thread/thread.threads/version.pass.cpp)0
-rw-r--r--test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp (renamed from test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp)82
-rw-r--r--test/libcxx/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp (renamed from test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp)98
-rw-r--r--test/libcxx/utilities/function.objects/func.require/bullet_7.pass.cpp (renamed from test/std/utilities/function.objects/func.require/bullet_5.pass.cpp)4
-rw-r--r--test/libcxx/utilities/function.objects/func.require/invoke.pass.cpp (renamed from test/std/utilities/function.objects/func.require/invoke.pass.cpp)15
-rw-r--r--test/libcxx/utilities/function.objects/func.require/invoke_helpers.h (renamed from test/std/utilities/function.objects/func.require/invoke_helpers.h)230
-rw-r--r--test/libcxx/utilities/function.objects/version.pass.cpp (renamed from test/std/utilities/function.objects/version.pass.cpp)0
-rw-r--r--test/libcxx/utilities/memory/version.pass.cpp (renamed from test/std/utilities/memory/version.pass.cpp)0
-rw-r--r--test/libcxx/utilities/meta/is_referenceable.pass.cpp193
-rw-r--r--test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp (renamed from test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp)0
-rw-r--r--test/libcxx/utilities/meta/version.pass.cpp (renamed from test/std/utilities/meta/version.pass.cpp)0
-rw-r--r--test/libcxx/utilities/ratio/version.pass.cpp (renamed from test/std/utilities/ratio/version.pass.cpp)0
-rw-r--r--test/libcxx/utilities/template.bitset/version.pass.cpp (renamed from test/std/utilities/template.bitset/version.pass.cpp)0
-rw-r--r--test/libcxx/utilities/time/version.pass.cpp (renamed from test/std/utilities/time/version.pass.cpp)0
-rw-r--r--test/libcxx/utilities/tuple/version.pass.cpp (renamed from test/std/utilities/tuple/version.pass.cpp)0
-rw-r--r--test/libcxx/utilities/type.index/version.pass.cpp (renamed from test/std/utilities/type.index/version.pass.cpp)0
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp55
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp147
-rw-r--r--test/libcxx/utilities/utility/version.pass.cpp (renamed from test/std/utilities/utility/version.pass.cpp)0
-rw-r--r--test/lit.site.cfg.in6
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp2
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp2
-rw-r--r--test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp127
-rw-r--r--test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp125
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp6
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp6
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp6
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp6
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp6
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp6
-rw-r--r--test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp6
-rw-r--r--test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp30
-rw-r--r--test/std/atomics/atomics.flag/clear.pass.cpp40
-rw-r--r--test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp101
-rw-r--r--test/std/atomics/atomics.lockfree/lockfree.pass.cpp8
-rw-r--r--test/std/atomics/atomics.types.generic/address.pass.cpp8
-rw-r--r--test/std/atomics/atomics.types.generic/bool.pass.cpp4
-rw-r--r--test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp4
-rw-r--r--test/std/atomics/atomics.types.generic/integral.pass.cpp26
-rw-r--r--test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp25
-rw-r--r--test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp2
-rw-r--r--test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp6
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp6
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h14
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp2
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp2
-rw-r--r--test/std/containers/associative/iterator_types.pass.cpp131
-rw-r--r--test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp31
-rw-r--r--test/std/containers/associative/map/compare.pass.cpp2
-rw-r--r--test/std/containers/associative/map/incomplete_type.pass.cpp29
-rw-r--r--test/std/containers/associative/map/map.access/at.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.access/empty.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.access/index_key.pass.cpp43
-rw-r--r--test/std/containers/associative/map/map.access/index_rv_key.pass.cpp29
-rw-r--r--test/std/containers/associative/map/map.access/iterator.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.access/max_size.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.access/size.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/compare.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/associative/map/map.cons/copy.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/copy_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/default.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/associative/map/map.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/move.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/move_alloc.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.cons/move_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.modifiers/clear.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/emplace.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp4
-rw-r--r--test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp31
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp103
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp91
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp96
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp11
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp108
-rw-r--r--test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp13
-rw-r--r--test/std/containers/associative/map/map.ops/count.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/count0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/count1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/count2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/count3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/find.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/find0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/find1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/find2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/find3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound.pass.cpp4
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound.pass.cpp4
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp6
-rw-r--r--test/std/containers/associative/map/map.special/member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/map/map.special/non_member_swap.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp24
-rw-r--r--test/std/containers/associative/map/types.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/empty.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/incomplete_type.pass.cpp29
-rw-r--r--test/std/containers/associative/multimap/iterator.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/max_size.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/default.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp4
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp28
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp94
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp90
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp96
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp91
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp25
-rw-r--r--test/std/containers/associative/multimap/size.pass.cpp2
-rw-r--r--test/std/containers/associative/multimap/types.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/clear.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/count.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/emplace.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/empty.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/equal_range.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/erase_iter.pass.cpp4
-rw-r--r--test/std/containers/associative/multiset/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/erase_key.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/find.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/incomplete_type.pass.cpp29
-rw-r--r--test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp26
-rw-r--r--test/std/containers/associative/multiset/insert_cv.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_iter_cv.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_iter_rv.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/insert_rv.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/iterator.pass.cpp6
-rw-r--r--test/std/containers/associative/multiset/lower_bound.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/max_size.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/default.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp4
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp25
-rw-r--r--test/std/containers/associative/multiset/size.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/types.pass.cpp2
-rw-r--r--test/std/containers/associative/multiset/upper_bound.pass.cpp2
-rw-r--r--test/std/containers/associative/set/clear.pass.cpp2
-rw-r--r--test/std/containers/associative/set/count.pass.cpp2
-rw-r--r--test/std/containers/associative/set/emplace.pass.cpp2
-rw-r--r--test/std/containers/associative/set/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/associative/set/empty.pass.cpp2
-rw-r--r--test/std/containers/associative/set/equal_range.pass.cpp2
-rw-r--r--test/std/containers/associative/set/erase_iter.pass.cpp4
-rw-r--r--test/std/containers/associative/set/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/set/erase_key.pass.cpp2
-rw-r--r--test/std/containers/associative/set/find.pass.cpp2
-rw-r--r--test/std/containers/associative/set/incomplete_type.pass.cpp29
-rw-r--r--test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp29
-rw-r--r--test/std/containers/associative/set/insert_cv.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_iter_cv.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_iter_rv.pass.cpp2
-rw-r--r--test/std/containers/associative/set/insert_rv.pass.cpp2
-rw-r--r--test/std/containers/associative/set/iterator.pass.cpp2
-rw-r--r--test/std/containers/associative/set/lower_bound.pass.cpp4
-rw-r--r--test/std/containers/associative/set/max_size.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/associative/set/set.cons/default.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/associative/set/set.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/iter_iter.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/move.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/move_alloc.pass.cpp4
-rw-r--r--test/std/containers/associative/set/set.cons/move_assign.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/set/set.special/member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.special/non_member_swap.pass.cpp2
-rw-r--r--test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp24
-rw-r--r--test/std/containers/associative/set/size.pass.cpp2
-rw-r--r--test/std/containers/associative/set/types.pass.cpp2
-rw-r--r--test/std/containers/associative/set/upper_bound.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp5
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp5
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp7
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/priority.queue/types.fail.cpp35
-rw-r--r--test/std/containers/container.adaptors/priority.queue/types.pass.cpp22
-rw-r--r--test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp7
-rw-r--r--test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/queue/queue.defn/types.fail.cpp20
-rw-r--r--test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp14
-rw-r--r--test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp7
-rw-r--r--test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/stack/stack.defn/types.fail.cpp35
-rw-r--r--test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp14
-rw-r--r--test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp4
-rw-r--r--test/std/containers/map_allocator_requirement_test_templates.h743
-rw-r--r--test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp14
-rw-r--r--test/std/containers/sequences/array/array.special/swap.pass.cpp38
-rw-r--r--test/std/containers/sequences/array/array.swap/swap.pass.cpp48
-rw-r--r--test/std/containers/sequences/array/at.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/front_back.pass.cpp2
-rw-r--r--test/std/containers/sequences/array/indexing.pass.cpp2
-rw-r--r--test/std/containers/sequences/array/iterators.pass.cpp2
-rw-r--r--test/std/containers/sequences/array/types.pass.cpp43
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/access.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/default.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp8
-rw-r--r--test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/move.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/size.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp14
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp8
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp8
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp6
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp6
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp6
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.special/copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.special/move.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.special/swap.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/deque/iterators.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/types.pass.cpp16
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp8
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp4
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp21
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/merge.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp10
-rw-r--r--test/std/containers/sequences/forwardlist/incomplete.pass.cpp53
-rw-r--r--test/std/containers/sequences/forwardlist/max_size.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/types.pass.cpp16
-rw-r--r--test/std/containers/sequences/list/iterators.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/assign_move.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/default.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp8
-rw-r--r--test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/move.pass.cpp15
-rw-r--r--test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/size_type.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/clear.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp29
-rw-r--r--test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp133
-rw-r--r--test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp28
-rw-r--r--test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp89
-rw-r--r--test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp97
-rw-r--r--test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp15
-rw-r--r--test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/merge.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/remove.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/remove_if.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/reverse.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/sort.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp23
-rw-r--r--test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp23
-rw-r--r--test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp23
-rw-r--r--test/std/containers/sequences/list/list.ops/unique.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.special/db_swap_1.pass.cpp59
-rw-r--r--test/std/containers/sequences/list/list.special/swap.pass.cpp12
-rw-r--r--test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/list/types.pass.cpp47
-rw-r--r--test/std/containers/sequences/vector.bool/assign_copy.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/assign_move.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/capacity.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/construct_default.pass.cpp6
-rw-r--r--test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector.bool/construct_size.pass.cpp14
-rw-r--r--test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/copy.pass.cpp14
-rw-r--r--test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp20
-rw-r--r--test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector.bool/emplace.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector.bool/emplace_back.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector.bool/erase_iter.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/iterators.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/move.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/move_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/push_back.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/reference.swap.pass.cpp39
-rw-r--r--test/std/containers/sequences/vector.bool/reserve.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/resize_size.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/swap.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp10
-rw-r--r--test/std/containers/sequences/vector.bool/types.pass.cpp12
-rw-r--r--test/std/containers/sequences/vector.bool/vector_bool.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/contiguous.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/iterators.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/types.pass.cpp36
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp10
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp12
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp22
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp14
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp20
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp18
-rw-r--r--test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp4
-rw-r--r--test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp38
-rw-r--r--test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp4
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp12
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp7
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp11
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp19
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp7
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.cons/copy.pass.cpp34
-rw-r--r--test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp6
-rw-r--r--test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp6
-rw-r--r--test/std/containers/sequences/vector/vector.cons/move.pass.cpp44
-rw-r--r--test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp42
-rw-r--r--test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp6
-rw-r--r--test/std/containers/sequences/vector/vector.data/data.pass.cpp33
-rw-r--r--test/std/containers/sequences/vector/vector.data/data_const.pass.cpp31
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp14
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp23
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp18
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp18
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_db1.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_db2.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp58
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db1.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db2.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db3.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db4.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp6
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp14
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp14
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp12
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp32
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp32
-rw-r--r--test/std/containers/sequences/vector/vector.special/db_swap_1.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.special/swap.pass.cpp82
-rw-r--r--test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp10
-rw-r--r--test/std/containers/set_allocator_requirement_test_templates.h354
-rw-r--r--test/std/containers/unord/iterator_difference_type.pass.cpp154
-rw-r--r--test/std/containers/unord/unord.map/bucket.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/bucket_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/count.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/eq.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/equal_range_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/find_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/find_non_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/incomplete_type.pass.cpp37
-rw-r--r--test/std/containers/unord/unord.map/iterators.pass.cpp4
-rw-r--r--test/std/containers/unord/unord.map/local_iterators.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/max_load_factor.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/max_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/rehash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/reserve.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/types.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp4
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp32
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp32
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp59
-rw-r--r--test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp31
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp103
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp33
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp36
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp19
-rw-r--r--test/std/containers/unord/unord.multimap/bucket.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/bucket_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/count.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/db_iterators_7.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/db_iterators_8.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/eq.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/find_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/find_non_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/incomplete.pass.cpp37
-rw-r--r--test/std/containers/unord/unord.multimap/iterators.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/load_factor.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/local_iterators.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/max_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/rehash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/reserve.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/swap_member.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/types.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp4
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp32
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp32
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp4
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp8
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp27
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp33
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp32
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/bucket.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/bucket_count.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/bucket_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/clear.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/count.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/db_iterators_7.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/db_iterators_8.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/emplace.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/eq.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp4
-rw-r--r--test/std/containers/unord/unord.multiset/erase_key.pass.cpp8
-rw-r--r--test/std/containers/unord/unord.multiset/erase_range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/find_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/find_non_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/incomplete.pass.cpp38
-rw-r--r--test/std/containers/unord/unord.multiset/insert_allocator_requirements.pass.cpp25
-rw-r--r--test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/insert_init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/insert_range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/iterators.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/load_factor.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/local_iterators.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/max_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/rehash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/reserve.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/swap_member.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/types.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp22
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/bucket.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/bucket_count.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/bucket_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/clear.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/count.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/db_iterators_7.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/db_iterators_8.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/db_local_iterators_7.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/db_local_iterators_8.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/emplace.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/emplace_hint.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/eq.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/equal_range_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/erase_const_iter.pass.cpp4
-rw-r--r--test/std/containers/unord/unord.set/erase_key.pass.cpp8
-rw-r--r--test/std/containers/unord/unord.set/erase_range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/find_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/find_non_const.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/incomplete.pass.cpp38
-rw-r--r--test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp29
-rw-r--r--test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/insert_init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/insert_range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/insert_rvalue.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/iterators.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/load_factor.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/local_iterators.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/max_bucket_count.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/max_load_factor.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/max_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/rehash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/reserve.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/swap_member.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/types.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp10
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp29
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp22
-rw-r--r--test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp2
-rw-r--r--test/std/depr/depr.c.headers/fenv_h.pass.cpp2
-rw-r--r--test/std/depr/depr.c.headers/inttypes_h.pass.cpp2
-rw-r--r--test/std/depr/depr.c.headers/math_h.pass.cpp51
-rw-r--r--test/std/depr/depr.c.headers/math_h_isinf.pass.cpp30
-rw-r--r--test/std/depr/depr.c.headers/math_h_isnan.pass.cpp30
-rw-r--r--test/std/depr/depr.c.headers/setjmp_h.pass.cpp1
-rw-r--r--test/std/depr/depr.c.headers/stdarg_h.pass.cpp4
-rw-r--r--test/std/depr/depr.c.headers/stdint_h.pass.cpp8
-rw-r--r--test/std/depr/depr.c.headers/stdio_h.pass.cpp12
-rw-r--r--test/std/depr/depr.c.headers/string_h.pass.cpp11
-rw-r--r--test/std/depr/depr.c.headers/time_h.pass.cpp2
-rw-r--r--test/std/depr/depr.c.headers/wchar_h.pass.cpp39
-rw-r--r--test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp.pass.cpp1
-rw-r--r--test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp_size.pass.cpp1
-rw-r--r--test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp.pass.cpp1
-rw-r--r--test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp_size.pass.cpp1
-rw-r--r--test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/cp_size_mode.pass.cpp1
-rw-r--r--test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp1
-rw-r--r--test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/cp_size_mode.pass.cpp1
-rw-r--r--test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp1
-rw-r--r--test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp2
-rw-r--r--test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp32
-rw-r--r--test/std/depr/exception.unexpected/set.unexpected/get_unexpected.pass.cpp2
-rw-r--r--test/std/diagnostics/assertions/cassert.pass.cpp4
-rw-r--r--test/std/diagnostics/errno/cerrno.pass.cpp4
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp9
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp14
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp14
-rw-r--r--test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp8
-rw-r--r--test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp12
-rw-r--r--test/std/experimental/algorithms/alg.search/search.pass.cpp7
l---------test/std/experimental/filesystem/Inputs/static_test_env/bad_symlink1
-rw-r--r--test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/afile30
-rw-r--r--test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/dir3/file50
-rw-r--r--test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/file40
l---------test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/symlink_to_dir31
-rw-r--r--test/std/experimental/filesystem/Inputs/static_test_env/dir1/file10
-rw-r--r--test/std/experimental/filesystem/Inputs/static_test_env/dir1/file21
-rw-r--r--test/std/experimental/filesystem/Inputs/static_test_env/empty_file0
-rw-r--r--test/std/experimental/filesystem/Inputs/static_test_env/non_empty_file1
l---------test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_dir1
l---------test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_empty_file1
-rw-r--r--test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp97
-rw-r--r--test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp113
-rw-r--r--test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp82
-rw-r--r--test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp89
-rw-r--r--test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp51
-rw-r--r--test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp50
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp59
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp98
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp246
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp36
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp117
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp62
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp116
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp61
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp38
-rw-r--r--test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp61
-rw-r--r--test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp50
-rw-r--r--test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp46
-rw-r--r--test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp103
-rw-r--r--test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp106
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp241
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp37
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp43
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp153
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp126
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp277
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp35
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp31
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp41
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp83
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp198
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp57
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp63
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp45
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp55
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp72
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp73
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp69
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp81
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp43
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp63
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp40
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp47
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp138
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp32
-rw-r--r--test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp33
-rw-r--r--test/std/experimental/filesystem/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp14
-rw-r--r--test/std/experimental/filesystem/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp14
-rw-r--r--test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp53
-rw-r--r--test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp66
-rw-r--r--test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp69
-rw-r--r--test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp50
-rw-r--r--test/std/experimental/filesystem/class.path/synop.pass.cpp39
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp79
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp158
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp240
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp66
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp43
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp240
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp80
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp169
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp93
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp162
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp61
-rw-r--r--test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp75
-rw-r--r--test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp64
-rw-r--r--test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp46
-rw-r--r--test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp48
-rw-r--r--test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp68
-rw-r--r--test/std/experimental/filesystem/fs.error.report/tested_elsewhere.pass.cpp12
-rw-r--r--test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp31
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp117
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp120
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp251
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp164
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp108
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp70
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp104
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp104
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp81
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp90
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp92
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp93
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp88
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp88
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp79
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp86
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp84
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp84
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp91
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp80
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp84
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp84
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp87
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp84
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp105
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp361
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp158
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp100
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp97
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp141
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp125
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp109
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp127
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp159
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp59
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp192
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp58
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp110
-rw-r--r--test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp24
-rw-r--r--test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp24
-rw-r--r--test/std/experimental/filesystem/lit.local.cfg3
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp6
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp8
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp8
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp8
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp6
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp8
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp8
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp8
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp9
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp9
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp2
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp2
-rw-r--r--test/std/experimental/iterator/nothing_to_do.pass.cpp12
-rw-r--r--test/std/experimental/iterator/ostream.joiner/ostream.joiner.cons/ostream_joiner.cons.pass.cpp58
-rw-r--r--test/std/experimental/iterator/ostream.joiner/ostream.joiner.creation/make_ostream_joiner.pass.cpp53
-rw-r--r--test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.assign.pass.cpp120
-rw-r--r--test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.postincrement.pass.cpp46
-rw-r--r--test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.pretincrement.pass.cpp46
-rw-r--r--test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.star.pass.cpp46
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp29
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/copy.pass.cpp48
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp49
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/memory_resource_convert.pass.cpp45
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/other_alloc.pass.cpp57
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp134
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp105
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp112
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp53
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp112
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp109
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp110
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp130
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp190
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp62
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp52
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp57
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp53
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.overview/nothing_to_do.pass.cpp10
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/nothing_to_do.pass.cpp10
-rw-r--r--test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_copy.pass.cpp53
-rw-r--r--test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_move.pass.cpp44
-rw-r--r--test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/default.pass.cpp40
-rw-r--r--test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp115
-rw-r--r--test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_is_equal.pass.cpp83
-rw-r--r--test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp39
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp37
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp37
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp37
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp69
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp57
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp67
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp73
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp87
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp85
-rw-r--r--test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp37
-rw-r--r--test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp74
-rw-r--r--test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp102
-rw-r--r--test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp118
-rw-r--r--test/std/experimental/memory/memory.resource.synop/nothing_to_do.pass.cpp13
-rw-r--r--test/std/experimental/memory/memory.resource/construct.fail.cpp25
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.eq/equal.pass.cpp76
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.eq/not_equal.pass.cpp75
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.overview/nothing_to_do.pass.cpp10
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp27
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp89
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.public/deallocate.pass.cpp74
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.public/dtor.pass.cpp59
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.public/is_equal.pass.cpp93
-rw-r--r--test/std/experimental/memory/nothing_to_do.pass.cpp13
-rw-r--r--test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp4
-rw-r--r--test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp6
-rw-r--r--test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp11
-rw-r--r--test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp11
-rw-r--r--test/std/experimental/optional/optional.hash/hash.pass.cpp3
-rw-r--r--test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp10
-rw-r--r--test/std/experimental/optional/optional.nullops/equal.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.nullops/greater.pass.cpp6
-rw-r--r--test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp6
-rw-r--r--test/std/experimental/optional/optional.nullops/less_equal.pass.cpp2
-rw-r--r--test/std/experimental/optional/optional.nullops/less_than.pass.cpp6
-rw-r--r--test/std/experimental/optional/optional.nullops/not_equal.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp9
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp9
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp22
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp3
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp9
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.object/optional_const_void.fail.cpp5
-rw-r--r--test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp9
-rw-r--r--test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp9
-rw-r--r--test/std/experimental/optional/optional.object/optional_void.fail.cpp5
-rw-r--r--test/std/experimental/optional/optional.object/types.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.relops/equal.pass.cpp9
-rw-r--r--test/std/experimental/optional/optional.relops/greater_equal.pass.cpp11
-rw-r--r--test/std/experimental/optional/optional.relops/greater_than.pass.cpp11
-rw-r--r--test/std/experimental/optional/optional.relops/less_equal.pass.cpp11
-rw-r--r--test/std/experimental/optional/optional.relops/less_than.pass.cpp11
-rw-r--r--test/std/experimental/optional/optional.relops/not_equal.pass.cpp9
-rw-r--r--test/std/experimental/optional/optional.specalg/make_optional.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.specalg/swap.pass.cpp8
-rw-r--r--test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp5
-rw-r--r--test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp5
-rw-r--r--test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp7
-rw-r--r--test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp5
-rw-r--r--test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp3
-rw-r--r--test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp5
-rw-r--r--test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp7
-rw-r--r--test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp5
-rw-r--r--test/std/experimental/string.view/string.view.access/at.pass.cpp16
-rw-r--r--test/std/experimental/string.view/string.view.access/back.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.access/data.pass.cpp6
-rw-r--r--test/std/experimental/string.view/string.view.access/front.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.access/index.pass.cpp6
-rw-r--r--test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp6
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opeq.string_view.string.pass.cpp6
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.cons/default.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_string.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.iterators/begin.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.iterators/end.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.iterators/rbegin.pass.cpp6
-rw-r--r--test/std/experimental/string.view/string.view.iterators/rend.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp6
-rw-r--r--test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp14
-rw-r--r--test/std/experimental/string.view/string.view.ops/basic_string.pass.cpp6
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp24
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp25
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp34
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp33
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp10
-rw-r--r--test/std/experimental/string.view/string.view.ops/copy.pass.cpp30
-rw-r--r--test/std/experimental/string.view/string.view.ops/substr.pass.cpp32
-rw-r--r--test/std/experimental/string.view/string.view.ops/to_string.pass.cpp8
-rw-r--r--test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp7
-rw-r--r--test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp7
-rw-r--r--test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp7
-rw-r--r--test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp7
-rw-r--r--test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp7
-rw-r--r--test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp6
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign.pass.cpp24
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_element_type.pass.cpp34
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_propagate_const.pass.cpp25
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_element_type.pass.cpp34
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign.pass.cpp32
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible.pass.cpp33
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible_propagate_const.pass.cpp33
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.explicit.ctor.pass.cpp28
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.non-explicit.ctor.pass.cpp32
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.copy_ctor.pass.cpp26
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.explicit.move_ctor.pass.cpp28
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.move_ctor.pass.cpp31
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/copy_ctor.pass.cpp24
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.explicit.ctor.pass.cpp28
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.non-explicit.ctor.pass.cpp (renamed from test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type1.fail.cpp)23
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp (renamed from test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type2.fail.cpp)25
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/dereference.pass.cpp34
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/explicit_operator_element_type_ptr.pass.cpp24
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/get.pass.cpp34
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/op_arrow.pass.cpp34
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/operator_element_type_ptr.pass.cpp35
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/dereference.pass.cpp29
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/explicit_operator_element_type_ptr.pass.cpp26
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/get.pass.cpp29
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/op_arrow.pass.cpp29
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/operator_element_type_ptr.pass.cpp28
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/swap.pass.cpp32
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp44
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp36
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater.pass.cpp38
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater_equal.pass.cpp38
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less.pass.cpp38
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less_equal.pass.cpp38
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/not_equal_to.pass.cpp36
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/equal.pass.cpp64
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_equal.pass.cpp54
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_than.pass.cpp50
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_equal.pass.cpp55
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_than.pass.cpp50
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/not_equal.pass.cpp62
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/swap.pass.cpp31
-rw-r--r--test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp5
-rw-r--r--test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp56
-rw-r--r--test/std/input.output/file.streams/c.files/cinttypes.pass.cpp2
-rw-r--r--test/std/input.output/file.streams/c.files/cstdio.pass.cpp9
-rw-r--r--test/std/input.output/file.streams/c.files/gets.fail.cpp7
-rw-r--r--test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp (renamed from test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass)41
-rw-r--r--test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp165
-rw-r--r--test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp8
-rw-r--r--test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp8
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp10
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp (renamed from test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp)0
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp10
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp2
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp2
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp2
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp2
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp2
-rw-r--r--test/std/iterators/iterator.container/data.pass.cpp10
-rw-r--r--test/std/iterators/iterator.container/empty.pass.cpp10
-rw-r--r--test/std/iterators/iterator.container/size.pass.cpp10
-rw-r--r--test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp1
-rw-r--r--test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp1
-rw-r--r--test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp1
-rw-r--r--test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp1
-rw-r--r--test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp1
-rw-r--r--test/std/iterators/iterator.range/begin-end.pass.cpp10
-rw-r--r--test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp4
-rw-r--r--test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp4
-rw-r--r--test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp4
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp45
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp7
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp6
-rw-r--r--test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.fail.cpp6
-rw-r--r--test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp6
-rw-r--r--test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/arrow.pass.cpp2
-rw-r--r--test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp3
-rw-r--r--test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp8
-rw-r--r--test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp23
-rw-r--r--test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp20
-rw-r--r--test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delim.pass.cpp (renamed from test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp)13
-rw-r--r--test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp8
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp8
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp8
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp12
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp1
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp7
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp4
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp4
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp3
-rw-r--r--test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp4
-rw-r--r--test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp8
-rw-r--r--test/std/language.support/support.exception/propagation/current_exception.pass.cpp4
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp4
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp11
-rw-r--r--test/std/language.support/support.runtime/csetjmp.pass.cpp1
-rw-r--r--test/std/language.support/support.runtime/cstdarg.pass.cpp4
-rw-r--r--test/std/language.support/support.runtime/ctime.pass.cpp9
-rw-r--r--test/std/language.support/support.types/nullptr_t.pass.cpp4
-rw-r--r--test/std/language.support/support.types/offsetof.pass.cpp6
-rw-r--r--test/std/localization/c.locales/clocale.pass.cpp1
-rw-r--r--test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp17
-rw-r--r--test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp15
-rw-r--r--test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp6
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp13
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct/money_base.pass.cpp14
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp8
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp24
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp26
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp25
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp8
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp17
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp17
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp16
-rw-r--r--test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_copy.pass.cpp31
-rw-r--r--test/std/localization/locales/locale/locale.cons/assign.pass.cpp18
-rw-r--r--test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp17
-rw-r--r--test/std/localization/locales/locale/locale.cons/copy.pass.cpp18
-rw-r--r--test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp18
-rw-r--r--test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp23
-rw-r--r--test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp18
-rw-r--r--test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp19
-rw-r--r--test/std/localization/locales/locale/locale.cons/string.pass.cpp18
-rw-r--r--test/std/localization/locales/locale/locale.types/locale.facet/tested_elsewhere.pass.cpp12
-rw-r--r--test/std/localization/locales/locale/locale.types/locale.id/tested_elsewhere.pass.cpp12
-rw-r--r--test/std/numerics/c.math/cmath.pass.cpp75
-rw-r--r--test/std/numerics/c.math/cmath_isinf.pass.cpp30
-rw-r--r--test/std/numerics/c.math/cmath_isnan.pass.cpp30
-rw-r--r--test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp2
-rw-r--r--test/std/numerics/complex.number/cases.h2
-rw-r--r--test/std/numerics/complex.number/cmplx.over/imag.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/cmplx.over/real.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/complex.literals/literals.pass.cpp8
-rw-r--r--test/std/numerics/complex.number/complex.literals/literals1.fail.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.literals/literals1.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.literals/literals2.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp2
-rw-r--r--test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp2
-rw-r--r--test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp16
-rw-r--r--test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp16
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp50
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp44
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp50
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp48
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp58
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp36
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp36
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp44
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp42
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp30
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp30
-rw-r--r--test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp46
-rw-r--r--test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp6
-rw-r--r--test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp16
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.device/ctor.pass.cpp43
-rw-r--r--test/std/numerics/rand/rand.device/eval.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp880
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp482
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp478
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp422
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp431
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp314
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp322
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp1235
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp7
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp583
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp10
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp60
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp66
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp6
-rw-r--r--test/std/re/re.alg/re.alg.match/awk.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.match/basic.fail.cpp22
-rw-r--r--test/std/re/re.alg/re.alg.match/basic.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.match/ecma.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.match/egrep.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.match/extended.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.match/grep.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.match/lookahead_capture.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.replace/test1.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.replace/test2.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.replace/test3.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.replace/test4.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.replace/test5.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.replace/test6.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.search/awk.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.search/backup.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.search/basic.fail.cpp22
-rw-r--r--test/std/re/re.alg/re.alg.search/basic.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.search/ecma.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.search/egrep.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.search/extended.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.search/grep.pass.cpp6
-rw-r--r--test/std/re/re.alg/re.alg.search/lookahead.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.search/no_update_pos.pass.cpp1
-rw-r--r--test/std/re/re.badexp/regex_error.pass.cpp1
-rw-r--r--test/std/re/re.const/re.err/error_type.pass.cpp1
-rw-r--r--test/std/re/re.const/re.matchflag/match_flag_type.pass.cpp1
-rw-r--r--test/std/re/re.const/re.matchflag/match_not_bol.pass.cpp5
-rw-r--r--test/std/re/re.const/re.matchflag/match_not_eol.pass.cpp5
-rw-r--r--test/std/re/re.const/re.synopt/syntax_option_type.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.fail.cpp12
-rw-r--r--test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.regiter/types.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.fail.cpp10
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.fail.cpp10
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.fail.cpp10
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.fail.cpp10
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.deref/deref.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.tokiter/re.tokiter.incr/post.pass.cpp1
-rw-r--r--test/std/re/re.iter/re.tokiter/types.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.assign/assign.pass.cpp3
-rw-r--r--test/std/re/re.regex/re.regex.assign/assign_iter_iter_flag.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.assign/copy.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.assign/il.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.assign/ptr.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.assign/string.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.const/constants.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp5
-rw-r--r--test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp5
-rw-r--r--test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp5
-rw-r--r--test/std/re/re.regex/re.regex.construct/copy.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/default.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/iter_iter.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/ptr.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/ptr_flg.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/string.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/string_flg.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.locale/imbue.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.nonmemb/re.regex.nmswap/swap.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.swap/swap.pass.cpp1
-rw-r--r--test/std/re/re.regex/types.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.acc/begin_end.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.acc/index.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.acc/length.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.acc/position.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.acc/prefix.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.acc/str.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.acc/suffix.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.all/get_allocator.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.const/allocator.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.const/default.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.form/form1.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.form/form2.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.form/form3.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.form/form4.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.nonmember/equal.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.size/empty.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.size/max_size.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.state/ready.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.swap/member_swap.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.swap/non_member_swap.pass.cpp1
-rw-r--r--test/std/re/re.results/types.pass.cpp1
-rw-r--r--test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp1
-rw-r--r--test/std/re/re.submatch/re.submatch.members/compare_sub_match.pass.cpp1
-rw-r--r--test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp1
-rw-r--r--test/std/re/re.submatch/re.submatch.members/default.pass.cpp1
-rw-r--r--test/std/re/re.submatch/re.submatch.members/length.pass.cpp1
-rw-r--r--test/std/re/re.submatch/re.submatch.members/operator_string.pass.cpp1
-rw-r--r--test/std/re/re.submatch/re.submatch.members/str.pass.cpp1
-rw-r--r--test/std/re/re.submatch/re.submatch.op/compare.pass.cpp5
-rw-r--r--test/std/re/re.submatch/re.submatch.op/stream.pass.cpp1
-rw-r--r--test/std/re/re.submatch/types.pass.cpp1
-rw-r--r--test/std/re/re.syn/cmatch.pass.cpp1
-rw-r--r--test/std/re/re.syn/cregex_iterator.pass.cpp1
-rw-r--r--test/std/re/re.syn/cregex_token_iterator.pass.cpp1
-rw-r--r--test/std/re/re.syn/csub_match.pass.cpp1
-rw-r--r--test/std/re/re.syn/regex.pass.cpp1
-rw-r--r--test/std/re/re.syn/smatch.pass.cpp1
-rw-r--r--test/std/re/re.syn/sregex_iterator.pass.cpp1
-rw-r--r--test/std/re/re.syn/sregex_token_iterator.pass.cpp1
-rw-r--r--test/std/re/re.syn/ssub_match.pass.cpp1
-rw-r--r--test/std/re/re.syn/wcmatch.pass.cpp1
-rw-r--r--test/std/re/re.syn/wcregex_iterator.pass.cpp1
-rw-r--r--test/std/re/re.syn/wcregex_token_iterator.pass.cpp1
-rw-r--r--test/std/re/re.syn/wcsub_match.pass.cpp1
-rw-r--r--test/std/re/re.syn/wregex.pass.cpp1
-rw-r--r--test/std/re/re.syn/wsmatch.pass.cpp1
-rw-r--r--test/std/re/re.syn/wsregex_iterator.pass.cpp1
-rw-r--r--test/std/re/re.syn/wsregex_token_iterator.pass.cpp1
-rw-r--r--test/std/re/re.syn/wssub_match.pass.cpp1
-rw-r--r--test/std/re/re.traits/default.pass.cpp1
-rw-r--r--test/std/re/re.traits/getloc.pass.cpp1
-rw-r--r--test/std/re/re.traits/imbue.pass.cpp1
-rw-r--r--test/std/re/re.traits/isctype.pass.cpp5
-rw-r--r--test/std/re/re.traits/length.pass.cpp1
-rw-r--r--test/std/re/re.traits/lookup_classname.pass.cpp14
-rw-r--r--test/std/re/re.traits/lookup_collatename.pass.cpp3
-rw-r--r--test/std/re/re.traits/transform.pass.cpp2
-rw-r--r--test/std/re/re.traits/transform_primary.pass.cpp3
-rw-r--r--test/std/re/re.traits/translate.pass.cpp1
-rw-r--r--test/std/re/re.traits/translate_nocase.pass.cpp1
-rw-r--r--test/std/re/re.traits/types.pass.cpp1
-rw-r--r--test/std/re/re.traits/value.pass.cpp1
-rw-r--r--test/std/strings/basic.string.literals/literal.pass.cpp13
-rw-r--r--test/std/strings/basic.string.literals/literal1.fail.cpp7
-rw-r--r--test/std/strings/basic.string.literals/literal1.pass.cpp5
-rw-r--r--test/std/strings/basic.string.literals/literal2.fail.cpp7
-rw-r--r--test/std/strings/basic.string.literals/literal2.pass.cpp5
-rw-r--r--test/std/strings/basic.string.literals/literal3.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.access/at.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.access/back.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.access/db_back.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.access/db_cback.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.access/db_cfront.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.access/db_cindex.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.access/db_front.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.access/db_index.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.access/front.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.access/index.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.capacity/capacity.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.capacity/clear.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.capacity/empty.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.capacity/length.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.capacity/max_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.capacity/reserve.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.capacity/resize_size.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.capacity/size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.cons/alloc.pass.cpp8
-rw-r--r--test/std/strings/basic.string/string.cons/char_assignment.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.cons/copy.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.cons/default_noexcept.pass.cpp4
-rw-r--r--test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp8
-rw-r--r--test/std/strings/basic.string/string.cons/initializer_list.pass.cpp6
-rw-r--r--test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp6
-rw-r--r--test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp7
-rw-r--r--test/std/strings/basic.string/string.cons/move.pass.cpp15
-rw-r--r--test/std/strings/basic.string/string.cons/move_alloc.pass.cpp19
-rw-r--r--test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp9
-rw-r--r--test/std/strings/basic.string/string.cons/move_assignment.pass.cpp15
-rw-r--r--test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp4
-rw-r--r--test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp7
-rw-r--r--test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp7
-rw-r--r--test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp11
-rw-r--r--test/std/strings/basic.string/string.cons/substr.pass.cpp33
-rw-r--r--test/std/strings/basic.string/string.iterators/begin.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/cbegin.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/cend.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/crbegin.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/crend.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/db_iterators_2.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/db_iterators_3.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/db_iterators_4.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/db_iterators_5.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/db_iterators_6.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/db_iterators_7.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/db_iterators_8.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/end.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/iterators.pass.cpp6
-rw-r--r--test/std/strings/basic.string/string.iterators/rbegin.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.iterators/rend.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp7
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp8
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp7
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp13
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp36
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp9
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp8
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp15
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp6
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp8
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp3
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp7
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp7
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp10
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp6
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp46
-rw-r--r--test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.require/contiguous.pass.cpp2
-rw-r--r--test/std/strings/basic.string/types.pass.cpp2
-rw-r--r--test/std/strings/c.strings/cstring.pass.cpp16
-rw-r--r--test/std/strings/c.strings/cwchar.pass.cpp34
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/lt.pass.cpp21
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq_int_type.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/not_eof.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_char_type.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_int_type.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp4
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp4
-rw-r--r--test/std/thread/futures/futures.async/async.pass.cpp185
-rw-r--r--test/std/thread/futures/futures.overview/future_errc.pass.cpp26
-rw-r--r--test/std/thread/futures/futures.overview/launch.pass.cpp14
-rw-r--r--test/std/thread/futures/futures.promise/copy_assign.fail.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/copy_ctor.fail.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_rvalue.pass.cpp3
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/assign_copy.fail.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp)3
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/assign_move.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp)5
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/ctor2.fail.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp)5
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/ctor_copy.fail.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp)3
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/ctor_default.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/ctor_func.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/ctor_move.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/swap.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.nonmembers/swap.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp (renamed from test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp)0
-rw-r--r--test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp2
-rw-r--r--test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp32
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp62
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp44
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp41
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp47
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp115
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp21
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp78
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_assign.fail.cpp9
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_ctor.fail.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp26
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp22
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp20
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp17
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp12
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp10
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp27
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp23
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp18
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp17
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/assign.fail.cpp5
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/copy.fail.cpp5
-rw-r--r--test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp6
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp70
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/constr.fail.cpp2
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp17
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp23
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp18
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp10
-rw-r--r--test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp35
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp131
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp28
-rw-r--r--test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp3
-rw-r--r--test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp7
-rw-r--r--test/std/utilities/function.objects/comparisons/equal_to.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/comparisons/greater.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/comparisons/less.pass.cpp9
-rw-r--r--test/std/utilities/function.objects/comparisons/less_equal.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp39
-rw-r--r--test/std/utilities/function.objects/comparisons/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/func.invoke/invoke.pass.cpp80
-rw-r--r--test/std/utilities/function.objects/func.memfn/member_function.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp589
-rw-r--r--test/std/utilities/function.objects/func.require/INVOKE_tested_elsewhere.pass.cpp16
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp66
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp (renamed from test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp)62
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/logical.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/refwrap/type_properties.pass.cpp7
-rw-r--r--test/std/utilities/function.objects/unord.hash/enum.pass.cpp6
-rw-r--r--test/std/utilities/function.objects/unord.hash/floating.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/unord.hash/integral.pass.cpp21
-rw-r--r--test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp22
-rw-r--r--test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp2
-rw-r--r--test/std/utilities/intseq/intseq.intseq/integer_seq.pass.cpp15
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp4
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp12
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp14
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp18
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp12
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp14
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp15
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp13
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp28
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp13
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp13
-rw-r--r--test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp20
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp49
-rw-r--r--test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp20
-rw-r--r--test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp18
-rw-r--r--test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp19
-rw-r--r--test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp46
-rw-r--r--test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp42
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp4
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp2
-rw-r--r--test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp (renamed from test/std/utilities/memory/storage.iterator/raw_storag_iterator.base.pass.cpp)4
-rw-r--r--test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp (renamed from test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp)0
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp7
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp2
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp5
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp27
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp6
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp6
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp5
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp5
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp21
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp25
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp109
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h2
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp6
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp87
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp2
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp23
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp2
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp23
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp23
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp89
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp4
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_cxx03.pass.cpp (renamed from test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_no_variadics.pass.cpp)4
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.volatile.pass.cpp4
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp6
-rw-r--r--test/std/utilities/meta/meta.help/bool_constant.pass.cpp (renamed from test/std/utilities/meta/meta.hel/bool_constant.pass.cpp)4
-rw-r--r--test/std/utilities/meta/meta.help/integral_constant.pass.cpp (renamed from test/std/utilities/meta/meta.hel/integral_constant.pass.cpp)0
-rw-r--r--test/std/utilities/meta/meta.logical/conjunction.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.logical/disjunction.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.logical/negation.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.rel/is_callable.pass.cpp160
-rw-r--r--test/std/utilities/meta/meta.rel/is_convertible.pass.cpp62
-rw-r--r--test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp115
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/enable_if2.fail.cpp5
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp86
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp70
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp6
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp48
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp25
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp48
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp9
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp11
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp5
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp5
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp5
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp5
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp9
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp5
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp9
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp9
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp15
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp6
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp14
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp5
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp83
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp81
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp98
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp43
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_with.pass.cpp78
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp5
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp6
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp4
-rw-r--r--test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp18
-rw-r--r--test/std/utilities/template.bitset/bitset.cons/default.pass.cpp17
-rw-r--r--test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp86
-rw-r--r--test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp22
-rw-r--r--test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp8
-rw-r--r--test/std/utilities/template.bitset/bitset.members/count.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/flip_all.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/index.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/left_shift.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/not_all.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/reset_all.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp3
-rw-r--r--test/std/utilities/template.bitset/bitset.members/right_shift.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/set_all.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/test.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp2
-rw-r--r--test/std/utilities/time/date.time/ctime.pass.cpp8
-rw-r--r--test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp4
-rw-r--r--test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp4
-rw-r--r--test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp4
-rw-r--r--test/std/utilities/time/time.duration/time.duration.alg/abs.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.cast/ceil.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.cast/floor.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.cast/round.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp7
-rw-r--r--test/std/utilities/time/time.duration/time.duration.literals/literals1.fail.cpp6
-rw-r--r--test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp6
-rw-r--r--test/std/utilities/time/time.duration/time.duration.literals/literals2.fail.cpp6
-rw-r--r--test/std/utilities/time/time.duration/time.duration.literals/literals2.pass.cpp5
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/ceil.pass.cpp2
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/floor.pass.cpp2
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/round.pass.cpp2
-rw-r--r--test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp2
-rw-r--r--test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp13
-rw-r--r--test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp275
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_extended_types.pass.cpp426
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_large_arity.pass.cpp144
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp214
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp12
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp19
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR22806_constrain_tuple_like_ctor.pass.cpp178
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp96
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR27684_contains_ref_to_incomplete_type.pass.cpp51
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp7
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp28
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp121
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.fail.cpp43
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp22
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.fail.cpp43
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp21
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.fail.cpp36
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp20
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp3
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp3
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.fail.cpp27
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp35
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp24
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp20
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/test_lazy_sfinae.pass.cpp102
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp38
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp1
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.array.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.utility.pass.cpp3
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp34
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.fail.cpp27
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.fail.cpp26
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.pass.cpp43
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp2
-rw-r--r--test/std/utilities/utility/as_const/as_const.pass.cpp2
-rw-r--r--test/std/utilities/utility/exchange/exchange.pass.cpp8
-rw-r--r--test/std/utilities/utility/forward/forward.pass.cpp3
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp4
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp6
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp5
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/pairs.by.type2.fail.cpp5
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/pairs.by.type3.fail.cpp5
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp7
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp6
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp44
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp50
-rw-r--r--test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp2
-rw-r--r--test/std/utilities/utility/synopsis.pass.cpp21
-rw-r--r--test/std/utilities/utility/utility.swap/swap.pass.cpp100
-rw-r--r--test/std/utilities/utility/utility.swap/swap_array.pass.cpp108
-rw-r--r--test/support/Counter.h4
-rw-r--r--test/support/MoveOnly.h2
-rw-r--r--test/support/allocators.h2
-rw-r--r--test/support/asan_testing.h10
-rw-r--r--test/support/assert_checkpoint.h73
-rw-r--r--test/support/constexpr_char_traits.hpp42
-rw-r--r--test/support/container_test_types.h492
-rw-r--r--test/support/count_new.hpp78
-rw-r--r--test/support/counting_predicates.hpp6
-rw-r--r--test/support/disable_missing_braces_warning.h2
-rw-r--r--test/support/filesystem_dynamic_test_helper.py85
-rw-r--r--test/support/filesystem_test_helper.hpp403
-rw-r--r--test/support/hexfloat.h20
-rw-r--r--test/support/is_transparent.h4
-rw-r--r--test/support/min_allocator.h58
-rw-r--r--test/support/nasty_containers.hpp51
-rw-r--r--test/support/platform_support.h23
-rw-r--r--test/support/propagate_const_helpers.h119
-rw-r--r--test/support/rapid-cxx-test.hpp847
-rw-r--r--test/support/test.support/test_convertible_header.pass.cpp68
-rw-r--r--test/support/test.support/test_macros_header_exceptions.fail.cpp24
-rw-r--r--test/support/test.support/test_macros_header_exceptions.pass.cpp24
-rw-r--r--test/support/test.support/test_macros_header_rtti.fail.cpp29
-rw-r--r--test/support/test.support/test_macros_header_rtti.pass.cpp28
-rw-r--r--test/support/test_allocator.h113
-rw-r--r--test/support/test_convertible.hpp42
-rw-r--r--test/support/test_iterators.h344
-rw-r--r--test/support/test_macros.h81
-rw-r--r--test/support/test_memory_resource.hpp507
-rw-r--r--test/support/type_id.h57
-rw-r--r--test/support/uses_alloc_types.hpp298
-rw-r--r--test/ubsan_blacklist.txt1
2294 files changed, 39056 insertions, 9348 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b67b3b43f83e..d47a9e003fc0 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -10,11 +10,16 @@ set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING
"Configuration variant to use for LIT.")
pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
+pythonize_bool(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
+pythonize_bool(LIBCXX_ENABLE_FILESYSTEM)
pythonize_bool(LIBCXX_ENABLE_RTTI)
pythonize_bool(LIBCXX_ENABLE_SHARED)
pythonize_bool(LIBCXX_BUILD_32_BITS)
pythonize_bool(LIBCXX_GENERATE_COVERAGE)
+pythonize_bool(LIBCXXABI_ENABLE_SHARED)
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
+pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
+pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
# The tests shouldn't link to any ABI library when it has been linked into
# libc++ statically or via a linker script.
@@ -22,6 +27,13 @@ if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
set(LIBCXX_CXX_ABI_LIBNAME "none")
endif()
+# By default, for non-standalone builds, libcxx and libcxxabi share a library
+# directory.
+if (NOT LIBCXX_CXX_ABI_LIBRARY_PATH)
+ set(LIBCXX_CXX_ABI_LIBRARY_PATH "${LIBCXX_LIBRARY_DIR}" CACHE PATH
+ "The path to libc++abi library.")
+endif()
+
set(LIBCXX_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
"TargetInfo to use when setting up test environment.")
set(LIBCXX_EXECUTOR "None" CACHE STRING
@@ -34,15 +46,19 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@ONLY)
+if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
+ set(experimental_dep cxx_experimental)
+endif()
+
add_lit_testsuite(check-libcxx
"Running libcxx tests"
${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS cxx)
+ DEPENDS cxx ${experimental_dep})
if (LIBCXX_GENERATE_COVERAGE)
include(CodeCoverage)
set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/coverage")
- set(capture_dirs "${LIBCXX_LIB_CMAKEFILES_DIR}/cxx.dir/;${CMAKE_CURRENT_BINARY_DIR}")
+ set(capture_dirs "${LIBCXX_LIB_CMAKEFILES_DIR}/cxx.dir/;${LIBCXX_LIB_CMAKEFILES_DIR}/cxx_experimental.dir/;${CMAKE_CURRENT_BINARY_DIR}")
set(extract_dirs "${LIBCXX_SOURCE_DIR}/include;${LIBCXX_SOURCE_DIR}/src")
setup_lcov_test_target_coverage("cxx" "${output_dir}" "${capture_dirs}" "${extract_dirs}")
endif()
diff --git a/test/std/algorithms/version.pass.cpp b/test/libcxx/algorithms/version.pass.cpp
index 20f0637e641b..20f0637e641b 100644
--- a/test/std/algorithms/version.pass.cpp
+++ b/test/libcxx/algorithms/version.pass.cpp
diff --git a/test/std/atomics/atomics.flag/init03.pass.cpp b/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp
index 0910bc5ceccb..d7b172cd1212 100644
--- a/test/std/atomics/atomics.flag/init03.pass.cpp
+++ b/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp
@@ -20,6 +20,12 @@
int main()
{
- std::atomic_flag f(false);
- assert(f.test_and_set() == 0);
+ {
+ std::atomic_flag f(false);
+ assert(f.test_and_set() == 0);
+ }
+ {
+ std::atomic_flag f(true);
+ assert(f.test_and_set() == 1);
+ }
}
diff --git a/test/std/atomics/version.pass.cpp b/test/libcxx/atomics/version.pass.cpp
index fae2736d229f..fae2736d229f 100644
--- a/test/std/atomics/version.pass.cpp
+++ b/test/libcxx/atomics/version.pass.cpp
diff --git a/test/libcxx/compiler.py b/test/libcxx/compiler.py
index 7dfb13abbd41..17e6cf441ec1 100644
--- a/test/libcxx/compiler.py
+++ b/test/libcxx/compiler.py
@@ -47,9 +47,10 @@ class CXXCompiler(object):
self.type = compiler_type
self.version = (major_ver, minor_ver, patchlevel)
- def _basicCmd(self, source_files, out, is_link=False, input_is_cxx=False):
+ def _basicCmd(self, source_files, out, is_link=False, input_is_cxx=False,
+ disable_ccache=False):
cmd = []
- if self.use_ccache and not is_link:
+ if self.use_ccache and not disable_ccache and not is_link:
cmd += ['ccache']
cmd += [self.path]
if out is not None:
@@ -65,12 +66,15 @@ class CXXCompiler(object):
return cmd
def preprocessCmd(self, source_files, out=None, flags=[]):
- cmd = self._basicCmd(source_files, out, input_is_cxx=True) + ['-E']
+ cmd = self._basicCmd(source_files, out, input_is_cxx=True,
+ disable_ccache=True) + ['-E']
cmd += self.flags + self.compile_flags + flags
return cmd
- def compileCmd(self, source_files, out=None, flags=[]):
- cmd = self._basicCmd(source_files, out, input_is_cxx=True) + ['-c']
+ def compileCmd(self, source_files, out=None, flags=[],
+ disable_ccache=False):
+ cmd = self._basicCmd(source_files, out, input_is_cxx=True,
+ disable_ccache=disable_ccache) + ['-c']
cmd += self.flags + self.compile_flags + flags
return cmd
@@ -89,8 +93,10 @@ class CXXCompiler(object):
out, err, rc = lit.util.executeCommand(cmd, env=env, cwd=cwd)
return cmd, out, err, rc
- def compile(self, source_files, out=None, flags=[], env=None, cwd=None):
- cmd = self.compileCmd(source_files, out, flags)
+ def compile(self, source_files, out=None, flags=[], env=None, cwd=None,
+ disable_ccache=False):
+ cmd = self.compileCmd(source_files, out, flags,
+ disable_ccache=disable_ccache)
out, err, rc = lit.util.executeCommand(cmd, env=env, cwd=cwd)
return cmd, out, err, rc
@@ -106,7 +112,8 @@ class CXXCompiler(object):
return cmd, out, err, rc
def compileLinkTwoSteps(self, source_file, out=None, object_file=None,
- flags=[], env=None, cwd=None):
+ flags=[], env=None, cwd=None,
+ disable_ccache=False):
if not isinstance(source_file, str):
raise TypeError('This function only accepts a single input file')
if object_file is None:
@@ -117,7 +124,8 @@ class CXXCompiler(object):
with_fn = lambda: libcxx.util.nullContext(object_file)
with with_fn() as object_file:
cc_cmd, cc_stdout, cc_stderr, rc = self.compile(
- source_file, object_file, flags=flags, env=env, cwd=cwd)
+ source_file, object_file, flags=flags, env=env, cwd=cwd,
+ disable_ccache=disable_ccache)
if rc != 0:
return cc_cmd, cc_stdout, cc_stderr, rc
diff --git a/test/std/containers/associative/map/version.pass.cpp b/test/libcxx/containers/associative/map/version.pass.cpp
index b2e3fa43e787..b2e3fa43e787 100644
--- a/test/std/containers/associative/map/version.pass.cpp
+++ b/test/libcxx/containers/associative/map/version.pass.cpp
diff --git a/test/std/containers/associative/set/version.pass.cpp b/test/libcxx/containers/associative/set/version.pass.cpp
index c3c4d926e5c3..c3c4d926e5c3 100644
--- a/test/std/containers/associative/set/version.pass.cpp
+++ b/test/libcxx/containers/associative/set/version.pass.cpp
diff --git a/test/std/containers/associative/tree_balance_after_insert.pass.cpp b/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
index b0a3e74cab0a..300c1e9a4915 100644
--- a/test/std/containers/associative/tree_balance_after_insert.pass.cpp
+++ b/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
@@ -24,6 +24,9 @@ struct Node
Node* __parent_;
bool __is_black_;
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x;}
+
Node() : __left_(), __right_(), __parent_(), __is_black_() {}
};
diff --git a/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp b/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp
new file mode 100644
index 000000000000..0befd749a50c
--- /dev/null
+++ b/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <__tree>
+#include <map>
+#include <set>
+#include <type_traits>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+void testKeyValueTrait() {
+ {
+ typedef int Tp;
+ typedef std::__tree_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, int>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::pair<int, int> Tp;
+ typedef std::__tree_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::pair<const int, int> Tp;
+ typedef std::__tree_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::__value_type<int, int> Tp;
+ typedef std::__tree_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, int>::value), "");
+ static_assert((std::is_same<Traits::mapped_type, int>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type,
+ std::pair<const int, int> >::value), "");
+ static_assert((std::is_same<Traits::__map_value_type,
+ std::pair<const int, int> >::value), "");
+ static_assert(Traits::__is_map == true, "");
+ }
+}
+
+int main() {
+ testKeyValueTrait();
+}
diff --git a/test/std/containers/associative/tree_left_rotate.pass.cpp b/test/libcxx/containers/associative/tree_left_rotate.pass.cpp
index 774cbc687985..2720b448bdd4 100644
--- a/test/std/containers/associative/tree_left_rotate.pass.cpp
+++ b/test/libcxx/containers/associative/tree_left_rotate.pass.cpp
@@ -23,6 +23,9 @@ struct Node
Node* __right_;
Node* __parent_;
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x;}
+
Node() : __left_(), __right_(), __parent_() {}
};
diff --git a/test/std/containers/associative/tree_remove.pass.cpp b/test/libcxx/containers/associative/tree_remove.pass.cpp
index fb14bd929e91..fa0b7d4a1311 100644
--- a/test/std/containers/associative/tree_remove.pass.cpp
+++ b/test/libcxx/containers/associative/tree_remove.pass.cpp
@@ -24,6 +24,9 @@ struct Node
Node* __parent_;
bool __is_black_;
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x;}
+
Node() : __left_(), __right_(), __parent_(), __is_black_() {}
};
diff --git a/test/std/containers/associative/tree_right_rotate.pass.cpp b/test/libcxx/containers/associative/tree_right_rotate.pass.cpp
index 06ec7b889452..9355a46b4e2b 100644
--- a/test/std/containers/associative/tree_right_rotate.pass.cpp
+++ b/test/libcxx/containers/associative/tree_right_rotate.pass.cpp
@@ -23,6 +23,9 @@ struct Node
Node* __right_;
Node* __parent_;
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x;}
+
Node() : __left_(), __right_(), __parent_() {}
};
diff --git a/test/std/containers/container.adaptors/queue/version.pass.cpp b/test/libcxx/containers/container.adaptors/queue/version.pass.cpp
index 35b94b33c517..35b94b33c517 100644
--- a/test/std/containers/container.adaptors/queue/version.pass.cpp
+++ b/test/libcxx/containers/container.adaptors/queue/version.pass.cpp
diff --git a/test/std/containers/container.adaptors/stack/version.pass.cpp b/test/libcxx/containers/container.adaptors/stack/version.pass.cpp
index 339d0f4dda8f..339d0f4dda8f 100644
--- a/test/std/containers/container.adaptors/stack/version.pass.cpp
+++ b/test/libcxx/containers/container.adaptors/stack/version.pass.cpp
diff --git a/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp b/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp
new file mode 100644
index 000000000000..0d9115d0f693
--- /dev/null
+++ b/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Prevent emission of the deprecated warning.
+#ifdef __clang__
+#pragma clang diagnostic ignored "-W#warnings"
+#endif
+
+#include <ext/hash_map>
+
+namespace __gnu_cxx {
+template class hash_map<int, int>;
+}
+
+int main() {
+ typedef __gnu_cxx::hash_map<int, int> Map;
+ Map m;
+ Map m2(m);
+ ((void)m2);
+}
diff --git a/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp b/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp
new file mode 100644
index 000000000000..5fd4bde66e0a
--- /dev/null
+++ b/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Prevent emission of the deprecated warning.
+#ifdef __clang__
+#pragma clang diagnostic ignored "-W#warnings"
+#endif
+
+#include <ext/hash_set>
+
+namespace __gnu_cxx {
+template class hash_set<int>;
+}
+
+int main() {
+ typedef __gnu_cxx::hash_set<int> Set;
+ Set s;
+ Set s2(s);
+ ((void)s2);
+}
diff --git a/test/std/containers/sequences/array/version.pass.cpp b/test/libcxx/containers/sequences/array/version.pass.cpp
index b89a8dd8cca3..b89a8dd8cca3 100644
--- a/test/std/containers/sequences/array/version.pass.cpp
+++ b/test/libcxx/containers/sequences/array/version.pass.cpp
diff --git a/test/std/containers/sequences/deque/version.pass.cpp b/test/libcxx/containers/sequences/deque/version.pass.cpp
index 22e663d9bc22..22e663d9bc22 100644
--- a/test/std/containers/sequences/deque/version.pass.cpp
+++ b/test/libcxx/containers/sequences/deque/version.pass.cpp
diff --git a/test/std/containers/sequences/forwardlist/version.pass.cpp b/test/libcxx/containers/sequences/forwardlist/version.pass.cpp
index 918c8dd5d73c..918c8dd5d73c 100644
--- a/test/std/containers/sequences/forwardlist/version.pass.cpp
+++ b/test/libcxx/containers/sequences/forwardlist/version.pass.cpp
diff --git a/test/std/containers/sequences/list/db_back.pass.cpp b/test/libcxx/containers/sequences/list/db_back.pass.cpp
index b16c0e90701e..96dfd2d8d2ec 100644
--- a/test/std/containers/sequences/list/db_back.pass.cpp
+++ b/test/libcxx/containers/sequences/list/db_back.pass.cpp
@@ -11,8 +11,7 @@
// Call back() on empty container.
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
@@ -21,11 +20,8 @@
#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
typedef int T;
typedef std::list<T> C;
C c(1);
@@ -33,24 +29,4 @@ int main()
c.clear();
assert(c.back() == 0);
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- C c(1);
- assert(c.back() == 0);
- c.clear();
- assert(c.back() == 0);
- assert(false);
- }
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/list/db_cback.pass.cpp b/test/libcxx/containers/sequences/list/db_cback.pass.cpp
index ba3977e16f48..1e25307c4602 100644
--- a/test/std/containers/sequences/list/db_cback.pass.cpp
+++ b/test/libcxx/containers/sequences/list/db_cback.pass.cpp
@@ -11,8 +11,7 @@
// Call back() on empty const container.
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
@@ -21,32 +20,11 @@
#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
typedef int T;
typedef std::list<T> C;
const C c;
assert(c.back() == 0);
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- const C c;
- assert(c.back() == 0);
- assert(false);
- }
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/list/db_cfront.pass.cpp b/test/libcxx/containers/sequences/list/db_cfront.pass.cpp
index d42290c43c08..9501ce193138 100644
--- a/test/std/containers/sequences/list/db_cfront.pass.cpp
+++ b/test/libcxx/containers/sequences/list/db_cfront.pass.cpp
@@ -11,8 +11,7 @@
// Call front() on empty const container.
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
@@ -21,32 +20,11 @@
#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
typedef int T;
typedef std::list<T> C;
const C c;
assert(c.front() == 0);
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- const C c;
- assert(c.front() == 0);
- assert(false);
- }
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/list/db_front.pass.cpp b/test/libcxx/containers/sequences/list/db_front.pass.cpp
index 037b16035c66..fc02895a8912 100644
--- a/test/std/containers/sequences/list/db_front.pass.cpp
+++ b/test/libcxx/containers/sequences/list/db_front.pass.cpp
@@ -11,8 +11,7 @@
// Call front() on empty container.
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
@@ -21,11 +20,8 @@
#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
typedef int T;
typedef std::list<T> C;
C c(1);
@@ -33,24 +29,4 @@ int main()
c.clear();
assert(c.front() == 0);
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- C c(1);
- assert(c.front() == 0);
- c.clear();
- assert(c.front() == 0);
- assert(false);
- }
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/list/db_iterators_6.pass.cpp b/test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp
index a5b8020b3733..3f0fd015e9a4 100644
--- a/test/std/containers/sequences/list/db_iterators_6.pass.cpp
+++ b/test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp
@@ -11,8 +11,7 @@
// Decrement iterator prior to begin.
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
@@ -21,11 +20,8 @@
#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
typedef int T;
typedef std::list<T> C;
C c(1);
@@ -34,25 +30,4 @@ int main()
assert(i == c.begin());
--i;
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- C c(1);
- C::iterator i = c.end();
- --i;
- assert(i == c.begin());
- --i;
- assert(false);
- }
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/list/db_iterators_7.pass.cpp b/test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp
index 76a491b1184d..bc2b7f4e1da2 100644
--- a/test/std/containers/sequences/list/db_iterators_7.pass.cpp
+++ b/test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp
@@ -11,8 +11,7 @@
// Increment iterator past end.
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
@@ -21,11 +20,8 @@
#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
typedef int T;
typedef std::list<T> C;
C c(1);
@@ -34,25 +30,4 @@ int main()
assert(i == c.end());
++i;
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- C c(1);
- C::iterator i = c.begin();
- ++i;
- assert(i == c.end());
- ++i;
- assert(false);
- }
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/list/db_iterators_8.pass.cpp b/test/libcxx/containers/sequences/list/db_iterators_8.pass.cpp
index 1d1ee23a393a..08c10d34a01e 100644
--- a/test/std/containers/sequences/list/db_iterators_8.pass.cpp
+++ b/test/libcxx/containers/sequences/list/db_iterators_8.pass.cpp
@@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
@@ -21,34 +20,12 @@
#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
typedef int T;
typedef std::list<T> C;
C c(1);
C::iterator i = c.end();
T j = *i;
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- C c(1);
- C::iterator i = c.end();
- T j = *i;
- assert(false);
- }
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/list/db_iterators_9.pass.cpp b/test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp
index d02fcd6e4497..e2b95d8b1664 100644
--- a/test/std/containers/sequences/list/db_iterators_9.pass.cpp
+++ b/test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp
@@ -7,12 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+// UNSUPPORTED: libcpp-no-exceptions
+
// <list>
// Operations on "NULL" iterators
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) do { if (!x) throw 1; } while(0)
#include <list>
@@ -25,7 +27,6 @@ struct S { int val; };
int main()
{
-#if _LIBCPP_STD_VER > 11
{
unsigned lib_asserts;
@@ -33,7 +34,7 @@ int main()
typedef std::list<T> C;
C::iterator i{};
C::const_iterator ci{};
-
+
lib_asserts = 0;
try { ++i; } catch (int) { ++lib_asserts; }
try { i++; } catch (int) { ++lib_asserts; }
@@ -55,13 +56,4 @@ int main()
try { (void) ci->val; } catch (int) { ++lib_asserts; }
assert(lib_asserts == 4);
}
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp b/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp
new file mode 100644
index 000000000000..c84960f37686
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list(list&& c);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+ std::list<int> l1;
+ l1.push_back(1); l1.push_back(2); l1.push_back(3);
+ std::list<int>::iterator i = l1.begin();
+ std::list<int> l2 = l1;
+ l2.erase(i);
+ assert(false);
+}
diff --git a/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp b/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp
new file mode 100644
index 000000000000..dd424e89e756
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <list>
+
+// list(list&& c);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(1))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+#include "MoveOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ std::list<int> l1 = {1, 2, 3};
+ std::list<int>::iterator i = l1.begin();
+ std::list<int> l2 = std::move(l1);
+ assert(*l2.erase(i) == 2);
+}
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp
new file mode 100644
index 000000000000..1d64f9bd9e27
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <list>
+
+// template <class... Args> void emplace(const_iterator p, Args&&... args);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+class A
+{
+ int i_;
+ double d_;
+
+ A(const A&);
+ A& operator=(const A&);
+public:
+ A(int i, double d)
+ : i_(i), d_(d) {}
+
+ int geti() const {return i_;}
+ double getd() const {return d_;}
+};
+
+int main()
+{
+ std::list<A> c1;
+ std::list<A> c2;
+ std::list<A>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
+ assert(false);
+}
diff --git a/test/std/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
index 18c15eb02c85..ec5de0264cb4 100644
--- a/test/std/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
@@ -11,41 +11,18 @@
// Call erase(const_iterator position) with end()
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
#include <cstdlib>
-#include <exception>
-
-#include "min_allocator.h"
int main()
{
- {
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int>::const_iterator i = l1.end();
l1.erase(i);
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- int a1[] = {1, 2, 3};
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>>::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
- }
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
index 61ff8409c964..833e2b54dfaf 100644
--- a/test/std/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
@@ -11,43 +11,19 @@
// Call erase(const_iterator position) with iterator from another container
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
#include <cstdlib>
-#include <exception>
-
-#include "min_allocator.h"
int main()
{
- {
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::const_iterator i = l2.begin();
l1.erase(i);
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- int a1[] = {1, 2, 3};
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a1, a1+3);
- std::list<int, min_allocator<int>>::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
- }
-#endif
}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
index 71ad497e7d97..eef7a98e739a 100644
--- a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
@@ -11,41 +11,19 @@
// Call erase(const_iterator first, const_iterator last); with first iterator from another container
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
-#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- int a1[] = {1, 2, 3};
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
}
-#endif
diff --git a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
index db76b4de4865..0dd03dc50da1 100644
--- a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
@@ -11,41 +11,18 @@
// Call erase(const_iterator first, const_iterator last); with second iterator from another container
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
-#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- int a1[] = {1, 2, 3};
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
}
-
-#endif
diff --git a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
index 25c5c6147a01..22273a89f1e5 100644
--- a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
@@ -11,41 +11,18 @@
// Call erase(const_iterator first, const_iterator last); with both iterators from another container
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
-#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- int a1[] = {1, 2, 3};
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
}
-
-#endif
diff --git a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
index 35a4ceb4848a..d1e03c8ac710 100644
--- a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
+++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
@@ -11,39 +11,17 @@
// Call erase(const_iterator first, const_iterator last); with a bad range
-#if _LIBCPP_DEBUG >= 1
-
+#define _LIBCPP_DEBUG 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
-#include <exception>
#include <cstdlib>
-#include "min_allocator.h"
-
int main()
{
- {
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
assert(false);
- }
-#if __cplusplus >= 201103L
- {
- int a1[] = {1, 2, 3};
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
}
-
-#endif
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp
new file mode 100644
index 000000000000..7fadb14affdd
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <InputIterator Iter>
+// iterator insert(const_iterator position, Iter first, Iter last);
+
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+#include "test_iterators.h"
+
+int main()
+{
+ {
+ std::list<int> v(100);
+ std::list<int> v2(100);
+ int a[] = {1, 2, 3, 4, 5};
+ const int N = sizeof(a)/sizeof(a[0]);
+ std::list<int>::iterator i = v.insert(next(v2.cbegin(), 10),
+ input_iterator<const int*>(a),
+ input_iterator<const int*>(a+N));
+ assert(false);
+ }
+}
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp
new file mode 100644
index 000000000000..0d0fd100fc91
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator insert(const_iterator position, value_type&& x);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+ std::list<int> v1(3);
+ std::list<int> v2(3);
+ v1.insert(v2.begin(), 4);
+ assert(false);
+} \ No newline at end of file
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp
new file mode 100644
index 000000000000..4fdfbfa50cbb
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator insert(const_iterator position, size_type n, const value_type& x);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+ std::list<int> c1(100);
+ std::list<int> c2;
+ std::list<int>::iterator i = c1.insert(next(c2.cbegin(), 10), 5, 1);
+ assert(false);
+}
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp
new file mode 100644
index 000000000000..9a13520b98eb
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator insert(const_iterator position, const value_type& x);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+
+int main()
+{
+ std::list<int> v1(3);
+ std::list<int> v2(3);
+ int i = 4;
+ v1.insert(v2.begin(), i);
+ assert(false);
+}
diff --git a/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp
new file mode 100644
index 000000000000..795e66d9702a
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void pop_back();
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+ int a[] = {1, 2, 3};
+ std::list<int> c(a, a+3);
+ c.pop_back();
+ assert(c == std::list<int>(a, a+2));
+ c.pop_back();
+ assert(c == std::list<int>(a, a+1));
+ c.pop_back();
+ assert(c.empty());
+ c.pop_back(); // operation under test
+ assert(false);
+}
diff --git a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp
new file mode 100644
index 000000000000..7a1180a9b585
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void splice(const_iterator position, list& x);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+ {
+ std::list<int> v1(3);
+ std::list<int> v2(3);
+ v1.splice(v2.begin(), v2);
+ assert(false);
+ }
+}
diff --git a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp
new file mode 100644
index 000000000000..fa5243e322bf
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void splice(const_iterator position, list<T,Allocator>& x, iterator i);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+ {
+ std::list<int> v1(3);
+ std::list<int> v2(3);
+ v1.splice(v1.begin(), v2, v1.begin());
+ assert(false);
+ }
+}
diff --git a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp
new file mode 100644
index 000000000000..a385b4cf7afa
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void splice(const_iterator position, list& x, iterator first, iterator last);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+ {
+ std::list<int> v1(3);
+ std::list<int> v2(3);
+ v1.splice(v1.begin(), v2, v2.begin(), v1.end());
+ assert(false);
+ }
+}
diff --git a/test/libcxx/containers/sequences/list/list.special/db_swap_1.pass.cpp b/test/libcxx/containers/sequences/list/list.special/db_swap_1.pass.cpp
new file mode 100644
index 000000000000..900f338c29eb
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.special/db_swap_1.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <class T, class Alloc>
+// void swap(list<T,Alloc>& x, list<T,Alloc>& y);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+ std::list<int>::iterator i1 = c1.begin();
+ std::list<int>::iterator i2 = c2.begin();
+ swap(c1, c2);
+ c1.erase(i2);
+ c2.erase(i1);
+ std::list<int>::iterator j = i1;
+ c1.erase(i1); // called with iterator not refering to list.
+ assert(false);
+}
diff --git a/test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp b/test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp
new file mode 100644
index 000000000000..ace9a713aae7
--- /dev/null
+++ b/test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <class T, class Alloc>
+// void swap(list<T,Alloc>& x, list<T,Alloc>& y);
+
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ // allocators do not compare equal
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef test_allocator<int> A;
+ std::list<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
+ std::list<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
+ swap(c1, c2);
+ assert(false);
+ }
+}
diff --git a/test/std/containers/sequences/list/version.pass.cpp b/test/libcxx/containers/sequences/list/version.pass.cpp
index 097c013f52cb..097c013f52cb 100644
--- a/test/std/containers/sequences/list/version.pass.cpp
+++ b/test/libcxx/containers/sequences/list/version.pass.cpp
diff --git a/test/std/containers/sequences/vector/const_value_type.pass.cpp b/test/libcxx/containers/sequences/vector/const_value_type.pass.cpp
index e16e439dec4d..2a150f7cce54 100644
--- a/test/std/containers/sequences/vector/const_value_type.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/const_value_type.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <vector>
// vector<const int> v; // an extension
@@ -16,7 +18,5 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
std::vector<const int> v = {1, 2, 3};
-#endif
}
diff --git a/test/std/containers/sequences/vector/db_back.pass.cpp b/test/libcxx/containers/sequences/vector/db_back.pass.cpp
index 05f3d07712eb..05f3d07712eb 100644
--- a/test/std/containers/sequences/vector/db_back.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_back.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_cback.pass.cpp b/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
index 5eb1a353e8b0..5eb1a353e8b0 100644
--- a/test/std/containers/sequences/vector/db_cback.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_cfront.pass.cpp b/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
index 5e54da1d444e..5e54da1d444e 100644
--- a/test/std/containers/sequences/vector/db_cfront.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_cindex.pass.cpp b/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
index 133aa5652824..133aa5652824 100644
--- a/test/std/containers/sequences/vector/db_cindex.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_front.pass.cpp b/test/libcxx/containers/sequences/vector/db_front.pass.cpp
index 388058fb3159..388058fb3159 100644
--- a/test/std/containers/sequences/vector/db_front.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_front.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_index.pass.cpp b/test/libcxx/containers/sequences/vector/db_index.pass.cpp
index 1daf076da67c..1daf076da67c 100644
--- a/test/std/containers/sequences/vector/db_index.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_index.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_iterators_2.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
index 2d43843067b7..2d43843067b7 100644
--- a/test/std/containers/sequences/vector/db_iterators_2.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_iterators_3.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
index 051d66c33394..051d66c33394 100644
--- a/test/std/containers/sequences/vector/db_iterators_3.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_iterators_4.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
index 4c2aa628de14..4c2aa628de14 100644
--- a/test/std/containers/sequences/vector/db_iterators_4.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_iterators_5.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
index 1b1090499c27..1b1090499c27 100644
--- a/test/std/containers/sequences/vector/db_iterators_5.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_iterators_6.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
index 424bc939b136..424bc939b136 100644
--- a/test/std/containers/sequences/vector/db_iterators_6.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_iterators_7.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
index 72cdb10cbc85..72cdb10cbc85 100644
--- a/test/std/containers/sequences/vector/db_iterators_7.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
diff --git a/test/std/containers/sequences/vector/db_iterators_8.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
index 7b898533197c..7b898533197c 100644
--- a/test/std/containers/sequences/vector/db_iterators_8.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
diff --git a/test/std/containers/sequences/vector/version.pass.cpp b/test/libcxx/containers/sequences/vector/version.pass.cpp
index 2c4fa1263de3..2c4fa1263de3 100644
--- a/test/std/containers/sequences/vector/version.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/version.pass.cpp
diff --git a/test/libcxx/containers/unord/key_value_traits.pass.cpp b/test/libcxx/containers/unord/key_value_traits.pass.cpp
new file mode 100644
index 000000000000..a6d1ea7a527c
--- /dev/null
+++ b/test/libcxx/containers/unord/key_value_traits.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <__hash_table>
+#include <unordered_map>
+#include <unordered_set>
+#include <type_traits>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+void testKeyValueTrait() {
+ {
+ typedef int Tp;
+ typedef std::__hash_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, int>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::pair<int, int> Tp;
+ typedef std::__hash_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::pair<const int, int> Tp;
+ typedef std::__hash_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::__hash_value_type<int, int> Tp;
+ typedef std::__hash_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, int>::value), "");
+ static_assert((std::is_same<Traits::mapped_type, int>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type,
+ std::pair<const int, int> >::value), "");
+ static_assert((std::is_same<Traits::__map_value_type,
+ std::pair<const int, int> >::value), "");
+ static_assert(Traits::__is_map == true, "");
+ }
+}
+
+int main() {
+ testKeyValueTrait();
+}
diff --git a/test/std/containers/unord/next_prime.pass.cpp b/test/libcxx/containers/unord/next_prime.pass.cpp
index 266d7f1f9d1e..266d7f1f9d1e 100644
--- a/test/std/containers/unord/next_prime.pass.cpp
+++ b/test/libcxx/containers/unord/next_prime.pass.cpp
diff --git a/test/std/containers/unord/unord.map/db_iterators_7.pass.cpp b/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
index b8db0a35ffc3..b8db0a35ffc3 100644
--- a/test/std/containers/unord/unord.map/db_iterators_7.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
diff --git a/test/std/containers/unord/unord.map/db_iterators_8.pass.cpp b/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
index c923dd77862e..c923dd77862e 100644
--- a/test/std/containers/unord/unord.map/db_iterators_8.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
diff --git a/test/std/containers/unord/unord.map/db_local_iterators_7.pass.cpp b/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
index fa1886bfff18..fa1886bfff18 100644
--- a/test/std/containers/unord/unord.map/db_local_iterators_7.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
diff --git a/test/std/containers/unord/unord.map/db_local_iterators_8.pass.cpp b/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
index 4b071cad7b47..4b071cad7b47 100644
--- a/test/std/containers/unord/unord.map/db_local_iterators_8.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
diff --git a/test/std/containers/unord/unord.map/version.pass.cpp b/test/libcxx/containers/unord/unord.map/version.pass.cpp
index fc47a326c571..fc47a326c571 100644
--- a/test/std/containers/unord/unord.map/version.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/version.pass.cpp
diff --git a/test/libcxx/containers/unord/unord.set/insert_dup_alloc.pass.cpp b/test/libcxx/containers/unord/unord.set/insert_dup_alloc.pass.cpp
deleted file mode 100644
index 76ceafed2208..000000000000
--- a/test/libcxx/containers/unord/unord.set/insert_dup_alloc.pass.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// Check that we don't allocate when trying to insert a duplicate value into a
-// unordered_set. See PR12999 http://llvm.org/bugs/show_bug.cgi?id=12999
-
-#include <cassert>
-#include <unordered_set>
-#include "count_new.hpp"
-#include "MoveOnly.h"
-
-int main()
-{
- {
- std::unordered_set<int> s;
- assert(globalMemCounter.checkNewCalledEq(0));
-
- for(int i=0; i < 100; ++i)
- s.insert(3);
-
- assert(s.size() == 1);
- assert(s.count(3) == 1);
- assert(globalMemCounter.checkNewCalledEq(2));
- }
- assert(globalMemCounter.checkOutstandingNewEq(0));
- globalMemCounter.reset();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- {
- std::unordered_set<MoveOnly> s;
- assert(globalMemCounter.checkNewCalledEq(0));
-
- for(int i=0; i<100; i++)
- s.insert(MoveOnly(3));
-
- assert(s.size() == 1);
- assert(s.count(MoveOnly(3)) == 1);
- assert(globalMemCounter.checkNewCalledEq(2));
- }
- assert(globalMemCounter.checkOutstandingNewEq(0));
- globalMemCounter.reset();
-#endif
-}
diff --git a/test/std/containers/unord/unord.set/version.pass.cpp b/test/libcxx/containers/unord/unord.set/version.pass.cpp
index d651ebdfc456..d651ebdfc456 100644
--- a/test/std/containers/unord/unord.set/version.pass.cpp
+++ b/test/libcxx/containers/unord/unord.set/version.pass.cpp
diff --git a/test/std/depr/depr.c.headers/extern_c.pass.cpp b/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp
index d4d8b5fafdde..d4d8b5fafdde 100644
--- a/test/std/depr/depr.c.headers/extern_c.pass.cpp
+++ b/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp
diff --git a/test/std/depr/depr.str.strstreams/version.pass.cpp b/test/libcxx/depr/depr.str.strstreams/version.pass.cpp
index f27665f15bcd..f27665f15bcd 100644
--- a/test/std/depr/depr.str.strstreams/version.pass.cpp
+++ b/test/libcxx/depr/depr.str.strstreams/version.pass.cpp
diff --git a/test/libcxx/diagnostics/assertions/version_cassert.pass.cpp b/test/libcxx/diagnostics/assertions/version_cassert.pass.cpp
new file mode 100644
index 000000000000..f123a05256ec
--- /dev/null
+++ b/test/libcxx/diagnostics/assertions/version_cassert.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cassert>
+
+#include <cassert>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/diagnostics/errno/version_cerrno.pass.cpp b/test/libcxx/diagnostics/errno/version_cerrno.pass.cpp
new file mode 100644
index 000000000000..7cd2be8efa92
--- /dev/null
+++ b/test/libcxx/diagnostics/errno/version_cerrno.pass.cpp
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cerrno>
+
+#include <cerrno>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/std/diagnostics/std.exceptions/version.pass.cpp b/test/libcxx/diagnostics/std.exceptions/version.pass.cpp
index d9ab009a4365..d9ab009a4365 100644
--- a/test/std/diagnostics/std.exceptions/version.pass.cpp
+++ b/test/libcxx/diagnostics/std.exceptions/version.pass.cpp
diff --git a/test/std/diagnostics/syserr/version.pass.cpp b/test/libcxx/diagnostics/syserr/version.pass.cpp
index 3851150fdf90..3851150fdf90 100644
--- a/test/std/diagnostics/syserr/version.pass.cpp
+++ b/test/libcxx/diagnostics/syserr/version.pass.cpp
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
index d274bc030881..c6a83cc61bdc 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// dynarray.cons
// template <class Alloc>
@@ -20,10 +21,8 @@
// ~dynarray();
-
-#include <__config>
-#if _LIBCPP_STD_VER > 11
+#include <__config>
#include <experimental/dynarray>
#include <cassert>
@@ -44,7 +43,7 @@ void check_allocator ( const dynarray<T> &dyn, const Allocator &alloc ) {
template <class T, class Allocator>
void test ( const std::initializer_list<T> &vals, const Allocator &alloc ) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( vals, alloc );
assert ( d1.size () == vals.size() );
assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ()));
@@ -55,7 +54,7 @@ void test ( const std::initializer_list<T> &vals, const Allocator &alloc ) {
template <class T, class Allocator>
void test ( const T &val, const Allocator &alloc1, const Allocator &alloc2 ) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( 4, alloc1 );
assert ( d1.size () == 4 );
assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } ));
@@ -68,19 +67,17 @@ void test ( const T &val, const Allocator &alloc1, const Allocator &alloc2 ) {
dynA d3 ( d2, alloc2 );
assert ( d3.size () == 7 );
- assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));
+ assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));
check_allocator ( d3, alloc2 );
}
int main()
{
-// This test is waiting on the resolution of LWG issue #2235
+// This test is waiting on the resolution of LWG issue #2235
// typedef test_allocator<char> Alloc;
// typedef std::basic_string<char, std::char_traits<char>, Alloc> nstr;
-//
+//
// test ( nstr("fourteen"), Alloc(3), Alloc(4) );
// test ( { nstr("1"), nstr("1"), nstr("2"), nstr("3"), nstr("5"), nstr("8")}, Alloc(6));
}
-#else
-int main() {}
-#endif
+
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
index 738c0c72592e..cd5c56c7ac51 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
@@ -35,7 +35,7 @@ using std::experimental::dynarray;
template <class T>
void testInitList( const std::initializer_list<T> &vals ) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( vals );
assert ( d1.size () == vals.size() );
assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ()));
@@ -45,7 +45,7 @@ void testInitList( const std::initializer_list<T> &vals ) {
template <class T>
void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( 4 );
assert ( d1.size () == 4 );
if (!DefaultValueIsIndeterminate) {
@@ -58,7 +58,7 @@ void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
dynA d3 ( d2 );
assert ( d3.size () == 7 );
- assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));
+ assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));
}
void test_bad_length () {
@@ -76,12 +76,12 @@ int main()
test<double> ( 14.0, true );
test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
test<std::string> ( "fourteen" );
-
+
testInitList( { 1, 1, 2, 3, 5, 8 } );
testInitList( { 1., 1., 2., 3., 5., 8. } );
testInitList( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
std::string("5"), std::string("8")} );
-
+
// Make sure we don't pick up the Allocator version here
dynarray<long> d1 ( 20, 3 );
assert ( d1.size() == 20 );
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
index 1bbd8cde92fe..84c602925cb4 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
@@ -42,7 +42,7 @@ void dyn_test( dynarray<T> &dyn, bool CheckEquals = true) {
}
}
-
+
template <class T>
void test(const T &val, bool DefaultValueIsIndeterminate = false) {
@@ -53,7 +53,7 @@ void test(const T &val, bool DefaultValueIsIndeterminate = false) {
dynA d1(4);
dyn_test(d1, CheckDefaultValues);
dyn_test_const(d1, CheckDefaultValues);
-
+
dynA d2 (7, val);
dyn_test ( d2 );
dyn_test_const ( d2 );
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
index c57887ddaf94..376c94a6bcd8 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
@@ -7,15 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// dynarray.data
// void fill(const T& v);
// const T* data() const noexcept;
-
-#include <__config>
-#if _LIBCPP_STD_VER > 11
+#include <__config>
#include <experimental/dynarray>
#include <cassert>
@@ -29,11 +28,11 @@ using std::experimental::dynarray;
template <class T>
void test ( const T &val ) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( 4 );
d1.fill ( val );
- assert ( std::all_of ( d1.begin (), d1.end (),
- [&val]( const T &item ){ return item == val; } ));
+ assert ( std::all_of ( d1.begin (), d1.end (),
+ [&val]( const T &item ){ return item == val; } ));
}
int main()
@@ -43,6 +42,4 @@ int main()
test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
test<std::string> ( "fourteen" );
}
-#else
-int main() {}
-#endif
+
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
index 8c0d08538716..a6825b68d0f1 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
@@ -7,15 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// dynarray.overview
// const_reference at(size_type n) const;
// reference at(size_type n);
-
-#include <__config>
-#if _LIBCPP_STD_VER > 11
+#include <__config>
#include <experimental/dynarray>
#include <cassert>
@@ -73,7 +72,7 @@ void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
template <class T>
void test ( std::initializer_list<T> vals ) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( vals );
dyn_test ( d1, vals );
dyn_test_const ( d1, vals );
@@ -83,13 +82,11 @@ int main()
{
test ( { 1, 1, 2, 3, 5, 8 } );
test ( { 1., 1., 2., 3., 5., 8. } );
- test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
+ test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
std::string("5"), std::string("8")} );
test<int> ( {} );
test<std::complex<double>> ( {} );
test<std::string> ( {} );
}
-#else
-int main() {}
-#endif
+
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
index 695e1aa9f14a..fe425b7e8c18 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// dynarray.overview
@@ -16,7 +17,7 @@
// iterator end() noexcept;
// const_iterator end() const noexcept;
// const_iterator cend() const noexcept;
-//
+//
// reverse_iterator rbegin() noexcept;
// const_reverse_iterator rbegin() const noexcept;
// const_reverse_iterator crbegin() const noexcept;
@@ -24,10 +25,8 @@
// const_reverse_iterator rend() const noexcept;
// const_reverse_iterator crend() const noexcept;
-
-#include <__config>
-#if _LIBCPP_STD_VER > 11
+#include <__config>
#include <experimental/dynarray>
#include <cassert>
@@ -86,11 +85,11 @@ void dyn_test ( dynarray<T> &dyn ) {
template <class T>
void test ( const T &val ) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( 4 );
dyn_test ( d1 );
dyn_test_const ( d1 );
-
+
dynA d2 ( 7, val );
dyn_test ( d2 );
dyn_test_const ( d2 );
@@ -103,6 +102,4 @@ int main()
test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
test<std::string> ( "fourteen" );
}
-#else
-int main() {}
-#endif
+
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
index 6d28eef1b057..95262aab1bdc 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
@@ -7,16 +7,15 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// dynarray.overview
// size_type size() const noexcept;
// size_type max_size() const noexcept;
-// bool empty() const noexcept;
+// bool empty() const noexcept;
#include <__config>
-#if _LIBCPP_STD_VER > 11
-
#include <experimental/dynarray>
#include <cassert>
@@ -36,7 +35,7 @@ void dyn_test ( const dynarray<T> &dyn, size_t sz ) {
template <class T>
void test ( std::initializer_list<T> vals ) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( vals );
dyn_test ( d1, vals.size ());
}
@@ -45,13 +44,11 @@ int main()
{
test ( { 1, 1, 2, 3, 5, 8 } );
test ( { 1., 1., 2., 3., 5., 8. } );
- test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
+ test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
std::string("5"), std::string("8")} );
test<int> ( {} );
test<std::complex<double>> ( {} );
test<std::string> ( {} );
}
-#else
-int main() {}
-#endif
+
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
index 2af862a5530f..4f1d0978dd11 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
@@ -58,7 +58,7 @@ void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
dynA d1 ( 4 );
dyn_test ( d1, CheckDefaultValues );
dyn_test_const ( d1, CheckDefaultValues );
-
+
dynA d2 ( 7, val );
dyn_test ( d2 );
dyn_test_const ( d2 );
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
index 7317a2023cb1..4bcb229ebce0 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// dynarray.overview
// const_reference at(size_type n) const;
// reference at(size_type n);
-
-#include <__config>
-#if _LIBCPP_STD_VER > 11
+#include <__config>
#include <experimental/dynarray>
#include <cassert>
@@ -49,7 +48,7 @@ void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
template <class T>
void test ( std::initializer_list<T> vals ) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( vals );
dyn_test ( d1, vals );
dyn_test_const ( d1, vals );
@@ -59,13 +58,11 @@ int main()
{
test ( { 1, 1, 2, 3, 5, 8 } );
test ( { 1., 1., 2., 3., 5., 8. } );
- test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
+ test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
std::string("5"), std::string("8")} );
test<int> ( {} );
test<std::complex<double>> ( {} );
test<std::string> ( {} );
}
-#else
-int main() {}
-#endif
+
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp
index 9b8240d4cd82..48da6d885773 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp
@@ -7,15 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// dynarray.data
// template <class Type, class Alloc>
// struct uses_allocator<dynarray<Type>, Alloc> : true_type { };
-
-#include <__config>
-#if _LIBCPP_STD_VER > 11
+#include <__config>
#include <experimental/dynarray>
#include "test_allocator.h"
@@ -26,6 +25,4 @@ int main()
{
static_assert ( std::uses_allocator<dynarray<int>, test_allocator<int>>::value, "" );
}
-#else
-int main() {}
-#endif
+
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp
index 93f3b18f192f..c0e0180930e9 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp
@@ -7,18 +7,17 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// dynarray.zero
// dynarray shall provide support for the special case of construction with a size of zero.
-// In the case that the size is zero, begin() == end() == unique value.
-// The return value of data() is unspecified.
+// In the case that the size is zero, begin() == end() == unique value.
+// The return value of data() is unspecified.
// The effect of calling front() or back() for a zero-sized dynarray is undefined.
-
-#include <__config>
-#if _LIBCPP_STD_VER > 11
+#include <__config>
#include <experimental/dynarray>
#include <cassert>
@@ -32,7 +31,7 @@ using std::experimental::dynarray;
template <class T>
void test ( ) {
typedef dynarray<T> dynA;
-
+
dynA d1 ( 0 );
assert ( d1.size() == 0 );
assert ( d1.begin() == d1.end ());
@@ -45,6 +44,4 @@ int main()
test<std::complex<double>> ();
test<std::string> ();
}
-#else
-int main() {}
-#endif
+
diff --git a/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp b/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp
new file mode 100644
index 000000000000..94de2108f8b5
--- /dev/null
+++ b/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// template <class Tp> struct __is_pathable
+
+// [path.req]
+// In addition to the requirements (5), function template parameters named
+// `Source` shall be one of:
+// * basic_string<_ECharT, _Traits, _Alloc>
+// * InputIterator with a value_type of _ECharT
+// * A character array, which points to a NTCTS after array-to-pointer decay.
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+namespace fs = std::experimental::filesystem;
+
+using fs::__is_pathable;
+
+template <class Tp>
+struct Identity { typedef Tp type; };
+
+template <class Source>
+Identity<Source> CheckSourceType(Source const&);
+
+template <class Tp>
+using GetSourceType = typename decltype(CheckSourceType(std::declval<Tp>()))::type;
+
+template <class Tp, class Exp,
+ class ExpQual = typename std::remove_const<Exp>::type>
+using CheckPass = std::is_same<ExpQual, GetSourceType<Tp>>;
+
+template <class Source>
+using CheckPassSource = std::integral_constant<bool,
+ CheckPass<Source&, Source>::value &&
+ CheckPass<Source const&, Source>::value &&
+ CheckPass<Source&&, Source>::value &&
+ CheckPass<Source const&&, Source>::value
+ >;
+
+template <class CharT>
+struct MakeTestType {
+ using value_type = CharT;
+ using string_type = std::basic_string<CharT>;
+ using string_type2 = std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>>;
+ using cstr_type = CharT* const;
+ using const_cstr_type = const CharT*;
+ using array_type = CharT[25];
+ using const_array_type = const CharT[25];
+ using iter_type = input_iterator<CharT*>;
+ using bad_iter_type = input_iterator<signed char*>;
+
+ template <class TestT>
+ static void AssertPathable() {
+ static_assert(__is_pathable<TestT>::value, "");
+ static_assert(CheckPassSource<TestT>::value, "cannot pass as Source const&");
+ ASSERT_SAME_TYPE(CharT, typename __is_pathable<TestT>::__char_type);
+ }
+
+ template <class TestT>
+ static void AssertNotPathable() {
+ static_assert(!__is_pathable<TestT>::value, "");
+ }
+
+ static void Test() {
+ AssertPathable<string_type>();
+ AssertPathable<string_type2>();
+ AssertPathable<cstr_type>();
+ AssertPathable<const_cstr_type>();
+ AssertPathable<array_type>();
+ AssertPathable<const_array_type>();
+ AssertPathable<iter_type>();
+
+ AssertNotPathable<CharT>();
+ AssertNotPathable<bad_iter_type>();
+ AssertNotPathable<signed char*>();
+ }
+};
+
+int main() {
+ MakeTestType<char>::Test();
+ MakeTestType<wchar_t>::Test();
+ MakeTestType<char16_t>::Test();
+ MakeTestType<char32_t>::Test();
+}
diff --git a/test/libcxx/experimental/filesystem/lit.local.cfg b/test/libcxx/experimental/filesystem/lit.local.cfg
new file mode 100644
index 000000000000..3d9360431f48
--- /dev/null
+++ b/test/libcxx/experimental/filesystem/lit.local.cfg
@@ -0,0 +1,3 @@
+# Disable all of the filesystem tests if the correct feature is not available.
+if 'c++filesystem' not in config.available_features:
+ config.unsupported = True
diff --git a/test/libcxx/experimental/filesystem/version.pass.cpp b/test/libcxx/experimental/filesystem/version.pass.cpp
new file mode 100644
index 000000000000..723380a26fba
--- /dev/null
+++ b/test/libcxx/experimental/filesystem/version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+#include <experimental/filesystem>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
new file mode 100644
index 000000000000..83b304196371
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
@@ -0,0 +1,178 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// template <class U1, class U2, class ...Args1, class ...Args2>
+// void polymorphic_allocator<T>::construct(pair<T1, T2>*, piecewise_construct_t
+// tuple<Args1...> x, tuple<Args2...>)
+
+// The stardard specifiers a tranformation to uses-allocator construction as
+// follows:
+// - If uses_allocator_v<T1,memory_resource*> is false and
+// is_constructible_v<T,Args1...> is true, then xprime is x.
+// - Otherwise, if uses_allocator_v<T1,memory_resource*> is true and
+// is_constructible_v<T1,allocator_arg_t,memory_resource*,Args1...> is true,
+// then xprime is
+// tuple_cat(make_tuple(allocator_arg, this->resource()), std::move(x)).
+// - Otherwise, if uses_allocator_v<T1,memory_resource*> is true and
+// is_constructible_v<T1,Args1...,memory_resource*> is true, then xprime is
+// tuple_cat(std::move(x), make_tuple(this->resource())).
+// - Otherwise the program is ill formed.
+//
+// The use of "xprime = tuple_cat(..., std::move(x), ...)" causes all of the
+// objects in 'x' to be copied into 'xprime'. If 'x' contains any types which
+// are stored by value this causes an unessary copy to occur. To prevent this
+// libc++ changes this call into
+// "xprime = forward_as_tuple(..., std::get<Idx>(std::move(x))..., ...)".
+// 'xprime' contains references to the values in 'x' instead of copying them.
+
+// This test checks the number of copies incurred to the elements in
+// 'tuple<Args1...>' and 'tuple<Args2...>'.
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+template <class T>
+struct TestHarness {
+ TestResource R;
+ ex::memory_resource * M = &R;
+ ex::polymorphic_allocator<T> A = M;
+ bool constructed = false;
+ T * ptr;
+
+ TestHarness() : ptr(A.allocate(1)) {}
+
+ template <class ...Args>
+ void construct(Args&&... args) {
+ A.construct(ptr, std::forward<Args>(args)...);
+ constructed = true;
+ }
+
+ ~TestHarness() {
+ if (constructed) A.destroy(ptr);
+ A.deallocate(ptr, 1);
+ }
+};
+
+struct CountCopies {
+ int count;
+ CountCopies() : count(0) {}
+ CountCopies(CountCopies const& o) : count(o.count + 1) {}
+};
+
+struct CountCopiesAllocV1 {
+ typedef ex::memory_resource* allocator_type;
+ allocator_type alloc;
+ int count;
+ CountCopiesAllocV1() : alloc(nullptr), count(0) {}
+ CountCopiesAllocV1(std::allocator_arg_t, allocator_type const& a,
+ CountCopiesAllocV1 const& o) : alloc(a), count(o.count + 1)
+ {}
+
+ CountCopiesAllocV1(CountCopiesAllocV1 const& o) : count(o.count + 1) {}
+};
+
+
+struct CountCopiesAllocV2 {
+ typedef ex::memory_resource* allocator_type;
+ allocator_type alloc;
+ int count;
+ CountCopiesAllocV2() : alloc(nullptr), count(0) {}
+ CountCopiesAllocV2(CountCopiesAllocV2 const& o, allocator_type const& a)
+ : alloc(a), count(o.count + 1)
+ { }
+
+ CountCopiesAllocV2(CountCopiesAllocV2 const& o) : count(o.count + 1) {}
+};
+
+
+int main()
+{
+ using PMR = ex::memory_resource*;
+ using PMA = ex::polymorphic_allocator<char>;
+
+ {
+ using T = CountCopies;
+ using U = CountCopiesAllocV1;
+ using P = std::pair<T, U>;
+ using TH = TestHarness<P>;
+
+ std::tuple<T> t1;
+ std::tuple<U> t2;
+
+ TestHarness<P> h;
+ h.construct(std::piecewise_construct, t1, t2);
+ P const& p = *h.ptr;
+ assert(p.first.count == 2);
+ assert(p.second.count == 2);
+ assert(p.second.alloc == h.M);
+ }
+ {
+ using T = CountCopiesAllocV1;
+ using U = CountCopiesAllocV2;
+ using P = std::pair<T, U>;
+ using TH = TestHarness<P>;
+
+ std::tuple<T> t1;
+ std::tuple<U> t2;
+
+ TestHarness<P> h;
+ h.construct(std::piecewise_construct, std::move(t1), std::move(t2));
+ P const& p = *h.ptr;
+ assert(p.first.count == 2);
+ assert(p.first.alloc == h.M);
+ assert(p.second.count == 2);
+ assert(p.second.alloc == h.M);
+ }
+ {
+ using T = CountCopiesAllocV2;
+ using U = CountCopiesAllocV1;
+ using P = std::pair<T, U>;
+ using TH = TestHarness<P>;
+
+ std::tuple<T> t1;
+ std::tuple<U> t2;
+
+ TestHarness<P> h;
+ h.construct(std::piecewise_construct, std::move(t1), std::move(t2));
+ P const& p = *h.ptr;
+ assert(p.first.count == 2);
+ assert(p.first.alloc == h.M);
+ assert(p.second.count == 2);
+ assert(p.second.alloc == h.M);
+ }
+ {
+ using T = CountCopiesAllocV2;
+ using U = CountCopies;
+ using P = std::pair<T, U>;
+ using TH = TestHarness<P>;
+
+ std::tuple<T> t1;
+ std::tuple<U> t2;
+
+ TestHarness<P> h;
+ h.construct(std::piecewise_construct, t1, t2);
+ P const& p = *h.ptr;
+ assert(p.first.count == 2);
+ assert(p.first.alloc == h.M);
+ assert(p.second.count == 2);
+ }
+}
diff --git a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp
new file mode 100644
index 000000000000..020133fc4048
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// T* polymorphic_allocator<T>::deallocate(T*, size_t size)
+
+int AssertCount = 0;
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++)
+#define _LIBCPP_DEBUG 0
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ using Alloc = ex::polymorphic_allocator<int>;
+ using Traits = std::allocator_traits<Alloc>;
+ NullResource R;
+ Alloc a(&R);
+ const std::size_t maxSize = Traits::max_size(a);
+
+ a.deallocate(nullptr, maxSize);
+ assert(AssertCount == 0);
+ a.deallocate(nullptr, maxSize + 1);
+ assert(AssertCount == 1);
+}
diff --git a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp
new file mode 100644
index 000000000000..ac685a99be49
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// EXTENSION
+// std::size_t polymorphic_allocator<T>::max_size() const noexcept
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+template <std::size_t S>
+std::size_t getMaxSize() {
+ using T = typename std::aligned_storage<S>::type;
+ static_assert(sizeof(T) == S, "Required for test");
+ return ex::polymorphic_allocator<T>{}.max_size();
+}
+
+template <std::size_t S, std::size_t A>
+std::size_t getMaxSize() {
+ using T = typename std::aligned_storage<S, A>::type;
+ static_assert(sizeof(T) == S, "Required for test");
+ return ex::polymorphic_allocator<T>{}.max_size();
+}
+
+int main()
+{
+ {
+ using Alloc = ex::polymorphic_allocator<int>;
+ using Traits = std::allocator_traits<Alloc>;
+ const Alloc a;
+ static_assert(std::is_same<decltype(a.max_size()), Traits::size_type>::value, "");
+ static_assert(noexcept(a.max_size()), "");
+ }
+ {
+ constexpr std::size_t Max = std::numeric_limits<std::size_t>::max();
+ assert(getMaxSize<1>() == Max);
+ assert(getMaxSize<2>() == Max / 2);
+ assert(getMaxSize<4>() == Max / 4);
+ assert(getMaxSize<8>() == Max / 8);
+ assert(getMaxSize<16>() == Max / 16);
+ assert(getMaxSize<32>() == Max / 32);
+ assert(getMaxSize<64>() == Max / 64);
+ assert(getMaxSize<1024>() == Max / 1024);
+
+ assert((getMaxSize<6, 2>() == Max / 6));
+ assert((getMaxSize<12, 4>() == Max / 12));
+ }
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp b/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
new file mode 100644
index 000000000000..ccb9b710e5dc
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// T* polymorphic_allocator<T>::deallocate(T*, size_t size)
+
+int AssertCount = 0;
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++)
+#define _LIBCPP_DEBUG 0
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ using Alloc = NullAllocator<char>;
+ using R = ex::resource_adaptor<Alloc>;
+ AllocController P;
+ ex::resource_adaptor<Alloc> r(Alloc{P});
+ ex::memory_resource & m1 = r;
+
+ std::size_t maxSize = std::numeric_limits<std::size_t>::max()
+ - alignof(std::max_align_t);
+
+ m1.deallocate(nullptr, maxSize);
+ assert(AssertCount == 0);
+ m1.deallocate(nullptr, maxSize + 1);
+ assert(AssertCount >= 1);
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..04b361dfe5a4
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/deque>
+
+#include <experimental/deque>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..11fc21b3b03c
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/forward_list>
+
+#include <experimental/forward_list>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..9a72979e0af0
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/list>
+
+#include <experimental/list>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..24a1bf3042c1
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/map>
+
+#include <experimental/map>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..ff81bc09b850
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/regex>
+
+#include <experimental/regex>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..6b02f46b4f73
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/set>
+
+#include <experimental/set>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..b4b7fdf10f59
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/string>
+
+#include <experimental/string>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..ab9cc189b73d
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/unordered_map>
+
+#include <experimental/unordered_map>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..37533c7fd87c
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/unordered_set>
+
+#include <experimental/unordered_set>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp
new file mode 100644
index 000000000000..103d32becf9c
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/vector>
+
+#include <experimental/vector>
+
+#ifndef _LIBCPP_VERSION
+#error header must provide _LIBCPP_VERSION
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp b/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp
new file mode 100644
index 000000000000..341a88c0bab1
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// memory_resource * new_delete_resource()
+
+// The lifetime of the value returned by 'new_delete_resource()' should
+// never end, even very late into program termination. This test constructs
+// attempts to use 'new_delete_resource()' very late in program termination
+// to detect lifetime issues.
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace ex = std::experimental::pmr;
+
+struct POSType {
+ ex::memory_resource* res = nullptr;
+ void* ptr = nullptr;
+ int n = 0;
+ POSType() {}
+ POSType(ex::memory_resource* r, void* p, int s) : res(r), ptr(p), n(s) {}
+ ~POSType() {
+ if (ptr) {
+ if (!res) res = ex::get_default_resource();
+ res->deallocate(ptr, n);
+ }
+ }
+};
+
+void swap(POSType & L, POSType & R) {
+ std::swap(L.res, R.res);
+ std::swap(L.ptr, R.ptr);
+ std::swap(L.n, R.n);
+}
+
+POSType constructed_before_resources;
+POSType constructed_before_resources2;
+
+// Constructs resources
+ex::memory_resource* resource = ex::get_default_resource();
+
+POSType constructed_after_resources(resource, resource->allocate(1024), 1024);
+POSType constructed_after_resources2(nullptr, resource->allocate(1024), 1024);
+
+int main()
+{
+ swap(constructed_after_resources, constructed_before_resources);
+ swap(constructed_before_resources2, constructed_after_resources2);
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp b/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp
new file mode 100644
index 000000000000..9b92d02bc437
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// memory_resource * new_delete_resource()
+
+// The lifetime of the value returned by 'new_delete_resource()' should
+// never end, even very late into program termination. This test constructs
+// attempts to use 'new_delete_resource()' very late in program termination
+// to detect lifetime issues.
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace ex = std::experimental::pmr;
+
+struct POSType {
+ ex::memory_resource* res = nullptr;
+ void* ptr = nullptr;
+ int n = 0;
+ POSType() {res = ex::new_delete_resource(); ptr = res->allocate(42); n = 42; }
+ POSType(ex::memory_resource* r, void* p, int s) : res(r), ptr(p), n(s) {}
+ ~POSType() { if (ptr) res->deallocate(ptr, n); }
+};
+
+void swap(POSType & L, POSType & R) {
+ std::swap(L.res, R.res);
+ std::swap(L.ptr, R.ptr);
+ std::swap(L.n, R.n);
+}
+
+POSType constructed_before_resources;
+
+// Constructs resources
+ex::memory_resource* resource = ex::new_delete_resource();
+
+POSType constructed_after_resources(resource, resource->allocate(1024), 1024);
+
+int main()
+{
+ swap(constructed_after_resources, constructed_before_resources);
+}
diff --git a/test/libcxx/experimental/memory/memory.resource.synop/version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.synop/version.pass.cpp
new file mode 100644
index 000000000000..d05575e8849e
--- /dev/null
+++ b/test/libcxx/experimental/memory/memory.resource.synop/version.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+#include <experimental/memory_resource>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/experimental/optional/version.pass.cpp b/test/libcxx/experimental/optional/version.pass.cpp
index 585b7a24eea5..585b7a24eea5 100644
--- a/test/std/experimental/optional/version.pass.cpp
+++ b/test/libcxx/experimental/optional/version.pass.cpp
diff --git a/test/std/experimental/utilities/meta/version.pass.cpp b/test/libcxx/experimental/utilities/meta/version.pass.cpp
index 593fb52a4c3b..593fb52a4c3b 100644
--- a/test/std/experimental/utilities/meta/version.pass.cpp
+++ b/test/libcxx/experimental/utilities/meta/version.pass.cpp
diff --git a/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp
index db9026aebd84..ea7ef6cbc108 100644
--- a/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp
+++ b/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp
@@ -7,16 +7,15 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/ratio>
// Test that <ratio> is included.
#include <experimental/ratio>
-#if _LIBCPP_STD_VER > 11
-# ifndef _LIBCPP_RATIO
-# error " <experimental/ratio> must include <ratio>"
-# endif
+#ifndef _LIBCPP_RATIO
+# error " <experimental/ratio> must include <ratio>"
#endif
int main()
diff --git a/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp
index 88c7458395d4..be3aacdc362c 100644
--- a/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp
+++ b/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/system_error>
#include <experimental/system_error>
-#if _LIBCPP_STD_VER > 11
-# ifndef _LIBCPP_SYSTEM_ERROR
-# error "<experimental/system_error> must include <system_error>"
-# endif
+#ifndef _LIBCPP_SYSTEM_ERROR
+# error "<experimental/system_error> must include <system_error>"
#endif
int main()
diff --git a/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp
index ad4a79105b0b..e91068c742e1 100644
--- a/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp
+++ b/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/chrono>
#include <experimental/chrono>
-#if _LIBCPP_STD_VER > 11
-# ifndef _LIBCPP_CHRONO
-# error "<experimental/chrono> must include <chrono>"
-# endif
+#ifndef _LIBCPP_CHRONO
+# error "<experimental/chrono> must include <chrono>"
#endif
int main()
diff --git a/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp
index 544ddfb269f2..defa454d68f7 100644
--- a/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp
+++ b/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp
@@ -7,15 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/tuple>
#include <experimental/tuple>
int main()
{
-#if _LIBCPP_STD_VER > 11
-# ifndef _LIBCPP_TUPLE
-# error "<experimental/tuple> must include <tuple>"
-# endif
-#endif /* _LIBCPP_STD_VER > 11 */
+#ifndef _LIBCPP_TUPLE
+# error "<experimental/tuple> must include <tuple>"
+#endif
}
diff --git a/test/std/experimental/utilities/utility/version.pass.cpp b/test/libcxx/experimental/utilities/utility/version.pass.cpp
index 437712454ae5..437712454ae5 100644
--- a/test/std/experimental/utilities/utility/version.pass.cpp
+++ b/test/libcxx/experimental/utilities/utility/version.pass.cpp
diff --git a/test/std/extensions/hash/specializations.fail.cpp b/test/libcxx/extensions/hash/specializations.fail.cpp
index 8eeffb5802e7..8eeffb5802e7 100644
--- a/test/std/extensions/hash/specializations.fail.cpp
+++ b/test/libcxx/extensions/hash/specializations.fail.cpp
diff --git a/test/std/extensions/hash/specializations.pass.cpp b/test/libcxx/extensions/hash/specializations.pass.cpp
index a222b1eb5c6d..a222b1eb5c6d 100644
--- a/test/std/extensions/hash/specializations.pass.cpp
+++ b/test/libcxx/extensions/hash/specializations.pass.cpp
diff --git a/test/std/extensions/hash_map/const_iterator.fail.cpp b/test/libcxx/extensions/hash_map/const_iterator.fail.cpp
index e4c536e8f33a..e4c536e8f33a 100644
--- a/test/std/extensions/hash_map/const_iterator.fail.cpp
+++ b/test/libcxx/extensions/hash_map/const_iterator.fail.cpp
diff --git a/test/std/extensions/nothing_to_do.pass.cpp b/test/libcxx/extensions/nothing_to_do.pass.cpp
index b58f5c55b643..b58f5c55b643 100644
--- a/test/std/extensions/nothing_to_do.pass.cpp
+++ b/test/libcxx/extensions/nothing_to_do.pass.cpp
diff --git a/test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp b/test/libcxx/input.output/file.streams/c.files/version_ccstdio.pass.cpp
index 0d7fc5605324..0d7fc5605324 100644
--- a/test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp
+++ b/test/libcxx/input.output/file.streams/c.files/version_ccstdio.pass.cpp
diff --git a/test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp b/test/libcxx/input.output/file.streams/c.files/version_cinttypes.pass.cpp
index bfd379e43493..bfd379e43493 100644
--- a/test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp
+++ b/test/libcxx/input.output/file.streams/c.files/version_cinttypes.pass.cpp
diff --git a/test/std/input.output/file.streams/fstreams/version.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/version.pass.cpp
index 44b851416808..44b851416808 100644
--- a/test/std/input.output/file.streams/fstreams/version.pass.cpp
+++ b/test/libcxx/input.output/file.streams/fstreams/version.pass.cpp
diff --git a/test/std/input.output/iostream.format/input.streams/version.pass.cpp b/test/libcxx/input.output/iostream.format/input.streams/version.pass.cpp
index b03ef2aaa04e..b03ef2aaa04e 100644
--- a/test/std/input.output/iostream.format/input.streams/version.pass.cpp
+++ b/test/libcxx/input.output/iostream.format/input.streams/version.pass.cpp
diff --git a/test/std/input.output/iostream.format/output.streams/version.pass.cpp b/test/libcxx/input.output/iostream.format/output.streams/version.pass.cpp
index 662b6987b3c8..662b6987b3c8 100644
--- a/test/std/input.output/iostream.format/output.streams/version.pass.cpp
+++ b/test/libcxx/input.output/iostream.format/output.streams/version.pass.cpp
diff --git a/test/std/input.output/iostream.format/std.manip/version.pass.cpp b/test/libcxx/input.output/iostream.format/std.manip/version.pass.cpp
index ca4fd3d463ee..ca4fd3d463ee 100644
--- a/test/std/input.output/iostream.format/std.manip/version.pass.cpp
+++ b/test/libcxx/input.output/iostream.format/std.manip/version.pass.cpp
diff --git a/test/std/input.output/iostream.forward/version.pass.cpp b/test/libcxx/input.output/iostream.forward/version.pass.cpp
index cf91332d5597..cf91332d5597 100644
--- a/test/std/input.output/iostream.forward/version.pass.cpp
+++ b/test/libcxx/input.output/iostream.forward/version.pass.cpp
diff --git a/test/std/input.output/iostream.objects/version.pass.cpp b/test/libcxx/input.output/iostream.objects/version.pass.cpp
index 09b3611f6df9..09b3611f6df9 100644
--- a/test/std/input.output/iostream.objects/version.pass.cpp
+++ b/test/libcxx/input.output/iostream.objects/version.pass.cpp
diff --git a/test/std/input.output/iostreams.base/version.pass.cpp b/test/libcxx/input.output/iostreams.base/version.pass.cpp
index f56846d38b8d..f56846d38b8d 100644
--- a/test/std/input.output/iostreams.base/version.pass.cpp
+++ b/test/libcxx/input.output/iostreams.base/version.pass.cpp
diff --git a/test/std/input.output/stream.buffers/version.pass.cpp b/test/libcxx/input.output/stream.buffers/version.pass.cpp
index c4b06be60187..c4b06be60187 100644
--- a/test/std/input.output/stream.buffers/version.pass.cpp
+++ b/test/libcxx/input.output/stream.buffers/version.pass.cpp
diff --git a/test/std/input.output/string.streams/version.pass.cpp b/test/libcxx/input.output/string.streams/version.pass.cpp
index 103897106d37..103897106d37 100644
--- a/test/std/input.output/string.streams/version.pass.cpp
+++ b/test/libcxx/input.output/string.streams/version.pass.cpp
diff --git a/test/libcxx/iterators/trivial_iterators.pass.cpp b/test/libcxx/iterators/trivial_iterators.pass.cpp
index 0b7a47316d65..33c830251769 100644
--- a/test/libcxx/iterators/trivial_iterators.pass.cpp
+++ b/test/libcxx/iterators/trivial_iterators.pass.cpp
@@ -13,7 +13,7 @@
// __libcpp_is_trivial_iterator<Tp>
// __libcpp_is_trivial_iterator determines if an iterator is a "trivial" one,
-// that can be used w/o worrying about its operations throwing exceptions.
+// that can be used w/o worrying about its operations throwing exceptions.
// Pointers are trivial iterators. Libc++ has three "iterator wrappers":
// reverse_iterator, move_iterator, and __wrap_iter. If the underlying iterator
// is trivial, then those are as well.
@@ -113,16 +113,16 @@ int main()
static_assert(( std::__libcpp_is_trivial_iterator<std::__wrap_iter<int *> > ::value), "");
static_assert(( std::__libcpp_is_trivial_iterator<std::__wrap_iter<T *> > ::value), "");
- static_assert(( std::__libcpp_is_trivial_iterator<std::reverse_iterator<std::__wrap_iter<char *> > > ::value), "");
-
+ static_assert(( std::__libcpp_is_trivial_iterator<std::reverse_iterator<std::__wrap_iter<char *> > > ::value), "");
+
// iterators in the libc++ test suite
- static_assert((!std::__libcpp_is_trivial_iterator<output_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_is_trivial_iterator<input_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_is_trivial_iterator<forward_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_is_trivial_iterator<bidirectional_iterator<char *> >::value), "");
- static_assert((!std::__libcpp_is_trivial_iterator<random_access_iterator<char *> >::value), "");
- static_assert((!std::__libcpp_is_trivial_iterator<ThrowingIterator <char *> >::value), "");
- static_assert((!std::__libcpp_is_trivial_iterator<NonThrowingIterator <char *> >::value), "");
+ static_assert((!std::__libcpp_is_trivial_iterator<output_iterator <char *> >::value), "");
+ static_assert((!std::__libcpp_is_trivial_iterator<input_iterator <char *> >::value), "");
+ static_assert((!std::__libcpp_is_trivial_iterator<forward_iterator <char *> >::value), "");
+ static_assert((!std::__libcpp_is_trivial_iterator<bidirectional_iterator<char *> >::value), "");
+ static_assert((!std::__libcpp_is_trivial_iterator<random_access_iterator<char *> >::value), "");
+ static_assert((!std::__libcpp_is_trivial_iterator<ThrowingIterator <char *> >::value), "");
+ static_assert((!std::__libcpp_is_trivial_iterator<NonThrowingIterator <char *> >::value), "");
// Iterator classification
@@ -137,7 +137,7 @@ int main()
static_assert((!std::__is_bidirectional_iterator<input_iterator<char *> >::value), "" );
static_assert((!std::__is_random_access_iterator<input_iterator<char *> >::value), "" );
static_assert(( std::__is_exactly_input_iterator<input_iterator<char *> >::value), "" );
-
+
static_assert(( std::__is_input_iterator <forward_iterator<char *> >::value), "" );
static_assert(( std::__is_forward_iterator <forward_iterator<char *> >::value), "" );
static_assert((!std::__is_bidirectional_iterator<forward_iterator<char *> >::value), "" );
@@ -171,7 +171,7 @@ int main()
static_assert(( std::__libcpp_is_trivial_iterator<std::vector<char>::const_iterator> ::value), "");
static_assert(( std::__libcpp_is_trivial_iterator<std::vector<char>::reverse_iterator> ::value), "");
static_assert(( std::__libcpp_is_trivial_iterator<std::vector<char>::const_reverse_iterator>::value), "");
-
+
// vector
static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::iterator> ::value), "");
static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::const_iterator> ::value), "");
diff --git a/test/std/iterators/version.pass.cpp b/test/libcxx/iterators/version.pass.cpp
index dd097850388e..dd097850388e 100644
--- a/test/std/iterators/version.pass.cpp
+++ b/test/libcxx/iterators/version.pass.cpp
diff --git a/test/std/language.support/cstdint/version.pass.cpp b/test/libcxx/language.support/cstdint/version.pass.cpp
index 4c9a43a62abc..4c9a43a62abc 100644
--- a/test/std/language.support/cstdint/version.pass.cpp
+++ b/test/libcxx/language.support/cstdint/version.pass.cpp
diff --git a/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp b/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
index 7de503304556..cc99b83aca4e 100644
--- a/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
+++ b/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// test bad_array_length
#include <new>
@@ -15,7 +16,6 @@
int main()
{
-#if __LIBCPP_STD_VER > 11
static_assert((std::is_base_of<std::bad_alloc, std::bad_array_length>::value),
"std::is_base_of<std::bad_alloc, std::bad_array_length>::value");
static_assert(std::is_polymorphic<std::bad_array_length>::value,
@@ -25,5 +25,4 @@ int main()
b2 = b;
const char* w = b2.what();
assert(w);
-#endif
}
diff --git a/test/std/language.support/support.dynamic/version.pass.cpp b/test/libcxx/language.support/support.dynamic/version.pass.cpp
index ba1ff518e51f..ba1ff518e51f 100644
--- a/test/std/language.support/support.dynamic/version.pass.cpp
+++ b/test/libcxx/language.support/support.dynamic/version.pass.cpp
diff --git a/test/std/language.support/support.exception/version.pass.cpp b/test/libcxx/language.support/support.exception/version.pass.cpp
index acdedbb31fe3..acdedbb31fe3 100644
--- a/test/std/language.support/support.exception/version.pass.cpp
+++ b/test/libcxx/language.support/support.exception/version.pass.cpp
diff --git a/test/std/language.support/support.initlist/version.pass.cpp b/test/libcxx/language.support/support.initlist/version.pass.cpp
index f3f08cd1f864..f3f08cd1f864 100644
--- a/test/std/language.support/support.initlist/version.pass.cpp
+++ b/test/libcxx/language.support/support.initlist/version.pass.cpp
diff --git a/test/std/language.support/support.limits/c.limits/version_cfloat.pass.cpp b/test/libcxx/language.support/support.limits/c.limits/version_cfloat.pass.cpp
index 19b463199cd6..19b463199cd6 100644
--- a/test/std/language.support/support.limits/c.limits/version_cfloat.pass.cpp
+++ b/test/libcxx/language.support/support.limits/c.limits/version_cfloat.pass.cpp
diff --git a/test/std/language.support/support.limits/c.limits/version_climits.pass.cpp b/test/libcxx/language.support/support.limits/c.limits/version_climits.pass.cpp
index 3fe07a5174b3..3fe07a5174b3 100644
--- a/test/std/language.support/support.limits/c.limits/version_climits.pass.cpp
+++ b/test/libcxx/language.support/support.limits/c.limits/version_climits.pass.cpp
diff --git a/test/std/language.support/support.limits/limits/version.pass.cpp b/test/libcxx/language.support/support.limits/limits/version.pass.cpp
index 0cb3f6f52a4e..0cb3f6f52a4e 100644
--- a/test/std/language.support/support.limits/limits/version.pass.cpp
+++ b/test/libcxx/language.support/support.limits/limits/version.pass.cpp
diff --git a/test/std/language.support/support.rtti/version.pass.cpp b/test/libcxx/language.support/support.rtti/version.pass.cpp
index 0a9ece34f97e..0a9ece34f97e 100644
--- a/test/std/language.support/support.rtti/version.pass.cpp
+++ b/test/libcxx/language.support/support.rtti/version.pass.cpp
diff --git a/test/std/language.support/support.runtime/version_csetjmp.pass.cpp b/test/libcxx/language.support/support.runtime/version_csetjmp.pass.cpp
index 7e37716d0145..7e37716d0145 100644
--- a/test/std/language.support/support.runtime/version_csetjmp.pass.cpp
+++ b/test/libcxx/language.support/support.runtime/version_csetjmp.pass.cpp
diff --git a/test/std/language.support/support.runtime/version_csignal.pass.cpp b/test/libcxx/language.support/support.runtime/version_csignal.pass.cpp
index be1045f1eb3b..be1045f1eb3b 100644
--- a/test/std/language.support/support.runtime/version_csignal.pass.cpp
+++ b/test/libcxx/language.support/support.runtime/version_csignal.pass.cpp
diff --git a/test/std/language.support/support.runtime/version_cstdarg.pass.cpp b/test/libcxx/language.support/support.runtime/version_cstdarg.pass.cpp
index f3ca9389b15d..f3ca9389b15d 100644
--- a/test/std/language.support/support.runtime/version_cstdarg.pass.cpp
+++ b/test/libcxx/language.support/support.runtime/version_cstdarg.pass.cpp
diff --git a/test/std/language.support/support.runtime/version_cstdbool.pass.cpp b/test/libcxx/language.support/support.runtime/version_cstdbool.pass.cpp
index 0415227e58ea..0415227e58ea 100644
--- a/test/std/language.support/support.runtime/version_cstdbool.pass.cpp
+++ b/test/libcxx/language.support/support.runtime/version_cstdbool.pass.cpp
diff --git a/test/std/language.support/support.runtime/version_cstdlib.pass.cpp b/test/libcxx/language.support/support.runtime/version_cstdlib.pass.cpp
index db419524f578..db419524f578 100644
--- a/test/std/language.support/support.runtime/version_cstdlib.pass.cpp
+++ b/test/libcxx/language.support/support.runtime/version_cstdlib.pass.cpp
diff --git a/test/std/language.support/support.runtime/version_ctime.pass.cpp b/test/libcxx/language.support/support.runtime/version_ctime.pass.cpp
index ce0bf2cf1853..ce0bf2cf1853 100644
--- a/test/std/language.support/support.runtime/version_ctime.pass.cpp
+++ b/test/libcxx/language.support/support.runtime/version_ctime.pass.cpp
diff --git a/test/std/language.support/support.types/version.pass.cpp b/test/libcxx/language.support/support.types/version.pass.cpp
index 2ab7c188de1d..2ab7c188de1d 100644
--- a/test/std/language.support/support.types/version.pass.cpp
+++ b/test/libcxx/language.support/support.types/version.pass.cpp
diff --git a/test/std/localization/c.locales/version.pass.cpp b/test/libcxx/localization/c.locales/version.pass.cpp
index 0fce59e2b0b8..0fce59e2b0b8 100644
--- a/test/std/localization/c.locales/version.pass.cpp
+++ b/test/libcxx/localization/c.locales/version.pass.cpp
diff --git a/test/std/localization/locale.categories/__scan_keyword.pass.cpp b/test/libcxx/localization/locale.categories/__scan_keyword.pass.cpp
index b33aab9a730a..b33aab9a730a 100644
--- a/test/std/localization/locale.categories/__scan_keyword.pass.cpp
+++ b/test/libcxx/localization/locale.categories/__scan_keyword.pass.cpp
diff --git a/test/std/localization/locale.stdcvt/version.pass.cpp b/test/libcxx/localization/locale.stdcvt/version.pass.cpp
index 3885380854cc..3885380854cc 100644
--- a/test/std/localization/locale.stdcvt/version.pass.cpp
+++ b/test/libcxx/localization/locale.stdcvt/version.pass.cpp
diff --git a/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
new file mode 100644
index 000000000000..75e2aeb064eb
--- /dev/null
+++ b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// wstring_convert(wstring_convert&& other); // EXTENSION
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+ typedef std::codecvt_utf8<wchar_t> Codecvt;
+ typedef std::wstring_convert<Codecvt> Myconv;
+ // create a converter and perform some conversions to generate some
+ // interesting state.
+ Myconv myconv;
+ myconv.from_bytes("\xF1\x80\x80\x83");
+ const int old_converted = myconv.converted();
+ assert(myconv.converted() == 4);
+ // move construct a new converter and make sure the state is the same.
+ Myconv myconv2(std::move(myconv));
+ assert(myconv2.converted() == 4);
+}
diff --git a/test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp b/test/libcxx/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
index 4a7f77ad5d9a..4a7f77ad5d9a 100644
--- a/test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
+++ b/test/libcxx/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
diff --git a/test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp b/test/libcxx/localization/locales/locale/locale.types/locale.id/id.pass.cpp
index 3233624d87b4..3233624d87b4 100644
--- a/test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp
+++ b/test/libcxx/localization/locales/locale/locale.types/locale.id/id.pass.cpp
diff --git a/test/std/localization/version.pass.cpp b/test/libcxx/localization/version.pass.cpp
index a64534c9f58b..a64534c9f58b 100644
--- a/test/std/localization/version.pass.cpp
+++ b/test/libcxx/localization/version.pass.cpp
diff --git a/test/std/numerics/cfenv/version.pass.cpp b/test/libcxx/numerics/cfenv/version.pass.cpp
index 727d5bdf3994..727d5bdf3994 100644
--- a/test/std/numerics/cfenv/version.pass.cpp
+++ b/test/libcxx/numerics/cfenv/version.pass.cpp
diff --git a/test/std/numerics/complex.number/version.pass.cpp b/test/libcxx/numerics/complex.number/version.pass.cpp
index 316cfec739a9..316cfec739a9 100644
--- a/test/std/numerics/complex.number/version.pass.cpp
+++ b/test/libcxx/numerics/complex.number/version.pass.cpp
diff --git a/test/std/numerics/numarray/version.pass.cpp b/test/libcxx/numerics/numarray/version.pass.cpp
index 85457d4329ec..85457d4329ec 100644
--- a/test/std/numerics/numarray/version.pass.cpp
+++ b/test/libcxx/numerics/numarray/version.pass.cpp
diff --git a/test/std/numerics/numeric.ops/version.pass.cpp b/test/libcxx/numerics/numeric.ops/version.pass.cpp
index fb6e0a1063ce..fb6e0a1063ce 100644
--- a/test/std/numerics/numeric.ops/version.pass.cpp
+++ b/test/libcxx/numerics/numeric.ops/version.pass.cpp
diff --git a/test/std/numerics/rand/rand.synopsis/version.pass.cpp b/test/libcxx/numerics/rand/rand.synopsis/version.pass.cpp
index eae6c493e919..eae6c493e919 100644
--- a/test/std/numerics/rand/rand.synopsis/version.pass.cpp
+++ b/test/libcxx/numerics/rand/rand.synopsis/version.pass.cpp
diff --git a/test/libcxx/selftest/test_macros.pass.cpp b/test/libcxx/selftest/test_macros.pass.cpp
index 2c8ed4f454a7..69e75b788711 100644
--- a/test/libcxx/selftest/test_macros.pass.cpp
+++ b/test/libcxx/selftest/test_macros.pass.cpp
@@ -8,51 +8,59 @@
//===----------------------------------------------------------------------===//
//
// Test the "test_macros.h" header.
+#include <__config>
#include "test_macros.h"
#ifndef TEST_STD_VER
#error TEST_STD_VER must be defined
#endif
-#ifndef TEST_DECLTYPE
-#error TEST_DECLTYPE must be defined
-#endif
-
#ifndef TEST_NOEXCEPT
#error TEST_NOEXCEPT must be defined
#endif
-#ifndef TEST_STATIC_ASSERT
-#error TEST_STATIC_ASSERT must be defined
+#ifndef LIBCPP_ASSERT
+#error LIBCPP_ASSERT must be defined
#endif
-template <class T, class U>
-struct is_same { enum { value = 0 }; };
-
-template <class T>
-struct is_same<T, T> { enum { value = 1 }; };
-
-int foo() { return 0; }
+#ifndef LIBCPP_STATIC_ASSERT
+#error LIBCPP_STATIC_ASSERT must be defined
+#endif
void test_noexcept() TEST_NOEXCEPT
{
}
-void test_decltype()
+void test_libcxx_macros()
{
- typedef TEST_DECLTYPE(foo()) MyType;
- TEST_STATIC_ASSERT((is_same<MyType, int>::value), "is same");
-}
+// ===== C++14 features =====
+// defined(TEST_HAS_EXTENDED_CONSTEXPR) != defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+#ifdef TEST_HAS_EXTENDED_CONSTEXPR
+# ifdef _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+# error "TEST_EXTENDED_CONSTEXPR mismatch (1)"
+# endif
+#else
+# ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+# error "TEST_EXTENDED_CONSTEXPR mismatch (2)"
+# endif
+#endif
-void test_static_assert()
-{
- TEST_STATIC_ASSERT((is_same<int, int>::value), "is same");
- TEST_STATIC_ASSERT((!is_same<int, long>::value), "not same");
+// defined(TEST_HAS_VARIABLE_TEMPLATES) != defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+#ifdef TEST_HAS_VARIABLE_TEMPLATES
+# ifdef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+# error "TEST_VARIABLE_TEMPLATES mismatch (1)"
+# endif
+#else
+# ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
+# error "TEST_VARIABLE_TEMPLATES mismatch (2)"
+# endif
+#endif
+
+// ===== C++1z features =====
}
int main()
{
test_noexcept();
- test_decltype();
- test_static_assert();
+ test_libcxx_macros();
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
index 6c2929d7f1d3..6c2929d7f1d3 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db1.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
index d20fcd4623b7..d20fcd4623b7 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db2.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
index 5015241ad63e..5015241ad63e 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db1.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
index 6a23bf88ca5c..6a23bf88ca5c 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db2.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db3.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
index a8443818aea5..a8443818aea5 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db3.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db4.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
index 0549e816b44c..0549e816b44c 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db4.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type4.fail.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp
index ffc715fe9a5b..8a6c3f0cf38f 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type4.fail.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp
@@ -7,21 +7,26 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11
+// <string>
-#include <tuple>
-#include <string>
-#include <memory>
+// void pop_back();
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if _LIBCPP_STD_VER > 11
- typedef std::unique_ptr<int> upint;
- std::tuple<upint> t(upint(new int(4)));
- upint p = std::get<upint>(t);
-#else
-#error
+#if _LIBCPP_DEBUG >= 1
+ {
+ std::string s;
+ s.pop_back();
+ assert(false);
+ }
#endif
}
diff --git a/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
new file mode 100644
index 000000000000..fbb26d178997
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// iterator insert(const_iterator p, charT c);
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <string>
+#include <stdexcept>
+#include <cassert>
+
+
+int main()
+{
+#if _LIBCPP_DEBUG >= 1
+ {
+ typedef std::string S;
+ S s;
+ S s2;
+ s.insert(s2.begin(), '1');
+ assert(false);
+ }
+#endif
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type3.fail.cpp b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp
index 0a4550f387dc..7ddd2b00d402 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type3.fail.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp
@@ -7,21 +7,25 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11
+// <string>
-#include <tuple>
-#include <string>
-#include <complex>
+// iterator insert(const_iterator p, size_type n, charT c);
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+#include <string>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
- typedef std::complex<float> cf;
- auto t1 = std::make_tuple<double, int, std::string, cf, int> ( 42, 21, "Hi", { 1,2 } );
- assert ( std::get<int>(t1) == 42 ); // two ints here (one at the end)
-#else
-#error
+#if _LIBCPP_DEBUG >= 1
+ {
+ std::string s;
+ std::string s2;
+ s.insert(s2.begin(), 1, 'a');
+ assert(false);
+ }
#endif
}
diff --git a/test/std/strings/c.strings/version_cctype.pass.cpp b/test/libcxx/strings/c.strings/version_cctype.pass.cpp
index e0919d9d27b0..e0919d9d27b0 100644
--- a/test/std/strings/c.strings/version_cctype.pass.cpp
+++ b/test/libcxx/strings/c.strings/version_cctype.pass.cpp
diff --git a/test/std/strings/c.strings/version_cstring.pass.cpp b/test/libcxx/strings/c.strings/version_cstring.pass.cpp
index 87e705aec4cc..87e705aec4cc 100644
--- a/test/std/strings/c.strings/version_cstring.pass.cpp
+++ b/test/libcxx/strings/c.strings/version_cstring.pass.cpp
diff --git a/test/std/strings/c.strings/version_cuchar.pass.cpp b/test/libcxx/strings/c.strings/version_cuchar.pass.cpp
index dcfdcc37ac7e..dcfdcc37ac7e 100644
--- a/test/std/strings/c.strings/version_cuchar.pass.cpp
+++ b/test/libcxx/strings/c.strings/version_cuchar.pass.cpp
diff --git a/test/std/strings/c.strings/version_cwchar.pass.cpp b/test/libcxx/strings/c.strings/version_cwchar.pass.cpp
index 72e9855c54e5..72e9855c54e5 100644
--- a/test/std/strings/c.strings/version_cwchar.pass.cpp
+++ b/test/libcxx/strings/c.strings/version_cwchar.pass.cpp
diff --git a/test/std/strings/c.strings/version_cwctype.pass.cpp b/test/libcxx/strings/c.strings/version_cwctype.pass.cpp
index 461482abe765..461482abe765 100644
--- a/test/std/strings/c.strings/version_cwctype.pass.cpp
+++ b/test/libcxx/strings/c.strings/version_cwctype.pass.cpp
diff --git a/test/libcxx/strings/iterators.exceptions.pass.cpp b/test/libcxx/strings/iterators.exceptions.pass.cpp
index 591782b5dd4a..02ec921cc613 100644
--- a/test/libcxx/strings/iterators.exceptions.pass.cpp
+++ b/test/libcxx/strings/iterators.exceptions.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-
+// XFAIL: libcpp-no-exceptions
// <iterator>
// __libcpp_is_trivial_iterator<Tp>
@@ -23,6 +23,7 @@
#include <vector>
#include <initializer_list>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
@@ -30,17 +31,17 @@ int main()
// basic tests
static_assert(( std::__libcpp_string_gets_noexcept_iterator<char *>::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<const char *>::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::move_iterator<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::move_iterator<const char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<const char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::__wrap_iter<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::__wrap_iter<const char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<std::__wrap_iter<char *> > > ::value), "");
-
+
// iterators in the libc++ test suite
static_assert((!std::__libcpp_string_gets_noexcept_iterator<output_iterator <char *> >::value), "");
static_assert((!std::__libcpp_string_gets_noexcept_iterator<input_iterator <char *> >::value), "");
@@ -48,13 +49,13 @@ int main()
static_assert((!std::__libcpp_string_gets_noexcept_iterator<bidirectional_iterator<char *> >::value), "");
static_assert((!std::__libcpp_string_gets_noexcept_iterator<random_access_iterator<char *> >::value), "");
static_assert((!std::__libcpp_string_gets_noexcept_iterator<ThrowingIterator <char *> >::value), "");
-
-#if __has_feature(cxx_noexcept)
+
+#if TEST_STD_VER >= 11
static_assert(( std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
#else
static_assert((!std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
#endif
-
+
//
// iterators from libc++'s containers
//
diff --git a/test/libcxx/strings/iterators.noexcept.pass.cpp b/test/libcxx/strings/iterators.noexcept.pass.cpp
index f39a4deac735..283cf0897cca 100644
--- a/test/libcxx/strings/iterators.noexcept.pass.cpp
+++ b/test/libcxx/strings/iterators.noexcept.pass.cpp
@@ -34,17 +34,17 @@ int main()
// basic tests
static_assert(( std::__libcpp_string_gets_noexcept_iterator<char *>::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<const char *>::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::move_iterator<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::move_iterator<const char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<const char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::__wrap_iter<char *> > ::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::__wrap_iter<const char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<std::__wrap_iter<char *> > > ::value), "");
-
+
// iterators in the libc++ test suite
static_assert(( std::__libcpp_string_gets_noexcept_iterator<output_iterator <char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<input_iterator <char *> >::value), "");
@@ -52,9 +52,9 @@ int main()
static_assert(( std::__libcpp_string_gets_noexcept_iterator<bidirectional_iterator<char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<random_access_iterator<char *> >::value), "");
static_assert(( std::__libcpp_string_gets_noexcept_iterator<ThrowingIterator <char *> >::value), "");
-
+
static_assert(( std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
-
+
//
// iterators from libc++'s containers
//
diff --git a/test/std/strings/version.pass.cpp b/test/libcxx/strings/version.pass.cpp
index 0c79c1af2ce8..0c79c1af2ce8 100644
--- a/test/std/strings/version.pass.cpp
+++ b/test/libcxx/strings/version.pass.cpp
diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py
index f8096ad15f8a..593f9805447d 100644
--- a/test/libcxx/test/config.py
+++ b/test/libcxx/test/config.py
@@ -61,6 +61,7 @@ class Configuration(object):
self.libcxx_src_root = None
self.libcxx_obj_root = None
self.cxx_library_root = None
+ self.cxx_runtime_root = None
self.abi_library_root = None
self.env = {}
self.use_target = False
@@ -98,9 +99,11 @@ class Configuration(object):
self.configure_cxx_library_root()
self.configure_use_system_cxx_lib()
self.configure_use_clang_verify()
+ self.configure_use_thread_safety()
self.configure_execute_external()
self.configure_ccache()
self.configure_compile_flags()
+ self.configure_filesystem_compile_flags()
self.configure_link_flags()
self.configure_env()
self.configure_color_diagnostics()
@@ -194,6 +197,8 @@ class Configuration(object):
def configure_cxx_library_root(self):
self.cxx_library_root = self.get_lit_conf('cxx_library_root',
self.libcxx_obj_root)
+ self.cxx_runtime_root = self.get_lit_conf('cxx_runtime_root',
+ self.cxx_library_root)
def configure_use_system_cxx_lib(self):
# This test suite supports testing against either the system library or
@@ -218,6 +223,14 @@ class Configuration(object):
self.lit_config.note(
"inferred use_clang_verify as: %r" % self.use_clang_verify)
+ def configure_use_thread_safety(self):
+ '''If set, run clang with -verify on failing tests.'''
+ has_thread_safety = self.cxx.hasCompileFlag('-Werror=thread-safety')
+ if has_thread_safety:
+ self.cxx.compile_flags += ['-Werror=thread-safety']
+ self.config.available_features.add('thread-safety')
+ self.lit_config.note("enabling thread-safety annotations")
+
def configure_execute_external(self):
# Choose between lit's internal shell pipeline runner and a real shell.
# If LIT_USE_INTERNAL_SHELL is in the environment, we use that as the
@@ -277,10 +290,17 @@ class Configuration(object):
if self.cxx.hasCompileFlag('-fsized-deallocation'):
self.config.available_features.add('fsized-deallocation')
+ if self.get_lit_bool('has_libatomic', False):
+ self.config.available_features.add('libatomic')
+
def configure_compile_flags(self):
no_default_flags = self.get_lit_bool('no_default_flags', False)
if not no_default_flags:
self.configure_default_compile_flags()
+ # This include is always needed so add so add it regardless of
+ # 'no_default_flags'.
+ support_path = os.path.join(self.libcxx_src_root, 'test/support')
+ self.cxx.compile_flags += ['-I' + support_path]
# Configure extra flags
compile_flags_str = self.get_lit_conf('compile_flags', '')
self.cxx.compile_flags += shlex.split(compile_flags_str)
@@ -329,7 +349,6 @@ class Configuration(object):
def configure_compile_flags_header_includes(self):
support_path = os.path.join(self.libcxx_src_root, 'test/support')
- self.cxx.compile_flags += ['-I' + support_path]
self.cxx.compile_flags += ['-include', os.path.join(support_path, 'nasty_macros.hpp')]
self.configure_config_site_header()
libcxx_headers = self.get_lit_conf(
@@ -412,6 +431,37 @@ class Configuration(object):
self.config.available_features.add('libcpp-abi-unstable')
self.cxx.compile_flags += ['-D_LIBCPP_ABI_UNSTABLE']
+ def configure_filesystem_compile_flags(self):
+ enable_fs = self.get_lit_bool('enable_filesystem', default=False)
+ if not enable_fs:
+ return
+ enable_experimental = self.get_lit_bool('enable_experimental', default=False)
+ if not enable_experimental:
+ self.lit_config.fatal(
+ 'filesystem is enabled but libc++experimental.a is not.')
+ self.config.available_features.add('c++filesystem')
+ static_env = os.path.join(self.libcxx_src_root, 'test', 'std',
+ 'experimental', 'filesystem', 'Inputs', 'static_test_env')
+ static_env = os.path.realpath(static_env)
+ assert os.path.isdir(static_env)
+ self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="%s"' % static_env]
+
+ dynamic_env = os.path.join(self.libcxx_obj_root, 'test',
+ 'filesystem', 'Output', 'dynamic_env')
+ dynamic_env = os.path.realpath(dynamic_env)
+ if not os.path.isdir(dynamic_env):
+ os.makedirs(dynamic_env)
+ self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="%s"' % dynamic_env]
+ self.env['LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT'] = ("%s" % dynamic_env)
+
+ dynamic_helper = os.path.join(self.libcxx_src_root, 'test', 'support',
+ 'filesystem_dynamic_test_helper.py')
+ assert os.path.isfile(dynamic_helper)
+
+ self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="%s %s"'
+ % (sys.executable, dynamic_helper)]
+
+
def configure_link_flags(self):
no_default_flags = self.get_lit_bool('no_default_flags', False)
if not no_default_flags:
@@ -430,23 +480,11 @@ class Configuration(object):
self.cxx.link_flags += shlex.split(link_flags_str)
def configure_link_flags_cxx_library_path(self):
- libcxx_library = self.get_lit_conf('libcxx_library')
- # Configure libc++ library paths.
- if libcxx_library is not None:
- # Check that the given value for libcxx_library is valid.
- if not os.path.isfile(libcxx_library):
- self.lit_config.fatal(
- "libcxx_library='%s' is not a valid file." %
- libcxx_library)
- if self.use_system_cxx_lib:
- self.lit_config.fatal(
- "Conflicting options: 'libcxx_library' cannot be used "
- "with 'use_system_cxx_lib=true'")
- self.cxx.link_flags += ['-Wl,-rpath,' +
- os.path.dirname(libcxx_library)]
- elif not self.use_system_cxx_lib and self.cxx_library_root:
- self.cxx.link_flags += ['-L' + self.cxx_library_root,
- '-Wl,-rpath,' + self.cxx_library_root]
+ if not self.use_system_cxx_lib:
+ if self.cxx_library_root:
+ self.cxx.link_flags += ['-L' + self.cxx_library_root]
+ if self.cxx_runtime_root:
+ self.cxx.link_flags += ['-Wl,-rpath,' + self.cxx_runtime_root]
def configure_link_flags_abi_library_path(self):
# Configure ABI library paths.
@@ -456,11 +494,20 @@ class Configuration(object):
'-Wl,-rpath,' + self.abi_library_root]
def configure_link_flags_cxx_library(self):
- libcxx_library = self.get_lit_conf('libcxx_library')
- if libcxx_library:
- self.cxx.link_flags += [libcxx_library]
- else:
+ libcxx_experimental = self.get_lit_bool('enable_experimental', default=False)
+ if libcxx_experimental:
+ self.config.available_features.add('c++experimental')
+ self.cxx.link_flags += ['-lc++experimental']
+ libcxx_shared = self.get_lit_bool('enable_shared', default=True)
+ if libcxx_shared:
self.cxx.link_flags += ['-lc++']
+ else:
+ cxx_library_root = self.get_lit_conf('cxx_library_root')
+ if cxx_library_root:
+ abs_path = os.path.join(cxx_library_root, 'libc++.a')
+ self.cxx.link_flags += [abs_path]
+ else:
+ self.cxx.link_flags += ['-lc++']
def configure_link_flags_abi_library(self):
cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi')
@@ -470,7 +517,16 @@ class Configuration(object):
self.cxx.link_flags += ['-lsupc++']
elif cxx_abi == 'libcxxabi':
if self.target_info.allow_cxxabi_link():
- self.cxx.link_flags += ['-lc++abi']
+ libcxxabi_shared = self.get_lit_bool('libcxxabi_shared', default=True)
+ if libcxxabi_shared:
+ self.cxx.link_flags += ['-lc++abi']
+ else:
+ cxxabi_library_root = self.get_lit_conf('abi_library_path')
+ if cxxabi_library_root:
+ abs_path = os.path.join(cxxabi_library_root, 'libc++abi.a')
+ self.cxx.link_flags += [abs_path]
+ else:
+ self.cxx.link_flags += ['-lc++abi']
elif cxx_abi == 'libcxxrt':
self.cxx.link_flags += ['-lcxxrt']
elif cxx_abi == 'none':
@@ -515,8 +571,9 @@ class Configuration(object):
if enable_warnings:
self.cxx.compile_flags += [
'-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
- '-Wall', '-Werror'
+ '-Wall', '-Wextra', '-Werror'
]
+ self.cxx.addWarningFlagIfSupported('-Wno-unused-command-line-argument')
self.cxx.addWarningFlagIfSupported('-Wno-attributes')
self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
@@ -525,6 +582,8 @@ class Configuration(object):
# compiles clean with them.
self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
+ self.cxx.addWarningFlagIfSupported('-Wno-unused-parameter')
+ self.cxx.addWarningFlagIfSupported('-Wno-sign-compare')
std = self.get_lit_conf('std', None)
if std in ['c++98', 'c++03']:
# The '#define static_assert' provided by libc++ in C++03 mode
@@ -551,6 +610,9 @@ class Configuration(object):
self.cxx.flags += ['-fsanitize=address']
if llvm_symbolizer is not None:
self.env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer
+ # FIXME: Turn ODR violation back on after PR28391 is resolved
+ # https://llvm.org/bugs/show_bug.cgi?id=28391
+ self.env['ASAN_OPTIONS'] = 'detect_odr_violation=0'
self.config.available_features.add('asan')
self.config.available_features.add('sanitizer-new-delete')
elif san == 'Memory' or san == 'MemoryWithOrigins':
@@ -563,9 +625,12 @@ class Configuration(object):
self.config.available_features.add('msan')
self.config.available_features.add('sanitizer-new-delete')
elif san == 'Undefined':
+ blacklist = os.path.join(self.libcxx_src_root,
+ 'test/ubsan_blacklist.txt')
self.cxx.flags += ['-fsanitize=undefined',
- '-fno-sanitize=vptr,function',
- '-fno-sanitize-recover']
+ '-fno-sanitize=vptr,function,float-divide-by-zero',
+ '-fno-sanitize-recover=all',
+ '-fsanitize-blacklist=' + blacklist]
self.cxx.compile_flags += ['-O3']
self.env['UBSAN_OPTIONS'] = 'print_stacktrace=1'
self.config.available_features.add('ubsan')
diff --git a/test/libcxx/test/format.py b/test/libcxx/test/format.py
index aaa9a1845ae4..b9ec2ba2aa7b 100644
--- a/test/libcxx/test/format.py
+++ b/test/libcxx/test/format.py
@@ -161,12 +161,19 @@ class LibcxxTestFormat(object):
'expected-error', 'expected-no-diagnostics']
use_verify = self.use_verify_for_fail and \
any([tag in contents for tag in verify_tags])
- extra_flags = ['-fsyntax-only']
+ # FIXME(EricWF): GCC 5 does not evaluate static assertions that
+ # are dependant on a template parameter when '-fsyntax-only' is passed.
+ # This is fixed in GCC 6. However for now we only pass "-fsyntax-only"
+ # when using Clang.
+ extra_flags = []
+ if self.cxx.type != 'gcc':
+ extra_flags += ['-fsyntax-only']
if use_verify:
extra_flags += ['-Xclang', '-verify',
'-Xclang', '-verify-ignore-unexpected=note']
cmd, out, err, rc = self.cxx.compile(source_path, out=os.devnull,
- flags=extra_flags)
+ flags=extra_flags,
+ disable_ccache=True)
expected_rc = 0 if use_verify else 1
if rc == expected_rc:
return lit.Test.PASS, ''
diff --git a/test/libcxx/test/target_info.py b/test/libcxx/test/target_info.py
index 7ca08bea193a..a743595a1046 100644
--- a/test/libcxx/test/target_info.py
+++ b/test/libcxx/test/target_info.py
@@ -90,13 +90,10 @@ class DarwinLocalTI(DefaultTargetInfo):
def configure_env(self, env):
library_paths = []
# Configure the library path for libc++
- libcxx_library = self.full_config.get_lit_conf('libcxx_library')
if self.full_config.use_system_cxx_lib:
pass
- elif libcxx_library:
- library_paths += [os.path.dirname(libcxx_library)]
- elif self.full_config.cxx_library_root:
- library_paths += [self.full_config.cxx_library_root]
+ elif self.full_config.cxx_runtime_root:
+ library_paths += [self.full_config.cxx_runtime_root]
# Configure the abi library path
if self.full_config.abi_library_root:
library_paths += [self.full_config.abi_library_root]
@@ -104,6 +101,15 @@ class DarwinLocalTI(DefaultTargetInfo):
env['DYLD_LIBRARY_PATH'] = ':'.join(library_paths)
def allow_cxxabi_link(self):
+ # FIXME: PR27405
+ # libc++ *should* export all of the symbols found in libc++abi on OS X.
+ # For this reason LibcxxConfiguration will not link libc++abi in OS X.
+ # However __cxa_throw_bad_new_array_length doesn't get exported into
+ # libc++ yet so we still need to explicitly link libc++abi when testing
+ # libc++abi
+ # See PR22654.
+ if(self.full_config.get_lit_conf('name', '') == 'libc++abi'):
+ return True
# Don't link libc++abi explicitly on OS X because the symbols
# should be available in libc++ directly.
return False
@@ -162,16 +168,22 @@ class LinuxLocalTI(DefaultTargetInfo):
enable_threads = ('libcpp-has-no-threads' not in
self.full_config.config.available_features)
llvm_unwinder = self.full_config.get_lit_bool('llvm_unwinder', False)
+ shared_libcxx = self.full_config.get_lit_bool('enable_shared', True)
flags += ['-lm']
if not llvm_unwinder:
flags += ['-lgcc_s', '-lgcc']
if enable_threads:
flags += ['-lpthread']
+ if not shared_libcxx:
+ flags += ['-lrt']
flags += ['-lc']
if llvm_unwinder:
flags += ['-lunwind', '-ldl']
else:
flags += ['-lgcc_s', '-lgcc']
+ use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
+ if use_libatomic:
+ flags += ['-latomic']
san = self.full_config.get_lit_conf('use_sanitizer', '').strip()
if san:
# The libraries and their order are taken from the
diff --git a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp
new file mode 100644
index 000000000000..bf567a30243a
--- /dev/null
+++ b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+
+// UNSUPPORTED: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// <future>
+
+// class promise<R>
+
+// void set_exception(exception_ptr p);
+// Test that a null exception_ptr is diagnosed.
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? ((void)0) : throw 42)
+
+#define _LIBCPP_DEBUG 0
+#include <future>
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+
+int main()
+{
+ {
+ typedef int T;
+ std::promise<T> p;
+ try {
+ p.set_exception(std::exception_ptr());
+ assert(false);
+ } catch (int const& value) {
+ assert(value == 42);
+ }
+ }
+ {
+ typedef int& T;
+ std::promise<T> p;
+ try {
+ p.set_exception(std::exception_ptr());
+ assert(false);
+ } catch (int const& value) {
+ assert(value == 42);
+ }
+ }
+}
diff --git a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
new file mode 100644
index 000000000000..1cb61d9af297
--- /dev/null
+++ b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+
+// UNSUPPORTED: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// <future>
+
+// class promise<R>
+
+// void set_exception_on_thread_exit(exception_ptr p);
+// Test that a null exception_ptr is diagnosed.
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? ((void)0) : throw 42)
+
+#define _LIBCPP_DEBUG 0
+#include <future>
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+
+int main()
+{
+ {
+ typedef int T;
+ std::promise<T> p;
+ try {
+ p.set_exception_at_thread_exit(std::exception_ptr());
+ assert(false);
+ } catch (int const& value) {
+ assert(value == 42);
+ }
+ }
+ {
+ typedef int& T;
+ std::promise<T> p;
+ try {
+ p.set_exception_at_thread_exit(std::exception_ptr());
+ assert(false);
+ } catch (int const& value) {
+ assert(value == 42);
+ }
+ }
+}
diff --git a/test/std/thread/futures/futures.tas/types.pass.cpp b/test/libcxx/thread/futures/futures.task/types.pass.cpp
index f7c9b223add1..cb0fb803c6ab 100644
--- a/test/std/thread/futures/futures.tas/types.pass.cpp
+++ b/test/libcxx/thread/futures/futures.task/types.pass.cpp
@@ -16,7 +16,9 @@
// class packaged_task<R(ArgTypes...)>
// {
// public:
-// typedef R result_type;
+// typedef R result_type; // extension
+
+// This is a libc++ extension.
#include <future>
#include <type_traits>
diff --git a/test/std/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp b/test/libcxx/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
index bf28e01a0e86..bf28e01a0e86 100644
--- a/test/std/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
+++ b/test/libcxx/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
diff --git a/test/std/thread/thread.condition/version.pass.cpp b/test/libcxx/thread/thread.condition/version.pass.cpp
index 12a775e83398..12a775e83398 100644
--- a/test/std/thread/thread.condition/version.pass.cpp
+++ b/test/libcxx/thread/thread.condition/version.pass.cpp
diff --git a/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp b/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp
new file mode 100644
index 000000000000..aae0afbffd37
--- /dev/null
+++ b/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// TODO(EricWF) Investigate why typeid(...).name() returns a different string
+// on GCC 4.9 but not newer GCCs.
+// XFAIL: gcc-4.9
+
+// THIS TESTS C++03 EXTENSIONS.
+
+// <mutex>
+
+// template <class ...Mutex> class lock_guard;
+
+// Test that the the variadic lock guard implementation mangles the same in
+// C++11 and C++03. This is important since the mangling of `lock_guard` depends
+// on it being declared as a variadic template, even in C++03.
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include <mutex>
+#include <string>
+#include <typeinfo>
+#include <cassert>
+
+int main() {
+ const std::string expect = "NSt3__110lock_guardIJNS_5mutexEEEE";
+ assert(typeid(std::lock_guard<std::mutex>).name() == expect);
+}
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp b/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
index 12c80f02c340..12c80f02c340 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp b/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
index 10626bc4072e..10626bc4072e 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_annotations_not_enabled.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_annotations_not_enabled.pass.cpp
new file mode 100644
index 000000000000..d9ac92c270c3
--- /dev/null
+++ b/test/libcxx/thread/thread.mutex/thread_safety_annotations_not_enabled.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <mutex>
+
+// This test does not define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS so it
+// should compile without any warnings or errors even though this pattern is not
+// understood by the thread safety annotations.
+
+#include <mutex>
+
+int main() {
+ std::mutex m;
+ m.lock();
+ {
+ std::unique_lock<std::mutex> g(m, std::adopt_lock);
+ }
+}
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
new file mode 100644
index 000000000000..4e85a039686a
--- /dev/null
+++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-no-threads
+// REQUIRES: thread-safety
+
+// <mutex>
+
+#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+
+#include <mutex>
+
+std::mutex m;
+int foo __attribute__((guarded_by(m)));
+
+int main() {
+ std::lock_guard<std::mutex> lock(m);
+ foo++;
+}
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
new file mode 100644
index 000000000000..40b97c396ad6
--- /dev/null
+++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-no-threads
+// REQUIRES: thread-safety
+
+// <mutex>
+
+#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+
+#include <mutex>
+
+std::mutex m;
+int foo __attribute__((guarded_by(m)));
+
+int main() {
+ m.lock();
+ foo++;
+ m.unlock();
+}
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
new file mode 100644
index 000000000000..c1425c960c00
--- /dev/null
+++ b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-no-threads
+// REQUIRES: thread-safety
+
+// <mutex>
+
+#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+
+#include <mutex>
+
+std::mutex m;
+
+int main() {
+ m.lock();
+} // expected-error {{mutex 'm' is still held at the end of function}}
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
new file mode 100644
index 000000000000..e03f5eabffcf
--- /dev/null
+++ b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-no-threads
+// REQUIRES: thread-safety
+
+// <mutex>
+
+#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+
+#include <mutex>
+
+std::mutex m;
+int foo __attribute__((guarded_by(m)));
+
+void increment() __attribute__((requires_capability(m))) {
+ foo++;
+}
+
+int main() {
+ m.lock();
+ increment();
+ m.unlock();
+}
diff --git a/test/std/thread/thread.mutex/version.pass.cpp b/test/libcxx/thread/thread.mutex/version.pass.cpp
index 81b52c79204b..81b52c79204b 100644
--- a/test/std/thread/thread.mutex/version.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/version.pass.cpp
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp b/test/libcxx/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
index c8807a965c44..c8807a965c44 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
+++ b/test/libcxx/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
diff --git a/test/std/thread/thread.threads/thread.thread.class/types.pass.cpp b/test/libcxx/thread/thread.threads/thread.thread.class/types.pass.cpp
index a5bf77031cca..a5bf77031cca 100644
--- a/test/std/thread/thread.threads/thread.thread.class/types.pass.cpp
+++ b/test/libcxx/thread/thread.threads/thread.thread.class/types.pass.cpp
diff --git a/test/std/thread/thread.threads/version.pass.cpp b/test/libcxx/thread/thread.threads/version.pass.cpp
index d16b0eb06842..d16b0eb06842 100644
--- a/test/std/thread/thread.threads/version.pass.cpp
+++ b/test/libcxx/thread/thread.threads/version.pass.cpp
diff --git a/test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp b/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
index e579f207a33f..509c751b455d 100644
--- a/test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp
+++ b/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
@@ -14,12 +14,14 @@
//------------------------------------------------------------------------------
// TESTING INVOKE(f, t1, t2, ..., tN)
// - Bullet 1 -- (t1.*f)(t2, ..., tN)
-// - Bullet 2 -- ((*t1).*f)(t2, ..., tN)
+// - Bullet 2 -- (t1.get().*f)(t2, ..., tN) // t1 is a reference_wrapper
+// - Bullet 3 -- ((*t1).*f)(t2, ..., tN)
//
// Overview:
-// Bullets 1 and 2 handle the case where 'f' is a pointer to member function.
+// Bullets 1, 2 and 3 handle the case where 'f' is a pointer to member function.
// Bullet 1 only handles the cases where t1 is an object of type T or a
-// type derived from 'T'. Bullet 2 handles all other cases.
+// type derived from 'T'. Bullet 2 handles the case where 't1' is a reference
+// wrapper and bullet 3 handles all other cases.
//
// Concerns:
// 1) cv-qualified member function signatures are accepted.
@@ -31,6 +33,7 @@
// as the call object.
// 7) Pointers to T or a type derived from T can be used as the call object.
// 8) Reference return types are properly deduced.
+// 9) reference_wrappers are properly handled and unwrapped.
//
//
// Plan:
@@ -123,6 +126,7 @@ private:
#endif // TEST_STD_VER >= 11
+
//==============================================================================
// TestCase - A test case for a single member function.
// ClassType - The type of the class being tested.
@@ -151,6 +155,8 @@ private:
D* der_ptr = &der;
DerefToType<T> dref;
DerefPropType<T> dref2;
+ std::reference_wrapper<T> rref(obj);
+ std::reference_wrapper<D> drref(der);
// (Plan-3) Dispatch based on the CV tags.
CV tag;
@@ -158,9 +164,13 @@ private:
runTestDispatch(tag, obj);
runTestDispatch(tag, der);
runTestDispatch(tag, dref2);
- runTestDispatchIf(NotRValue, tag, dref);
- runTestDispatchIf(NotRValue, tag, obj_ptr);
+ runTestDispatchIf(NotRValue, tag, dref);
+ runTestDispatchIf(NotRValue, tag, obj_ptr);
runTestDispatchIf(NotRValue, tag, der_ptr);
+#if TEST_STD_VER >= 11
+ runTestDispatchIf(NotRValue, tag, rref);
+ runTestDispatchIf(NotRValue, tag, drref);
+#endif
}
template <class QT, class Tp>
@@ -179,27 +189,43 @@ private:
template <class Tp>
void runTestDispatch(Q_Const, Tp& v) {
- Tp const& cv = v;
runTest(v);
- runTest(cv);
+ runTest(makeConst(v));
}
template <class Tp>
void runTestDispatch(Q_Volatile, Tp& v) {
- Tp volatile& vv = v;
runTest(v);
- runTest(vv);
+ runTest(makeVolatile(v));
+
}
template <class Tp>
void runTestDispatch(Q_CV, Tp& v) {
- Tp const& cv = v;
- Tp volatile& vv = v;
- Tp const volatile& cvv = v;
runTest(v);
- runTest(cv);
- runTest(vv);
- runTest(cvv);
+ runTest(makeConst(v));
+ runTest(makeVolatile(v));
+ runTest(makeCV(v));
+ }
+
+ template <class T>
+ void runTest(const std::reference_wrapper<T>& obj) {
+ typedef Caster<Q_None, RValue> SCast;
+ typedef Caster<Q_None, ArgRValue> ACast;
+ typedef CallSig (ClassType::*MemPtr);
+ // Delegate test to logic in invoke_helpers.h
+ BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
+ b.runTest( (MemPtr)&ClassType::f, obj);
+ }
+
+ template <class T>
+ void runTest(T* obj) {
+ typedef Caster<Q_None, RValue> SCast;
+ typedef Caster<Q_None, ArgRValue> ACast;
+ typedef CallSig (ClassType::*MemPtr);
+ // Delegate test to logic in invoke_helpers.h
+ BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
+ b.runTest( (MemPtr)&ClassType::f, obj);
}
template <class Obj>
@@ -221,6 +247,30 @@ template <class Sig, int Arity, class CV, bool RValue = false>
struct TestCase11 : public TestCaseImp<MemFun11, Sig, Arity, CV, RValue, true> {};
#endif
+template <class Tp>
+struct DerivedFromRefWrap : public std::reference_wrapper<Tp> {
+ DerivedFromRefWrap(Tp& tp) : std::reference_wrapper<Tp>(tp) {}
+};
+
+#if TEST_STD_VER >= 11
+void test_derived_from_ref_wrap() {
+ int x = 42;
+ std::reference_wrapper<int> r(x);
+ std::reference_wrapper<std::reference_wrapper<int>> r2(r);
+ DerivedFromRefWrap<int> d(x);
+ auto get_fn = &std::reference_wrapper<int>::get;
+ auto& ret = std::__invoke(get_fn, r);
+ auto& cret = std::__invoke_constexpr(get_fn, r);
+ assert(&ret == &x);
+ assert(&cret == &x);
+ auto& ret2 = std::__invoke(get_fn, d);
+ auto& cret2 = std::__invoke_constexpr(get_fn, d);
+ assert(&ret2 == &x);
+ auto& ret3 = std::__invoke(get_fn, r2);
+ assert(&ret3 == &x);
+}
+#endif
+
int main() {
typedef void*& R;
typedef ArgType A;
@@ -314,5 +364,7 @@ int main() {
TestCase11<R(A&&, A&&, A&&, ...) const &&, 3, Q_Const, /* RValue */ true>::run();
TestCase11<R(A&&, A&&, A&&, ...) volatile &&, 3, Q_Volatile, /* RValue */ true>::run();
TestCase11<R(A&&, A&&, A&&, ...) const volatile &&, 3, Q_CV, /* RValue */ true>::run();
+
+ test_derived_from_ref_wrap();
#endif
} \ No newline at end of file
diff --git a/test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp b/test/libcxx/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp
index b6fe190bd2a7..803c501f8c9e 100644
--- a/test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp
+++ b/test/libcxx/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp
@@ -13,13 +13,15 @@
//------------------------------------------------------------------------------
// TESTING INVOKE(f, t1, t2, ..., tN)
-// - Bullet 3 -- t1.*f
-// - Bullet 4 -- (*t1).*f
+// - Bullet 4 -- t1.*f
+// - Bullet 5 -- t1.get().*f // t1 is a reference wrapper.
+// - Bullet 6 -- (*t1).*f
//
// Overview:
-// Bullets 3 and 4 handle the case where 'f' is a pointer to member object.
-// Bullet 3 only handles the cases where t1 is an object of type T or a
-// type derived from 'T'. Bullet 4 handles all other cases.
+// Bullets 4, 5 and 6 handle the case where 'f' is a pointer to member object.
+// Bullet 4 only handles the cases where t1 is an object of type T or a
+// type derived from 'T'. Bullet 5 handles cases where 't1' is a reference_wrapper
+// and bullet 6 handles all other cases.
//
// Concerns:
// 1) The return type is always an lvalue reference.
@@ -30,6 +32,7 @@
// 6) All types that dereference to T or a type derived from T can be used
// as the call object.
// 7) Pointers to T or a type derived from T can be used as the call object.
+// 8) reference_wrapper's are properly unwrapped before invoking the function.
#include <functional>
#include <type_traits>
@@ -66,6 +69,8 @@ private:
Derived* der_ptr = &der;
DerefToType<TestType> dref;
DerefPropType<TestType> dref2;
+ std::reference_wrapper<TestType> rref(obj);
+ std::reference_wrapper<Derived> drref(der);
{
typedef ObjectType (TestType::*MemPtr);
@@ -74,9 +79,13 @@ private:
runTestDispatch<E>(M, obj, &obj.object);
runTestDispatch<E>(M, der, &der.object);
runTestDispatch<E>(M, dref2, &dref2.object.object);
- runTestPointerDispatch<E>(M, obj_ptr, &obj_ptr->object);
- runTestPointerDispatch<E>(M, der_ptr, &der_ptr->object);
- runTestPointerDispatch<E>(M, dref, &dref.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+#if TEST_STD_VER >= 11
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+#endif
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
}
{
typedef ObjectType const (TestType::*CMemPtr);
@@ -85,9 +94,13 @@ private:
runTestDispatch<E>(M, obj, &obj.object);
runTestDispatch<E>(M, der, &der.object);
runTestDispatch<E>(M, dref2, &dref2.object.object);
- runTestPointerDispatch<E>(M, obj_ptr, &obj_ptr->object);
- runTestPointerDispatch<E>(M, der_ptr, &der_ptr->object);
- runTestPointerDispatch<E>(M, dref, &dref.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+#if TEST_STD_VER >= 11
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+#endif
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
}
{
typedef ObjectType volatile (TestType::*VMemPtr);
@@ -96,9 +109,13 @@ private:
runTestDispatch<E>(M, obj, &obj.object);
runTestDispatch<E>(M, der, &der.object);
runTestDispatch<E>(M, dref2, &dref2.object.object);
- runTestPointerDispatch<E>(M, obj_ptr, &obj_ptr->object);
- runTestPointerDispatch<E>(M, der_ptr, &der_ptr->object);
- runTestPointerDispatch<E>(M, dref, &dref.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+#if TEST_STD_VER >= 11
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+#endif
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
}
{
typedef ObjectType const volatile (TestType::*CVMemPtr);
@@ -107,9 +124,13 @@ private:
runTestDispatch<E>(M, obj, &obj.object);
runTestDispatch<E>(M, der, &der.object);
runTestDispatch<E>(M, dref2, &dref2.object.object);
- runTestPointerDispatch<E>(M, obj_ptr, &obj_ptr->object);
- runTestPointerDispatch<E>(M, der_ptr, &der_ptr->object);
- runTestPointerDispatch<E>(M, dref, &dref.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+#if TEST_STD_VER >= 11
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+#endif
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
}
}
@@ -128,7 +149,15 @@ private:
}
template <class Expect, class Fn, class T>
- void runTestPointerDispatch(Fn M, T& obj, ObjectType* expect) {
+ void runTestPropCVDispatch(Fn M, T& obj, ObjectType* expect) {
+ runTest<Expect &> (M, obj, expect);
+ runTest<Expect const&> (M, makeConst(obj), expect);
+ runTest<Expect volatile&> (M, makeVolatile(obj), expect);
+ runTest<Expect const volatile&>(M, makeCV(obj), expect);
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTestNoPropDispatch(Fn M, T& obj, ObjectType* expect) {
runTest<Expect&>(M, C_<T &>(obj), expect);
runTest<Expect&>(M, C_<T const&>(obj), expect);
runTest<Expect&>(M, C_<T volatile&>(obj), expect);
@@ -142,19 +171,42 @@ private:
}
template <class Expect, class Fn, class T>
+ void runTest(Fn M, const T& obj, ObjectType* expect) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(M, obj)), Expect
+ >::value), "");
+ Expect e = std::__invoke(M, obj);
+ assert(&e == expect);
+ }
+
+ template <class Expect, class Fn, class T>
#if TEST_STD_VER >= 11
void runTest(Fn M, T&& obj, ObjectType* expect) {
#else
void runTest(Fn M, T& obj, ObjectType* expect ) {
#endif
- static_assert((std::is_same<
- decltype(std::__invoke(M, std::forward<T>(obj))), Expect
- >::value), "");
- Expect e = std::__invoke(M, std::forward<T>(obj));
- assert(&e == expect);
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(M, std::forward<T>(obj))), Expect
+ >::value), "");
+ Expect e = std::__invoke(M, std::forward<T>(obj));
+ assert(&e == expect);
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke_constexpr(M, std::forward<T>(obj))), Expect
+ >::value), "");
+ Expect e = std::__invoke_constexpr(M, std::forward<T>(obj));
+ assert(&e == expect);
+ }
+#endif
}
};
+
+
+
int main() {
TestCase<ArgType>::run();
TestCase<ArgType const>::run();
diff --git a/test/std/utilities/function.objects/func.require/bullet_5.pass.cpp b/test/libcxx/utilities/function.objects/func.require/bullet_7.pass.cpp
index 3f3c96a9b9bd..0d14a350c897 100644
--- a/test/std/utilities/function.objects/func.require/bullet_5.pass.cpp
+++ b/test/libcxx/utilities/function.objects/func.require/bullet_7.pass.cpp
@@ -13,10 +13,10 @@
//------------------------------------------------------------------------------
// TESTING INVOKE(f, t1, t2, ..., tN)
-// - Bullet 5 -- f(t2, ..., tN)
+// - Bullet 7 -- f(t2, ..., tN)
//
// Overview:
-// Bullet 5 handles the cases where the first argument is not a member
+// Bullet 7 handles the cases where the first argument is not a member
// function.
//
// Concerns:
diff --git a/test/std/utilities/function.objects/func.require/invoke.pass.cpp b/test/libcxx/utilities/function.objects/func.require/invoke.pass.cpp
index 25681630a80c..1d4251354dc5 100644
--- a/test/std/utilities/function.objects/func.require/invoke.pass.cpp
+++ b/test/libcxx/utilities/function.objects/func.require/invoke.pass.cpp
@@ -9,12 +9,10 @@
// [func.require]
-// INVOKE
-#if __cplusplus < 201103L
-int main () {} // no __invoke in C++03
-#else
-
#include <type_traits>
+#include <functional>
+
+#include "test_macros.h"
template <typename T, int N>
struct Array
@@ -26,10 +24,9 @@ struct Type
{
Array<char, 1>::type& f1();
Array<char, 2>::type& f2() const;
-
+#if TEST_STD_VER >= 11
Array<char, 1>::type& g1() &;
Array<char, 2>::type& g2() const &;
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Array<char, 3>::type& g3() &&;
Array<char, 4>::type& g4() const &&;
#endif
@@ -39,12 +36,10 @@ int main()
{
static_assert(sizeof(std::__invoke(&Type::f1, std::declval<Type >())) == 1, "");
static_assert(sizeof(std::__invoke(&Type::f2, std::declval<Type const >())) == 2, "");
-
+#if TEST_STD_VER >= 11
static_assert(sizeof(std::__invoke(&Type::g1, std::declval<Type &>())) == 1, "");
static_assert(sizeof(std::__invoke(&Type::g2, std::declval<Type const &>())) == 2, "");
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
static_assert(sizeof(std::__invoke(&Type::g3, std::declval<Type &&>())) == 3, "");
static_assert(sizeof(std::__invoke(&Type::g4, std::declval<Type const&&>())) == 4, "");
#endif
}
-#endif
diff --git a/test/std/utilities/function.objects/func.require/invoke_helpers.h b/test/libcxx/utilities/function.objects/func.require/invoke_helpers.h
index a85b39f37175..7e7a5fd24a62 100644
--- a/test/std/utilities/function.objects/func.require/invoke_helpers.h
+++ b/test/libcxx/utilities/function.objects/func.require/invoke_helpers.h
@@ -79,6 +79,40 @@ typedef Caster<Q_Const, true> MoveConstCaster;
typedef Caster<Q_Volatile, true> MoveVolatileCaster;
typedef Caster<Q_CV, true> MoveCVCaster;
+
+template <class Tp>
+Tp const& makeConst(Tp& ref) { return ref; }
+
+template <class Tp>
+Tp const* makeConst(Tp* ptr) { return ptr; }
+
+template <class Tp>
+std::reference_wrapper<const Tp> makeConst(std::reference_wrapper<Tp>& ref) {
+ return std::reference_wrapper<const Tp>(ref.get());
+}
+
+template <class Tp>
+Tp volatile& makeVolatile(Tp& ref) { return ref; }
+
+template <class Tp>
+Tp volatile* makeVolatile(Tp* ptr) { return ptr; }
+
+template <class Tp>
+std::reference_wrapper<volatile Tp> makeVolatile(std::reference_wrapper<Tp>& ref) {
+ return std::reference_wrapper<volatile Tp>(ref.get());
+}
+
+template <class Tp>
+Tp const volatile& makeCV(Tp& ref) { return ref; }
+
+template <class Tp>
+Tp const volatile* makeCV(Tp* ptr) { return ptr; }
+
+template <class Tp>
+std::reference_wrapper<const volatile Tp> makeCV(std::reference_wrapper<Tp>& ref) {
+ return std::reference_wrapper<const volatile Tp>(ref.get());
+}
+
// A shorter name for 'static_cast'
template <class QualType, class Tp>
QualType C_(Tp& v) { return static_cast<QualType>(v); };
@@ -237,89 +271,185 @@ private:
ArgType a0, a1, a2;
//==========================================================================
- // BULLET 1 AND 2 TEST METHODS
+ // BULLET 1, 2 AND 3 TEST METHODS
//==========================================================================
template <class MethodPtr, class ObjectT>
void runTestImp(Int<0>, MethodPtr ptr, ObjectT& object) {
- static_assert((std::is_same<
- decltype(std::__invoke(ptr, object_cast(object)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(ptr, object_cast(object));
- assert(ID::checkCalled(ret));
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object));
+ assert(ID::checkCalled(ret));
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke_constexpr(ptr, object_cast(object)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke_constexpr(ptr, object_cast(object));
+ assert(ID::checkCalled(ret));
+ }
+#endif
}
template <class MethodPtr, class ObjectT>
void runTestImp(Int<1>, MethodPtr ptr, ObjectT& object) {
- static_assert((std::is_same<
- decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0));
- assert(ID::checkCalled(ret));
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke_constexpr(ptr, object_cast(object), arg_cast(a0)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke_constexpr(ptr, object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
+ }
+#endif
}
template <class MethodPtr, class ObjectT>
void runTestImp(Int<2>, MethodPtr ptr, ObjectT& object) {
- static_assert((std::is_same<
- decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1));
- assert(ID::checkCalled(ret));
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke_constexpr(ptr, object_cast(object), arg_cast(a0), arg_cast(a1)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke_constexpr(ptr, object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
+ }
+#endif
}
template <class MethodPtr, class ObjectT>
void runTestImp(Int<3>, MethodPtr ptr, ObjectT& object) {
- static_assert((std::is_same<
- decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
- assert(ID::checkCalled(ret));
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke_constexpr(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke_constexpr(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
+ }
+#endif
}
//==========================================================================
- // BULLET 5 TEST METHODS
+ // BULLET 7 TEST METHODS
//==========================================================================
template <class ObjectT>
void runTestImp(Int<0>, ObjectT& object) {
- static_assert((std::is_same<
- decltype(std::__invoke(object_cast(object)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(object_cast(object));
- assert(ID::checkCalled(ret));
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object));
+ assert(ID::checkCalled(ret));
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke_constexpr(object_cast(object)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke_constexpr(object_cast(object));
+ assert(ID::checkCalled(ret));
+ }
+#endif
}
template <class ObjectT>
void runTestImp(Int<1>, ObjectT& object) {
- static_assert((std::is_same<
- decltype(std::__invoke(object_cast(object), arg_cast(a0)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(object_cast(object), arg_cast(a0));
- assert(ID::checkCalled(ret));
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object), arg_cast(a0)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke_constexpr(object_cast(object), arg_cast(a0)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke_constexpr(object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
+ }
+#endif
}
template <class ObjectT>
void runTestImp(Int<2>, ObjectT& object) {
- static_assert((std::is_same<
- decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1));
- assert(ID::checkCalled(ret));
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke_constexpr(object_cast(object), arg_cast(a0), arg_cast(a1)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke_constexpr(object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
+ }
+#endif
}
template <class ObjectT>
void runTestImp(Int<3>, ObjectT& object) {
- static_assert((std::is_same<
- decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
- assert(ID::checkCalled(ret));
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke_constexpr(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke_constexpr(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
+ }
+#endif
}
};
diff --git a/test/std/utilities/function.objects/version.pass.cpp b/test/libcxx/utilities/function.objects/version.pass.cpp
index 99d731a74543..99d731a74543 100644
--- a/test/std/utilities/function.objects/version.pass.cpp
+++ b/test/libcxx/utilities/function.objects/version.pass.cpp
diff --git a/test/std/utilities/memory/version.pass.cpp b/test/libcxx/utilities/memory/version.pass.cpp
index 790c08a3bd2d..790c08a3bd2d 100644
--- a/test/std/utilities/memory/version.pass.cpp
+++ b/test/libcxx/utilities/memory/version.pass.cpp
diff --git a/test/libcxx/utilities/meta/is_referenceable.pass.cpp b/test/libcxx/utilities/meta/is_referenceable.pass.cpp
new file mode 100644
index 000000000000..42b1f2dc3014
--- /dev/null
+++ b/test/libcxx/utilities/meta/is_referenceable.pass.cpp
@@ -0,0 +1,193 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+
+// __is_referenceable<Tp>
+//
+// [defns.referenceable] defines "a referenceable type" as:
+// An object type, a function type that does not have cv-qualifiers
+// or a ref-qualifier, or a reference type.
+//
+
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Foo {};
+
+static_assert((!std::__is_referenceable<void>::value), "");
+static_assert(( std::__is_referenceable<int>::value), "");
+static_assert(( std::__is_referenceable<int[3]>::value), "");
+static_assert(( std::__is_referenceable<int[]>::value), "");
+static_assert(( std::__is_referenceable<int &>::value), "");
+static_assert(( std::__is_referenceable<const int &>::value), "");
+static_assert(( std::__is_referenceable<int *>::value), "");
+static_assert(( std::__is_referenceable<const int *>::value), "");
+static_assert(( std::__is_referenceable<Foo>::value), "");
+static_assert(( std::__is_referenceable<const Foo>::value), "");
+static_assert(( std::__is_referenceable<Foo &>::value), "");
+static_assert(( std::__is_referenceable<const Foo &>::value), "");
+#if TEST_STD_VER >= 11
+static_assert(( std::__is_referenceable<Foo &&>::value), "");
+static_assert(( std::__is_referenceable<const Foo &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<int __attribute__((__vector_size__( 8)))>::value), "");
+static_assert(( std::__is_referenceable<const int __attribute__((__vector_size__( 8)))>::value), "");
+static_assert(( std::__is_referenceable<float __attribute__((__vector_size__(16)))>::value), "");
+static_assert(( std::__is_referenceable<const float __attribute__((__vector_size__(16)))>::value), "");
+
+// Functions without cv-qualifiers are referenceable
+static_assert(( std::__is_referenceable<void ()>::value), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable<void () const>::value), "");
+static_assert((!std::__is_referenceable<void () &>::value), "");
+static_assert((!std::__is_referenceable<void () const &>::value), "");
+static_assert((!std::__is_referenceable<void () &&>::value), "");
+static_assert((!std::__is_referenceable<void () const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (int)>::value), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable<void (int) const>::value), "");
+static_assert((!std::__is_referenceable<void (int) &>::value), "");
+static_assert((!std::__is_referenceable<void (int) const &>::value), "");
+static_assert((!std::__is_referenceable<void (int) &&>::value), "");
+static_assert((!std::__is_referenceable<void (int) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (int, float)>::value), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable<void (int, float) const>::value), "");
+static_assert((!std::__is_referenceable<void (int, float) &>::value), "");
+static_assert((!std::__is_referenceable<void (int, float) const &>::value), "");
+static_assert((!std::__is_referenceable<void (int, float) &&>::value), "");
+static_assert((!std::__is_referenceable<void (int, float) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (int, float, Foo &)>::value), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable<void (int, float, Foo &) const>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, Foo &) &>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, Foo &) const &>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, Foo &) &&>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, Foo &) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (...)>::value), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable<void (...) const>::value), "");
+static_assert((!std::__is_referenceable<void (...) &>::value), "");
+static_assert((!std::__is_referenceable<void (...) const &>::value), "");
+static_assert((!std::__is_referenceable<void (...) &&>::value), "");
+static_assert((!std::__is_referenceable<void (...) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (int, ...)>::value), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable<void (int, ...) const>::value), "");
+static_assert((!std::__is_referenceable<void (int, ...) &>::value), "");
+static_assert((!std::__is_referenceable<void (int, ...) const &>::value), "");
+static_assert((!std::__is_referenceable<void (int, ...) &&>::value), "");
+static_assert((!std::__is_referenceable<void (int, ...) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (int, float, ...)>::value), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable<void (int, float, ...) const>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, ...) &>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, ...) const &>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, ...) &&>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, ...) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (int, float, Foo &, ...)>::value), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) const>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) &>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) const &>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) &&>::value), "");
+static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) const &&>::value), "");
+#endif
+
+// member functions with or without cv-qualifiers are referenceable
+static_assert(( std::__is_referenceable<void (Foo::*)()>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)() const>::value), "");
+#if TEST_STD_VER >= 11
+static_assert(( std::__is_referenceable<void (Foo::*)() &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)() const &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)() &&>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)() const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (Foo::*)(int)>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int) const>::value), "");
+#if TEST_STD_VER >= 11
+static_assert(( std::__is_referenceable<void (Foo::*)(int) &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int) const &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int) &&>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float)>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float) const>::value), "");
+#if TEST_STD_VER >= 11
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float) &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float) const &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float) &&>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &)>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) const>::value), "");
+#if TEST_STD_VER >= 11
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) const &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) &&>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (Foo::*)(...)>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(...) const>::value), "");
+#if TEST_STD_VER >= 11
+static_assert(( std::__is_referenceable<void (Foo::*)(...) &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(...) const &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(...) &&>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(...) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (Foo::*)(int, ...)>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) const>::value), "");
+#if TEST_STD_VER >= 11
+static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) const &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) &&>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...)>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) const>::value), "");
+#if TEST_STD_VER >= 11
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) const &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) &&>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) const &&>::value), "");
+#endif
+
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...)>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) const>::value), "");
+#if TEST_STD_VER >= 11
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) const &>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) &&>::value), "");
+static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) const &&>::value), "");
+#endif
+
+int main () {}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp
index 1c715e04970c..1c715e04970c 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp
+++ b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp
diff --git a/test/std/utilities/meta/version.pass.cpp b/test/libcxx/utilities/meta/version.pass.cpp
index 3a1033bbb560..3a1033bbb560 100644
--- a/test/std/utilities/meta/version.pass.cpp
+++ b/test/libcxx/utilities/meta/version.pass.cpp
diff --git a/test/std/utilities/ratio/version.pass.cpp b/test/libcxx/utilities/ratio/version.pass.cpp
index 26c455fb0a9a..26c455fb0a9a 100644
--- a/test/std/utilities/ratio/version.pass.cpp
+++ b/test/libcxx/utilities/ratio/version.pass.cpp
diff --git a/test/std/utilities/template.bitset/version.pass.cpp b/test/libcxx/utilities/template.bitset/version.pass.cpp
index 5ae984c0092d..5ae984c0092d 100644
--- a/test/std/utilities/template.bitset/version.pass.cpp
+++ b/test/libcxx/utilities/template.bitset/version.pass.cpp
diff --git a/test/std/utilities/time/version.pass.cpp b/test/libcxx/utilities/time/version.pass.cpp
index bfa3f6d6797d..bfa3f6d6797d 100644
--- a/test/std/utilities/time/version.pass.cpp
+++ b/test/libcxx/utilities/time/version.pass.cpp
diff --git a/test/std/utilities/tuple/version.pass.cpp b/test/libcxx/utilities/tuple/version.pass.cpp
index 2fdbb5d2784a..2fdbb5d2784a 100644
--- a/test/std/utilities/tuple/version.pass.cpp
+++ b/test/libcxx/utilities/tuple/version.pass.cpp
diff --git a/test/std/utilities/type.index/version.pass.cpp b/test/libcxx/utilities/type.index/version.pass.cpp
index 26f462042fd3..26f462042fd3 100644
--- a/test/std/utilities/type.index/version.pass.cpp
+++ b/test/libcxx/utilities/type.index/version.pass.cpp
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
new file mode 100644
index 000000000000..c012ac6265e0
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// Test that we properly provide the old non-trivial copy operations
+// when the ABI macro is defined.
+
+#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
+#include <utility>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
+struct Dummy {
+ Dummy(Dummy const&) = delete;
+ Dummy(Dummy &&) = default;
+};
+#endif
+
+int main()
+{
+ typedef std::pair<int, short> P;
+ {
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copyable<P>::value, "");
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copyable<P>::value, "");
+ }
+ {
+ using P1 = std::pair<Dummy, int>;
+ // These lines fail because the non-trivial constructors do not provide
+ // SFINAE.
+ // static_assert(!std::is_copy_constructible<P1>::value, "");
+ // static_assert(!std::is_trivially_copy_constructible<P1>::value, "");
+ static_assert(std::is_move_constructible<P1>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P1>::value, "");
+ static_assert(!std::is_trivially_copyable<P>::value, "");
+ }
+#endif
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
new file mode 100644
index 000000000000..ec9cc7ec3e02
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
@@ -0,0 +1,147 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// The test fails due to the missing is_trivially_constructible intrinsic.
+// XFAIL: gcc-4.9
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// Test that we properly provide the trivial copy operations by default.
+
+// FreeBSD provides the old ABI. This test checks the new ABI so we need
+// to manually turn it on.
+#if defined(__FreeBSD__)
+#define _LIBCPP_ABI_UNSTABLE
+#endif
+
+#include <utility>
+#include <type_traits>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#error Non-trivial ctor ABI macro defined
+#endif
+
+template <class T>
+struct HasTrivialABI : std::integral_constant<bool,
+ std::is_trivially_destructible<T>::value
+ && (!std::is_copy_constructible<T>::value || std::is_trivially_copy_constructible<T>::value)
+#if TEST_STD_VER >= 11
+ && (!std::is_move_constructible<T>::value || std::is_trivially_move_constructible<T>::value)
+#endif
+> {};
+
+#if TEST_STD_VER >= 11
+struct NonTrivialDtor {
+ NonTrivialDtor(NonTrivialDtor const&) = default;
+ ~NonTrivialDtor();
+};
+NonTrivialDtor::~NonTrivialDtor() {}
+static_assert(!HasTrivialABI<NonTrivialDtor>::value, "");
+
+struct NonTrivialCopy {
+ NonTrivialCopy(NonTrivialCopy const&);
+};
+NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {}
+static_assert(!HasTrivialABI<NonTrivialCopy>::value, "");
+
+struct NonTrivialMove {
+ NonTrivialMove(NonTrivialMove const&) = default;
+ NonTrivialMove(NonTrivialMove&&);
+};
+NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {}
+static_assert(!HasTrivialABI<NonTrivialMove>::value, "");
+
+struct DeletedCopy {
+ DeletedCopy(DeletedCopy const&) = delete;
+ DeletedCopy(DeletedCopy&&) = default;
+};
+static_assert(HasTrivialABI<DeletedCopy>::value, "");
+
+struct TrivialMove {
+ TrivialMove(TrivialMove &&) = default;
+};
+static_assert(HasTrivialABI<TrivialMove>::value, "");
+
+struct Trivial {
+ Trivial(Trivial const&) = default;
+};
+static_assert(HasTrivialABI<Trivial>::value, "");
+#endif
+
+
+int main()
+{
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialDtor, int>;
+ static_assert(!std::is_trivially_destructible<P>::value, "");
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialCopy, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialMove, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<DeletedCopy, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<Trivial, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<TrivialMove, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+#endif
+}
diff --git a/test/std/utilities/utility/version.pass.cpp b/test/libcxx/utilities/utility/version.pass.cpp
index 77d145d94457..77d145d94457 100644
--- a/test/std/utilities/utility/version.pass.cpp
+++ b/test/libcxx/utilities/utility/version.pass.cpp
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index fa25834d1110..a1ae90cb479e 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -5,6 +5,8 @@ config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@"
config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@"
config.cxx_library_root = "@LIBCXX_LIBRARY_DIR@"
config.enable_exceptions = "@LIBCXX_ENABLE_EXCEPTIONS@"
+config.enable_experimental = "@LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY@"
+config.enable_filesystem = "@LIBCXX_ENABLE_FILESYSTEM@"
config.enable_rtti = "@LIBCXX_ENABLE_RTTI@"
config.enable_shared = "@LIBCXX_ENABLE_SHARED@"
config.enable_32bit = "@LIBCXX_BUILD_32_BITS@"
@@ -20,6 +22,10 @@ config.generate_coverage = "@LIBCXX_GENERATE_COVERAGE@"
config.target_info = "@LIBCXX_TARGET_INFO@"
config.executor = "@LIBCXX_EXECUTOR@"
config.llvm_unwinder = "@LIBCXXABI_USE_LLVM_UNWINDER@"
+config.has_libatomic = "@LIBCXX_HAS_ATOMIC_LIB@"
+config.use_libatomic = "@LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@"
+
+config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
# Let the main config do the real work.
lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
diff --git a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
index 6617cd0916f3..b56d31b9d0db 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
@@ -62,7 +62,7 @@ test_int_array()
struct source {
source() : i(0) { }
-
+
operator int() const { return i++; }
mutable int i;
};
diff --git a/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp
index 234879149ae3..449753fc263a 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp
@@ -61,6 +61,6 @@ int main()
random_access_iterator<const int*>(ia+s),
random_access_iterator<const int*>(ia),
random_access_iterator<const int*>(ia+s-1)));
-
+
#endif
}
diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
index 3e1dfd17c3ff..054bc656cdb1 100644
--- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
@@ -33,7 +33,7 @@ int main()
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in c++11
-
+
typedef input_iterator<const int*> II;
typedef random_access_iterator<const int*> RAI;
typedef std::equal_to<int> EQ;
@@ -48,7 +48,7 @@ int main()
== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
assert(bcp.count() > 0 && bcp.count() < sa);
bcp.reset();
-
+
#ifdef HAS_FOUR_ITERATOR_VERSION
assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib + sb), EQ())
== (std::pair<II, II>(II(ia+3), II(ib+3))));
diff --git a/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp
new file mode 100644
index 000000000000..3fec12b6b53d
--- /dev/null
+++ b/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp
@@ -0,0 +1,127 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+// XFAIL: c++98, c++03, c++11, c++14
+
+// template<class T, class Compare>
+// const T&
+// clamp(const T& v, const T& lo, const T& hi, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+struct Tag {
+ Tag() : val(0), tag("Default") {}
+ Tag(int a, const char *b) : val(a), tag(b) {}
+ ~Tag() {}
+
+ int val;
+ const char *tag;
+ };
+
+bool eq(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val && rhs.tag == lhs.tag; }
+// bool operator==(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val; }
+bool comp (const Tag& rhs, const Tag& lhs) { return rhs.val < lhs.val; }
+
+
+template <class T, class C>
+void
+test(const T& v, const T& lo, const T& hi, C c, const T& x)
+{
+ assert(&std::clamp(v, lo, hi, c) == &x);
+}
+
+int main()
+{
+ {
+ int x = 0;
+ int y = 0;
+ int z = 0;
+ test(x, y, z, std::greater<int>(), x);
+ test(y, x, z, std::greater<int>(), y);
+ }
+ {
+ int x = 0;
+ int y = 1;
+ int z = -1;
+ test(x, y, z, std::greater<int>(), x);
+ test(y, x, z, std::greater<int>(), x);
+ }
+ {
+ int x = 1;
+ int y = 0;
+ int z = 0;
+ test(x, y, z, std::greater<int>(), y);
+ test(y, x, z, std::greater<int>(), y);
+ }
+
+ {
+// If they're all the same, we should get the value back.
+ Tag x{0, "Zero-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{0, "Zero-z"};
+ assert(eq(std::clamp(x, y, z, comp), x));
+ assert(eq(std::clamp(y, x, z, comp), y));
+ }
+
+ {
+// If it's the same as the lower bound, we get the value back.
+ Tag x{0, "Zero-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{1, "One-z"};
+ assert(eq(std::clamp(x, y, z, comp), x));
+ assert(eq(std::clamp(y, x, z, comp), y));
+ }
+
+ {
+// If it's the same as the upper bound, we get the value back.
+ Tag x{1, "One-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{1, "One-z"};
+ assert(eq(std::clamp(x, y, z, comp), x));
+ assert(eq(std::clamp(z, y, x, comp), z));
+ }
+
+ {
+// If the value is between, we should get the value back
+ Tag x{1, "One-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{2, "Two-z"};
+ assert(eq(std::clamp(x, y, z, comp), x));
+ assert(eq(std::clamp(y, x, z, comp), x));
+ }
+
+ {
+// If the value is less than the 'lo', we should get the lo back.
+ Tag x{0, "Zero-x"};
+ Tag y{1, "One-y"};
+ Tag z{2, "Two-z"};
+ assert(eq(std::clamp(x, y, z, comp), y));
+ assert(eq(std::clamp(y, x, z, comp), y));
+ }
+ {
+// If the value is greater than 'hi', we should get hi back.
+ Tag x{2, "Two-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{1, "One-z"};
+ assert(eq(std::clamp(x, y, z, comp), z));
+ assert(eq(std::clamp(y, z, x, comp), z));
+ }
+
+ {
+ typedef int T;
+ constexpr T x = 1;
+ constexpr T y = 0;
+ constexpr T z = 0;
+ static_assert(std::clamp(x, y, z, std::greater<T>()) == y, "" );
+ static_assert(std::clamp(y, x, z, std::greater<T>()) == y, "" );
+ }
+}
diff --git a/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp b/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
new file mode 100644
index 000000000000..779c41827c92
--- /dev/null
+++ b/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
@@ -0,0 +1,125 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+// XFAIL: c++98, c++03, c++11, c++14
+
+// template<class T>
+// const T&
+// clamp(const T& v, const T& lo, const T& hi);
+
+#include <algorithm>
+#include <cassert>
+
+struct Tag {
+ Tag() : val(0), tag("Default") {}
+ Tag(int a, const char *b) : val(a), tag(b) {}
+ ~Tag() {}
+
+ int val;
+ const char *tag;
+ };
+
+bool eq(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val && rhs.tag == lhs.tag; }
+// bool operator==(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val; }
+bool operator< (const Tag& rhs, const Tag& lhs) { return rhs.val < lhs.val; }
+
+template <class T>
+void
+test(const T& a, const T& lo, const T& hi, const T& x)
+{
+ assert(&std::clamp(a, lo, hi) == &x);
+}
+
+int main()
+{
+ {
+ int x = 0;
+ int y = 0;
+ int z = 0;
+ test(x, y, z, x);
+ test(y, x, z, y);
+ }
+ {
+ int x = 0;
+ int y = 1;
+ int z = 2;
+ test(x, y, z, y);
+ test(y, x, z, y);
+ }
+ {
+ int x = 1;
+ int y = 0;
+ int z = 1;
+ test(x, y, z, x);
+ test(y, x, z, x);
+ }
+
+ {
+// If they're all the same, we should get the value back.
+ Tag x{0, "Zero-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{0, "Zero-z"};
+ assert(eq(std::clamp(x, y, z), x));
+ assert(eq(std::clamp(y, x, z), y));
+ }
+
+ {
+// If it's the same as the lower bound, we get the value back.
+ Tag x{0, "Zero-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{1, "One-z"};
+ assert(eq(std::clamp(x, y, z), x));
+ assert(eq(std::clamp(y, x, z), y));
+ }
+
+ {
+// If it's the same as the upper bound, we get the value back.
+ Tag x{1, "One-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{1, "One-z"};
+ assert(eq(std::clamp(x, y, z), x));
+ assert(eq(std::clamp(z, y, x), z));
+ }
+
+ {
+// If the value is between, we should get the value back
+ Tag x{1, "One-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{2, "Two-z"};
+ assert(eq(std::clamp(x, y, z), x));
+ assert(eq(std::clamp(y, x, z), x));
+ }
+
+ {
+// If the value is less than the 'lo', we should get the lo back.
+ Tag x{0, "Zero-x"};
+ Tag y{1, "One-y"};
+ Tag z{2, "Two-z"};
+ assert(eq(std::clamp(x, y, z), y));
+ assert(eq(std::clamp(y, x, z), y));
+ }
+ {
+// If the value is greater than 'hi', we should get hi back.
+ Tag x{2, "Two-x"};
+ Tag y{0, "Zero-y"};
+ Tag z{1, "One-z"};
+ assert(eq(std::clamp(x, y, z), z));
+ assert(eq(std::clamp(y, z, x), z));
+ }
+
+ {
+ typedef int T;
+ constexpr T x = 1;
+ constexpr T y = 0;
+ constexpr T z = 1;
+ static_assert(std::clamp(x, y, z) == x, "" );
+ static_assert(std::clamp(y, x, z) == x, "" );
+ }
+}
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
index 4cde1a7d32eb..0e16d9bd17c7 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
@@ -69,7 +69,7 @@ void test(unsigned N)
std::random_shuffle(ia, ia+N);
std::make_heap(ia, ia+N, std::ref(pred));
assert(pred.count() <= 3*N);
- assert(std::is_heap(ia, ia+N, pred));
+ assert(std::is_heap(ia, ia+N, pred));
}
delete [] ia;
diff --git a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
index 829157353fb3..9c411730196c 100644
--- a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
@@ -24,20 +24,20 @@
struct S {
S() : i_(0) {}
S(int i) : i_(i) {}
-
+
S(const S& rhs) : i_(rhs.i_) {}
S( S&& rhs) : i_(rhs.i_) { rhs.i_ = -1; }
-
+
S& operator =(const S& rhs) { i_ = rhs.i_; return *this; }
S& operator =( S&& rhs) { i_ = rhs.i_; rhs.i_ = -2; assert(this != &rhs); return *this; }
S& operator =(int i) { i_ = i; return *this; }
-
+
bool operator <(const S& rhs) const { return i_ < rhs.i_; }
bool operator ==(const S& rhs) const { return i_ == rhs.i_; }
bool operator ==(int i) const { return i_ == i; }
void set(int i) { i_ = i; }
-
+
int i_;
};
#endif
diff --git a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
index ca6f8e40cbd3..b4d25a93e50e 100644
--- a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
@@ -34,21 +34,21 @@ struct indirect_less
struct S {
S() : i_(0) {}
S(int i) : i_(i) {}
-
+
S(const S& rhs) : i_(rhs.i_) {}
S( S&& rhs) : i_(rhs.i_) { rhs.i_ = -1; }
-
+
S& operator =(const S& rhs) { i_ = rhs.i_; return *this; }
S& operator =( S&& rhs) { i_ = rhs.i_; rhs.i_ = -2; assert(this != &rhs); return *this; }
S& operator =(int i) { i_ = i; return *this; }
-
+
bool operator <(const S& rhs) const { return i_ < rhs.i_; }
bool operator >(const S& rhs) const { return i_ > rhs.i_; }
bool operator ==(const S& rhs) const { return i_ == rhs.i_; }
bool operator ==(int i) const { return i_ == i; }
void set(int i) { i_ = i; }
-
+
int i_;
};
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp
index 2197b97d7f2a..3ecc250a9c8f 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp
@@ -57,13 +57,13 @@ test()
test<Iter>(1000);
}
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 };
#endif
void constexpr_test()
{
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr auto p = std::max_element(il,il+8);
static_assert ( *p == 8, "" );
#endif
@@ -75,6 +75,6 @@ int main()
test<bidirectional_iterator<const int*> >();
test<random_access_iterator<const int*> >();
test<const int*>();
-
+
constexpr_test ();
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
index 37c181393aa6..fc88268aa84b 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
@@ -75,14 +75,14 @@ void test_eq()
delete [] a;
}
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 };
struct less { constexpr bool operator ()( const int &x, const int &y) const { return x < y; }};
#endif
void constexpr_test()
{
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr auto p = std::max_element(il, il+8, less());
static_assert ( *p == 8, "" );
#endif
@@ -95,6 +95,6 @@ int main()
test<random_access_iterator<const int*> >();
test<const int*>();
test_eq();
-
+
constexpr_test();
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp
index a9a9d61340f9..45dd54b1ee40 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp
@@ -57,13 +57,13 @@ test()
test<Iter>(1000);
}
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 };
#endif
void constexpr_test()
{
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr auto p = std::min_element(il, il+8);
static_assert ( *p == 1, "" );
#endif
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
index 9517f7eac945..94ef482ddbde 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
@@ -75,14 +75,14 @@ void test_eq()
delete [] a;
}
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 };
struct less { constexpr bool operator ()( const int &x, const int &y) const { return x < y; }};
#endif
void constexpr_test()
{
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr auto p = std::min_element(il, il+8, less());
static_assert(*p == 1, "");
#endif
@@ -95,6 +95,6 @@ int main()
test<random_access_iterator<const int*> >();
test<const int*>();
test_eq();
-
+
constexpr_test();
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp
index 6ac972a2547b..8276c3a5dfd5 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp
@@ -47,7 +47,7 @@ int main()
}
#if _LIBCPP_STD_VER > 11
{
-// Note that you can't take a reference to a local var, since
+// Note that you can't take a reference to a local var, since
// its address is not a compile-time constant.
constexpr static int x = 1;
constexpr static int y = 0;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp
index 771c8f84a740..3289f8a7582c 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp
@@ -50,7 +50,7 @@ int main()
}
#if _LIBCPP_STD_VER > 11
{
-// Note that you can't take a reference to a local var, since
+// Note that you can't take a reference to a local var, since
// its address is not a compile-time constant.
constexpr static int x = 1;
constexpr static int y = 0;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
index 915b1d176ab4..ef5474091db5 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
@@ -74,13 +74,13 @@ test()
}
}
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 };
#endif
void constexpr_test()
{
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr auto p = std::minmax_element(il, il+8);
static_assert ( *(p.first) == 1, "" );
static_assert ( *(p.second) == 8, "" );
@@ -93,6 +93,6 @@ int main()
test<bidirectional_iterator<const int*> >();
test<random_access_iterator<const int*> >();
test<const int*>();
-
+
constexpr_test();
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
index d3a067fda3c5..3a0c2dbbba1b 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
@@ -79,14 +79,14 @@ test()
}
}
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 };
struct less { constexpr bool operator ()( const int &x, const int &y) const { return x < y; }};
#endif
void constexpr_test()
{
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
constexpr auto p = std::minmax_element(il, il+8, less());
static_assert ( *(p.first) == 1, "" );
static_assert ( *(p.second) == 8, "" );
@@ -99,6 +99,6 @@ int main()
test<bidirectional_iterator<const int*> >();
test<random_access_iterator<const int*> >();
test<const int*>();
-
+
constexpr_test();
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
index a66b2ff27cb0..789ccef0fca4 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
@@ -21,7 +21,7 @@
#include "counting_predicates.hpp"
-bool all_equal(int a, int b) { return false; } // everything is equal
+bool all_equal(int, int) { return false; } // everything is equal
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void test_all_equal(std::initializer_list<int> il)
diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
index 7bb43461cba4..62458eca9302 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
@@ -22,13 +22,17 @@ void
test_larger_sorts(unsigned N, unsigned M)
{
assert(N != 0);
+ assert(N >= M);
int* array = new int[N];
for (int i = 0; i < N; ++i)
array[i] = i;
std::random_shuffle(array, array+N);
std::partial_sort(array, array+M, array+N);
for (int i = 0; i < M; ++i)
+ {
+ assert(i < N); // quiet analysis warnings
assert(array[i] == i);
+ }
delete [] array;
}
diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
index d822f6c388c1..0289cf8391f9 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
@@ -35,13 +35,17 @@ void
test_larger_sorts(unsigned N, unsigned M)
{
assert(N != 0);
+ assert(N >= M);
int* array = new int[N];
for (int i = 0; i < N; ++i)
array[i] = i;
std::random_shuffle(array, array+N);
std::partial_sort(array, array+M, array+N, std::greater<int>());
for (int i = 0; i < M; ++i)
+ {
+ assert(i < N); // quiet analysis warnings
assert(array[i] == N-i-1);
+ }
delete [] array;
}
@@ -62,6 +66,7 @@ test_larger_sorts(unsigned N)
int main()
{
+ {
int i = 0;
std::partial_sort(&i, &i, &i);
assert(i == 0);
@@ -73,6 +78,7 @@ int main()
test_larger_sorts(997);
test_larger_sorts(1000);
test_larger_sorts(1009);
+ }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
diff --git a/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp b/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
index 3a74e13faf19..22bbbd6af535 100644
--- a/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
+++ b/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
@@ -22,13 +22,15 @@
int main()
{
{
- std::atomic_flag f(false);
+ std::atomic_flag f;
+ f.clear();
f.test_and_set();
atomic_flag_clear(&f);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
+ volatile std::atomic_flag f;
+ f.clear();
f.test_and_set();
atomic_flag_clear(&f);
assert(f.test_and_set() == 0);
diff --git a/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp b/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
index 0467384455cc..1a212c6f352a 100644
--- a/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
+++ b/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
@@ -22,38 +22,44 @@
int main()
{
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f; // uninitialized first
+ atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
+ assert(f.test_and_set() == 0);
atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f;
+ atomic_flag_clear_explicit(&f, std::memory_order_release);
+ assert(f.test_and_set() == 0);
atomic_flag_clear_explicit(&f, std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f;
+ atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
+ assert(f.test_and_set() == 0);
atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
+ assert(f.test_and_set() == 0);
atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ atomic_flag_clear_explicit(&f, std::memory_order_release);
+ assert(f.test_and_set() == 0);
atomic_flag_clear_explicit(&f, std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
+ assert(f.test_and_set() == 0);
atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
}
diff --git a/test/std/atomics/atomics.flag/clear.pass.cpp b/test/std/atomics/atomics.flag/clear.pass.cpp
index ea5ae45ae99a..255af8f176ea 100644
--- a/test/std/atomics/atomics.flag/clear.pass.cpp
+++ b/test/std/atomics/atomics.flag/clear.pass.cpp
@@ -22,50 +22,58 @@
int main()
{
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f; // uninitialized
+ f.clear();
+ assert(f.test_and_set() == 0);
f.clear();
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f;
+ f.clear(std::memory_order_relaxed);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f;
+ f.clear(std::memory_order_release);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f;
+ f.clear(std::memory_order_seq_cst);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ f.clear();
+ assert(f.test_and_set() == 0);
f.clear();
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ f.clear(std::memory_order_relaxed);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ f.clear(std::memory_order_release);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ f.clear(std::memory_order_seq_cst);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
}
diff --git a/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp b/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
new file mode 100644
index 000000000000..e42e9f28448a
--- /dev/null
+++ b/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03, c++11, c++14
+
+// <atomic>
+
+// static constexpr bool is_always_lock_free;
+
+#include <atomic>
+#include <cassert>
+
+#if !defined(__cpp_lib_atomic_is_always_lock_free)
+# error Feature test macro missing.
+#endif
+
+template <typename T> void checkAlwaysLockFree() {
+ if (std::atomic<T>::is_always_lock_free)
+ assert(std::atomic<T>().is_lock_free());
+}
+
+int main()
+{
+// structs and unions can't be defined in the template invocation.
+// Work around this with a typedef.
+#define CHECK_ALWAYS_LOCK_FREE(T) \
+ do { \
+ typedef T type; \
+ checkAlwaysLockFree<type>(); \
+ } while (0)
+
+ CHECK_ALWAYS_LOCK_FREE(bool);
+ CHECK_ALWAYS_LOCK_FREE(char);
+ CHECK_ALWAYS_LOCK_FREE(signed char);
+ CHECK_ALWAYS_LOCK_FREE(unsigned char);
+ CHECK_ALWAYS_LOCK_FREE(char16_t);
+ CHECK_ALWAYS_LOCK_FREE(char32_t);
+ CHECK_ALWAYS_LOCK_FREE(wchar_t);
+ CHECK_ALWAYS_LOCK_FREE(short);
+ CHECK_ALWAYS_LOCK_FREE(unsigned short);
+ CHECK_ALWAYS_LOCK_FREE(int);
+ CHECK_ALWAYS_LOCK_FREE(unsigned int);
+ CHECK_ALWAYS_LOCK_FREE(long);
+ CHECK_ALWAYS_LOCK_FREE(unsigned long);
+ CHECK_ALWAYS_LOCK_FREE(long long);
+ CHECK_ALWAYS_LOCK_FREE(unsigned long long);
+ CHECK_ALWAYS_LOCK_FREE(std::nullptr_t);
+ CHECK_ALWAYS_LOCK_FREE(void*);
+ CHECK_ALWAYS_LOCK_FREE(float);
+ CHECK_ALWAYS_LOCK_FREE(double);
+ CHECK_ALWAYS_LOCK_FREE(long double);
+ CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(1 * sizeof(int)))));
+ CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(2 * sizeof(int)))));
+ CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(4 * sizeof(int)))));
+ CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(16 * sizeof(int)))));
+ CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(32 * sizeof(int)))));
+ CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(1 * sizeof(float)))));
+ CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(2 * sizeof(float)))));
+ CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(4 * sizeof(float)))));
+ CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(16 * sizeof(float)))));
+ CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(32 * sizeof(float)))));
+ CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(1 * sizeof(double)))));
+ CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(2 * sizeof(double)))));
+ CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(4 * sizeof(double)))));
+ CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(16 * sizeof(double)))));
+ CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(32 * sizeof(double)))));
+ CHECK_ALWAYS_LOCK_FREE(struct Empty {});
+ CHECK_ALWAYS_LOCK_FREE(struct OneInt { int i; });
+ CHECK_ALWAYS_LOCK_FREE(struct IntArr2 { int i[2]; });
+ CHECK_ALWAYS_LOCK_FREE(struct LLIArr2 { long long int i[2]; });
+ CHECK_ALWAYS_LOCK_FREE(struct LLIArr4 { long long int i[4]; });
+ CHECK_ALWAYS_LOCK_FREE(struct LLIArr8 { long long int i[8]; });
+ CHECK_ALWAYS_LOCK_FREE(struct LLIArr16 { long long int i[16]; });
+ CHECK_ALWAYS_LOCK_FREE(struct Padding { char c; /* padding */ long long int i; });
+ CHECK_ALWAYS_LOCK_FREE(union IntFloat { int i; float f; });
+
+ // C macro and static constexpr must be consistent.
+ static_assert(std::atomic<bool>::is_always_lock_free == (2 == ATOMIC_BOOL_LOCK_FREE));
+ static_assert(std::atomic<char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE));
+ static_assert(std::atomic<signed char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE));
+ static_assert(std::atomic<unsigned char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE));
+ static_assert(std::atomic<char16_t>::is_always_lock_free == (2 == ATOMIC_CHAR16_T_LOCK_FREE));
+ static_assert(std::atomic<char32_t>::is_always_lock_free == (2 == ATOMIC_CHAR32_T_LOCK_FREE));
+ static_assert(std::atomic<wchar_t>::is_always_lock_free == (2 == ATOMIC_WCHAR_T_LOCK_FREE));
+ static_assert(std::atomic<short>::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE));
+ static_assert(std::atomic<unsigned short>::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE));
+ static_assert(std::atomic<int>::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE));
+ static_assert(std::atomic<unsigned int>::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE));
+ static_assert(std::atomic<long>::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE));
+ static_assert(std::atomic<unsigned long>::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE));
+ static_assert(std::atomic<long long>::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE));
+ static_assert(std::atomic<unsigned long long>::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE));
+ static_assert(std::atomic<void*>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE));
+ static_assert(std::atomic<std::nullptr_t>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE));
+}
diff --git a/test/std/atomics/atomics.lockfree/lockfree.pass.cpp b/test/std/atomics/atomics.lockfree/lockfree.pass.cpp
index a975a69a66ff..0ace9cfe7ba3 100644
--- a/test/std/atomics/atomics.lockfree/lockfree.pass.cpp
+++ b/test/std/atomics/atomics.lockfree/lockfree.pass.cpp
@@ -11,6 +11,7 @@
// <atomic>
+// #define ATOMIC_BOOL_LOCK_FREE unspecified
// #define ATOMIC_CHAR_LOCK_FREE unspecified
// #define ATOMIC_CHAR16_T_LOCK_FREE unspecified
// #define ATOMIC_CHAR32_T_LOCK_FREE unspecified
@@ -19,12 +20,16 @@
// #define ATOMIC_INT_LOCK_FREE unspecified
// #define ATOMIC_LONG_LOCK_FREE unspecified
// #define ATOMIC_LLONG_LOCK_FREE unspecified
+// #define ATOMIC_POINTER_LOCK_FREE unspecified
#include <atomic>
#include <cassert>
int main()
{
+ assert(ATOMIC_BOOL_LOCK_FREE == 0 ||
+ ATOMIC_BOOL_LOCK_FREE == 1 ||
+ ATOMIC_BOOL_LOCK_FREE == 2);
assert(ATOMIC_CHAR_LOCK_FREE == 0 ||
ATOMIC_CHAR_LOCK_FREE == 1 ||
ATOMIC_CHAR_LOCK_FREE == 2);
@@ -49,4 +54,7 @@ int main()
assert(ATOMIC_LLONG_LOCK_FREE == 0 ||
ATOMIC_LLONG_LOCK_FREE == 1 ||
ATOMIC_LLONG_LOCK_FREE == 2);
+ assert(ATOMIC_POINTER_LOCK_FREE == 0 ||
+ ATOMIC_POINTER_LOCK_FREE == 1 ||
+ ATOMIC_POINTER_LOCK_FREE == 2);
}
diff --git a/test/std/atomics/atomics.types.generic/address.pass.cpp b/test/std/atomics/atomics.types.generic/address.pass.cpp
index eceac25c9d94..137e46b6a155 100644
--- a/test/std/atomics/atomics.types.generic/address.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/address.pass.cpp
@@ -45,13 +45,13 @@
// T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst);
// T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile;
// T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst);
-//
+//
// atomic() = default;
// constexpr atomic(T* desr);
// atomic(const atomic&) = delete;
// atomic& operator=(const atomic&) = delete;
// atomic& operator=(const atomic&) volatile = delete;
-//
+//
// T* operator=(T*) volatile;
// T* operator=(T*);
// T* operator++(int) volatile;
@@ -122,8 +122,8 @@ do_test()
{
_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23};
- A& zero = *new (storage) A();
- assert(zero == 0);
+ A& zero = *new (storage) A();
+ assert(zero == T(0));
zero.~A();
}
}
diff --git a/test/std/atomics/atomics.types.generic/bool.pass.cpp b/test/std/atomics/atomics.types.generic/bool.pass.cpp
index 8eb04ee577cf..e85893d12b8d 100644
--- a/test/std/atomics/atomics.types.generic/bool.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/bool.pass.cpp
@@ -39,7 +39,7 @@
// memory_order m = memory_order_seq_cst) volatile;
// bool compare_exchange_strong(T& expc, T desr,
// memory_order m = memory_order_seq_cst);
-//
+//
// atomic() = default;
// constexpr atomic(T desr);
// atomic(const atomic&) = delete;
@@ -227,7 +227,7 @@ int main()
{
typedef std::atomic<bool> A;
_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1};
- A& zero = *new (storage) A();
+ A& zero = *new (storage) A();
assert(zero == false);
zero.~A();
}
diff --git a/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp b/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
index a7874b9f5af4..714fbdc3926b 100644
--- a/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
@@ -19,7 +19,7 @@
// typedef atomic<uint_least32_t> atomic_uint_least32_t;
// typedef atomic<int_least64_t> atomic_int_least64_t;
// typedef atomic<uint_least64_t> atomic_uint_least64_t;
-//
+//
// typedef atomic<int_fast8_t> atomic_int_fast8_t;
// typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
// typedef atomic<int_fast16_t> atomic_int_fast16_t;
@@ -28,7 +28,7 @@
// typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
// typedef atomic<int_fast64_t> atomic_int_fast64_t;
// typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
-//
+//
// typedef atomic<intptr_t> atomic_intptr_t;
// typedef atomic<uintptr_t> atomic_uintptr_t;
// typedef atomic<size_t> atomic_size_t;
diff --git a/test/std/atomics/atomics.types.generic/integral.pass.cpp b/test/std/atomics/atomics.types.generic/integral.pass.cpp
index 802a37c30a93..a449dc6d5f57 100644
--- a/test/std/atomics/atomics.types.generic/integral.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/integral.pass.cpp
@@ -41,7 +41,7 @@
// memory_order m = memory_order_seq_cst) volatile;
// bool compare_exchange_strong(integral& expc, integral desr,
// memory_order m = memory_order_seq_cst);
-//
+//
// integral
// fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile;
// integral fetch_add(integral op, memory_order m = memory_order_seq_cst);
@@ -57,7 +57,7 @@
// integral
// fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile;
// integral fetch_xor(integral op, memory_order m = memory_order_seq_cst);
-//
+//
// atomic() = default;
// constexpr atomic(integral desr);
// atomic(const atomic&) = delete;
@@ -65,7 +65,7 @@
// atomic& operator=(const atomic&) volatile = delete;
// integral operator=(integral desr) volatile;
// integral operator=(integral desr);
-//
+//
// integral operator++(int) volatile;
// integral operator++(int);
// integral operator--(int) volatile;
@@ -152,7 +152,7 @@ do_test()
{
_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23};
- A& zero = *new (storage) A();
+ A& zero = *new (storage) A();
assert(zero == 0);
zero.~A();
}
@@ -185,6 +185,15 @@ int main()
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<std::atomic_wchar_t, wchar_t>();
+ test<std::atomic_int8_t, int8_t>();
+ test<std::atomic_uint8_t, uint8_t>();
+ test<std::atomic_int16_t, int16_t>();
+ test<std::atomic_uint16_t, uint16_t>();
+ test<std::atomic_int32_t, int32_t>();
+ test<std::atomic_uint32_t, uint32_t>();
+ test<std::atomic_int64_t, int64_t>();
+ test<std::atomic_uint64_t, uint64_t>();
+
test<volatile std::atomic_char, char>();
test<volatile std::atomic_schar, signed char>();
test<volatile std::atomic_uchar, unsigned char>();
@@ -201,4 +210,13 @@ int main()
test<volatile std::atomic_char32_t, char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<volatile std::atomic_wchar_t, wchar_t>();
+
+ test<volatile std::atomic_int8_t, int8_t>();
+ test<volatile std::atomic_uint8_t, uint8_t>();
+ test<volatile std::atomic_int16_t, int16_t>();
+ test<volatile std::atomic_uint16_t, uint16_t>();
+ test<volatile std::atomic_int32_t, int32_t>();
+ test<volatile std::atomic_uint32_t, uint32_t>();
+ test<volatile std::atomic_int64_t, int64_t>();
+ test<volatile std::atomic_uint64_t, uint64_t>();
}
diff --git a/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp b/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp
index e8fae85fb4b3..e4deae1bf0d5 100644
--- a/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp
@@ -25,6 +25,18 @@
// typedef atomic<char16_t> atomic_char16_t;
// typedef atomic<char32_t> atomic_char32_t;
// typedef atomic<wchar_t> atomic_wchar_t;
+//
+// typedef atomic<intptr_t> atomic_intptr_t;
+// typedef atomic<uintptr_t> atomic_uintptr_t;
+//
+// typedef atomic<int8_t> atomic_int8_t;
+// typedef atomic<uint8_t> atomic_uint8_t;
+// typedef atomic<int16_t> atomic_int16_t;
+// typedef atomic<uint16_t> atomic_uint16_t;
+// typedef atomic<int32_t> atomic_int32_t;
+// typedef atomic<uint32_t> atomic_uint32_t;
+// typedef atomic<int64_t> atomic_int64_t;
+// typedef atomic<uint64_t> atomic_uint64_t;
#include <atomic>
#include <type_traits>
@@ -47,4 +59,17 @@ int main()
static_assert((std::is_same<std::atomic<char16_t>, std::atomic_char16_t>::value), "");
static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "");
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+
+// Added by LWG 2441
+ static_assert((std::is_same<std::atomic<intptr_t>, std::atomic_intptr_t>::value), "");
+ static_assert((std::is_same<std::atomic<uintptr_t>, std::atomic_uintptr_t>::value), "");
+
+ static_assert((std::is_same<std::atomic<int8_t>, std::atomic_int8_t>::value), "");
+ static_assert((std::is_same<std::atomic<uint8_t>, std::atomic_uint8_t>::value), "");
+ static_assert((std::is_same<std::atomic<int16_t>, std::atomic_int16_t>::value), "");
+ static_assert((std::is_same<std::atomic<uint16_t>, std::atomic_uint16_t>::value), "");
+ static_assert((std::is_same<std::atomic<int32_t>, std::atomic_int32_t>::value), "");
+ static_assert((std::is_same<std::atomic<uint32_t>, std::atomic_uint32_t>::value), "");
+ static_assert((std::is_same<std::atomic<int64_t>, std::atomic_int64_t>::value), "");
+ static_assert((std::is_same<std::atomic<uint64_t>, std::atomic_uint64_t>::value), "");
}
diff --git a/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp b/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp
index d940980e32f0..1309f3f1b78b 100644
--- a/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp
+++ b/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp
@@ -37,7 +37,7 @@
// memory_order m = memory_order_seq_cst) volatile noexcept;
// bool compare_exchange_strong(T& expc, T desr,
// memory_order m = memory_order_seq_cst) noexcept;
-//
+//
// atomic() noexcept = default;
// constexpr atomic(T desr) noexcept;
// atomic(const atomic&) = delete;
diff --git a/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp b/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp
index 5b094f0a89c1..622643f216bd 100644
--- a/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp
@@ -43,7 +43,7 @@
// memory_order m = memory_order_seq_cst) volatile noexcept;
// bool compare_exchange_strong(T& expc, T desr,
// memory_order m = memory_order_seq_cst) noexcept;
-//
+//
// atomic() noexcept = default;
// constexpr atomic(T desr) noexcept;
// atomic(const atomic&) = delete;
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
index 7b221dc6eff8..e40979f45a8f 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
@@ -15,7 +15,7 @@
// template <class T>
// bool
// atomic_compare_exchange_strong(volatile atomic<T>* obj, T* expc, T desr);
-//
+//
// template <class T>
// bool
// atomic_compare_exchange_strong(atomic<T>* obj, T* expc, T desr);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
index 27de5bec4928..8ac8fc0c2d0f 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
@@ -17,7 +17,7 @@
// atomic_compare_exchange_strong_explicit(volatile atomic<T>* obj, T* expc,
// T desr,
// memory_order s, memory_order f);
-//
+//
// template <class T>
// bool
// atomic_compare_exchange_strong_explicit(atomic<T>* obj, T* expc, T desr,
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
index 8c12715647e8..da0f5c3de43b 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
@@ -15,7 +15,7 @@
// template <class T>
// bool
// atomic_compare_exchange_weak(volatile atomic<T>* obj, T* expc, T desr);
-//
+//
// template <class T>
// bool
// atomic_compare_exchange_weak(atomic<T>* obj, T* expc, T desr);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
index 90a93f02b978..b70446bdf7f2 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
@@ -17,7 +17,7 @@
// atomic_compare_exchange_weak_explicit(volatile atomic<T>* obj, T* expc,
// T desr,
// memory_order s, memory_order f);
-//
+//
// template <class T>
// bool
// atomic_compare_exchange_weak_explicit(atomic<T>* obj, T* expc, T desr,
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
index 035d974427a4..680fe8f8287b 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
@@ -15,7 +15,7 @@
// template <class T>
// T
// atomic_exchange(volatile atomic<T>* obj, T desr);
-//
+//
// template <class T>
// T
// atomic_exchange(atomic<T>* obj, T desr);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
index 4d66bb5f3b81..0df4033c8ba7 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
@@ -15,7 +15,7 @@
// template <class T>
// T
// atomic_exchange_explicit(volatile atomic<T>* obj, T desr, memory_order m);
-//
+//
// template <class T>
// T
// atomic_exchange_explicit(atomic<T>* obj, T desr, memory_order m);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
index 48ff601539cf..e30543bdbf45 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
@@ -15,15 +15,15 @@
// template <class Integral>
// Integral
// atomic_fetch_add(volatile atomic<Integral>* obj, Integral op);
-//
+//
// template <class Integral>
// Integral
// atomic_fetch_add(atomic<Integral>* obj, Integral op);
-//
+//
// template <class T>
// T*
// atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op);
-//
+//
// template <class T>
// T*
// atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
index 57355d30411e..e101029bdacc 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
@@ -14,7 +14,7 @@
// template <class Integral>
// Integral
// atomic_fetch_and(volatile atomic<Integral>* obj, Integral op);
-//
+//
// template <class Integral>
// Integral
// atomic_fetch_and(atomic<Integral>* obj, Integral op);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
index 26ff5f65e7db..7180c14d4ba2 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
@@ -14,7 +14,7 @@
// template <class Integral>
// Integral
// atomic_fetch_and_explicit(volatile atomic<Integral>* obj, Integral op);
-//
+//
// template <class Integral>
// Integral
// atomic_fetch_and_explicit(atomic<Integral>* obj, Integral op);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
index ca44fdc3217d..241026bcf68c 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
@@ -14,7 +14,7 @@
// template <class Integral>
// Integral
// atomic_fetch_or(volatile atomic<Integral>* obj, Integral op);
-//
+//
// template <class Integral>
// Integral
// atomic_fetch_or(atomic<Integral>* obj, Integral op);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
index 72bbde798cb9..c7e0b1232cf2 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
@@ -14,7 +14,7 @@
// template <class Integral>
// Integral
// atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op);
-//
+//
// template <class Integral>
// Integral
// atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
index 2743040428c5..e1b12647452b 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
@@ -15,15 +15,15 @@
// template <class Integral>
// Integral
// atomic_fetch_sub(volatile atomic<Integral>* obj, Integral op);
-//
+//
// template <class Integral>
// Integral
// atomic_fetch_sub(atomic<Integral>* obj, Integral op);
-//
+//
// template <class T>
// T*
// atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op);
-//
+//
// template <class T>
// T*
// atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
index 6e94c505fd8c..882a1f2c43b0 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
@@ -20,7 +20,7 @@
// Integral
// atomic_fetch_sub_explicit(atomic<Integral>* obj, Integral op,
// memory_order m);
-//
+//
// template <class T>
// T*
// atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
index 42d57dedbd11..9306abfd06c5 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
@@ -14,7 +14,7 @@
// template <class Integral>
// Integral
// atomic_fetch_xor(volatile atomic<Integral>* obj, Integral op);
-//
+//
// template <class Integral>
// Integral
// atomic_fetch_xor(atomic<Integral>* obj, Integral op);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
index 8f388fee6325..c6a80a17eef6 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
@@ -14,7 +14,7 @@
// template <class Integral>
// Integral
// atomic_fetch_xor_explicit(volatile atomic<Integral>* obj, Integral op);
-//
+//
// template <class Integral>
// Integral
// atomic_fetch_xor_explicit(atomic<Integral>* obj, Integral op);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
index 6cbc0c35c0f5..482b7319dab2 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
@@ -24,10 +24,10 @@ struct UserAtomicType
{ return x.i == y.i; }
};
-template < template <class TestArg> class TestFunctor >
+template < template <class TestArg> class TestFunctor >
struct TestEachIntegralType {
void operator()() const {
- TestFunctor<char>()();
+ TestFunctor<char>()();
TestFunctor<signed char>()();
TestFunctor<unsigned char>()();
TestFunctor<short>()();
@@ -43,10 +43,18 @@ struct TestEachIntegralType {
TestFunctor<char16_t>()();
TestFunctor<char32_t>()();
#endif
+ TestFunctor< int8_t>()();
+ TestFunctor< uint8_t>()();
+ TestFunctor< int16_t>()();
+ TestFunctor<uint16_t>()();
+ TestFunctor< int32_t>()();
+ TestFunctor<uint32_t>()();
+ TestFunctor< int64_t>()();
+ TestFunctor<uint64_t>()();
}
};
-template < template <class TestArg> class TestFunctor >
+template < template <class TestArg> class TestFunctor >
struct TestEachAtomicType {
void operator()() const {
TestEachIntegralType<TestFunctor>()();
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
index 884c02dfe7ea..2cac65a8348a 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
@@ -15,7 +15,7 @@
// template <class T>
// void
// atomic_init(volatile atomic<T>* obj, T desr);
-//
+//
// template <class T>
// void
// atomic_init(atomic<T>* obj, T desr);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
index 5d50016ed32c..27e398736b6b 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
@@ -14,7 +14,7 @@
// template <class T>
// bool
// atomic_is_lock_free(const volatile atomic<T>* obj);
-//
+//
// template <class T>
// bool
// atomic_is_lock_free(const atomic<T>* obj);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
index e7b8e64b434f..b6d330cef9d8 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
@@ -15,7 +15,7 @@
// template <class T>
// T
// atomic_load(const volatile atomic<T>* obj);
-//
+//
// template <class T>
// T
// atomic_load(const atomic<T>* obj);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
index 56533fa871e5..1208b79026ea 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
@@ -15,7 +15,7 @@
// template <class T>
// T
// atomic_load_explicit(const volatile atomic<T>* obj, memory_order m);
-//
+//
// template <class T>
// T
// atomic_load_explicit(const atomic<T>* obj, memory_order m);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
index e61dae904116..3f8245bff6cd 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
@@ -14,7 +14,7 @@
// template <class T>
// void
// atomic_store(volatile atomic<T>* obj, T desr);
-//
+//
// template <class T>
// void
// atomic_store(atomic<T>* obj, T desr);
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
index e57cf8b1b323..627a04b74077 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
@@ -14,7 +14,7 @@
// template <class T>
// void
// atomic_store_explicit(volatile atomic<T>* obj, T desr, memory_order m);
-//
+//
// template <class T>
// void
// atomic_store_explicit(atomic<T>* obj, T desr, memory_order m);
diff --git a/test/std/containers/associative/iterator_types.pass.cpp b/test/std/containers/associative/iterator_types.pass.cpp
new file mode 100644
index 000000000000..2026219d86cb
--- /dev/null
+++ b/test/std/containers/associative/iterator_types.pass.cpp
@@ -0,0 +1,131 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <map>
+#include <set>
+#include <type_traits>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+#include "test_allocator.h"
+
+
+template <class Map, class ValueTp, class PtrT, class CPtrT>
+void testMap() {
+ typedef typename Map::difference_type Diff;
+ {
+ typedef typename Map::iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp&>::value), "");
+ static_assert((std::is_same<typename It::pointer, PtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+ }
+ {
+ typedef typename Map::const_iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
+ static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+ }
+}
+
+
+template <class Set, class ValueTp, class CPtrT>
+void testSet() {
+ static_assert((std::is_same<typename Set::iterator,
+ typename Set::const_iterator>::value), "");
+ typedef typename Set::difference_type Diff;
+ {
+ typedef typename Set::iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
+ static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+
+ }
+}
+
+int main() {
+ {
+ typedef std::map<int, int> Map;
+ typedef std::pair<const int, int> ValueTp;
+ testMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::map<int, int, std::less<int>, Alloc> Map;
+ testMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::map<int, int, std::less<int>, Alloc> Map;
+ testMap<Map, ValueTp, min_pointer<ValueTp>, min_pointer<const ValueTp>>();
+ }
+#endif
+ {
+ typedef std::multimap<int, int> Map;
+ typedef std::pair<const int, int> ValueTp;
+ testMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::multimap<int, int, std::less<int>, Alloc> Map;
+ testMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::multimap<int, int, std::less<int>, Alloc> Map;
+ testMap<Map, ValueTp, min_pointer<ValueTp>, min_pointer<const ValueTp>>();
+ }
+#endif
+ {
+ typedef int ValueTp;
+ typedef std::set<ValueTp> Set;
+ testSet<Set, ValueTp, ValueTp const*>();
+ }
+ {
+ typedef int ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::set<ValueTp, std::less<ValueTp>, Alloc> Set;
+ testSet<Set, ValueTp, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef int ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::set<ValueTp, std::less<ValueTp>, Alloc> Set;
+ testSet<Set, ValueTp, min_pointer<const ValueTp>>();
+ }
+#endif
+ {
+ typedef int ValueTp;
+ typedef std::multiset<ValueTp> Set;
+ testSet<Set, ValueTp, ValueTp const*>();
+ }
+ {
+ typedef int ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::multiset<ValueTp, std::less<ValueTp>, Alloc> Set;
+ testSet<Set, ValueTp, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef int ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::multiset<ValueTp, std::less<ValueTp>, Alloc> Set;
+ testSet<Set, ValueTp, min_pointer<const ValueTp>>();
+ }
+#endif
+}
diff --git a/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp b/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
new file mode 100644
index 000000000000..32d34d90d7f8
--- /dev/null
+++ b/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// RUN: %build -O2
+// RUN: %run
+
+// <map>
+
+// Previously this code caused a segfault when compiled at -O2 due to undefined
+// behavior in __tree. See https://llvm.org/bugs/show_bug.cgi?id=28469
+
+#include <functional>
+#include <map>
+
+void dummy() {}
+
+struct F {
+ std::map<int, std::function<void()> > m;
+ F() { m[42] = &dummy; }
+};
+
+int main() {
+ F f;
+ f = F();
+}
diff --git a/test/std/containers/associative/map/compare.pass.cpp b/test/std/containers/associative/map/compare.pass.cpp
index 26ac7af7d908..9d1c13d7b8e6 100644
--- a/test/std/containers/associative/map/compare.pass.cpp
+++ b/test/std/containers/associative/map/compare.pass.cpp
@@ -44,7 +44,7 @@ int main()
MapT map;
IterBool result = map.insert(std::make_pair(Key(0), 42));
assert(result.second);
- assert(result.first->second = 42);
+ assert(result.first->second == 42);
IterBool result2 = map.insert(std::make_pair(Key(0), 43));
assert(!result2.second);
assert(map[Key(0)] == 42);
diff --git a/test/std/containers/associative/map/incomplete_type.pass.cpp b/test/std/containers/associative/map/incomplete_type.pass.cpp
new file mode 100644
index 000000000000..84c2451ce087
--- /dev/null
+++ b/test/std/containers/associative/map/incomplete_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// Check that std::map and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <map>
+
+struct A {
+ typedef std::map<A, A> Map;
+ int data;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+int main() {
+ A a;
+}
diff --git a/test/std/containers/associative/map/map.access/at.pass.cpp b/test/std/containers/associative/map/map.access/at.pass.cpp
index 0da28507fce3..c5f77bf5f0fb 100644
--- a/test/std/containers/associative/map/map.access/at.pass.cpp
+++ b/test/std/containers/associative/map/map.access/at.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(m.at(8) == 8.5);
assert(m.size() == 7);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.access/empty.pass.cpp b/test/std/containers/associative/map/map.access/empty.pass.cpp
index b11e94c8042c..17b9cfd4ec11 100644
--- a/test/std/containers/associative/map/map.access/empty.pass.cpp
+++ b/test/std/containers/associative/map/map.access/empty.pass.cpp
@@ -29,7 +29,7 @@ int main()
m.clear();
assert(m.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/map/map.access/index_key.pass.cpp b/test/std/containers/associative/map/map.access/index_key.pass.cpp
index ab1144c60afd..3b1c21fd5da4 100644
--- a/test/std/containers/associative/map/map.access/index_key.pass.cpp
+++ b/test/std/containers/associative/map/map.access/index_key.pass.cpp
@@ -16,8 +16,13 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
+#include "count_new.hpp"
#include "min_allocator.h"
#include "private_constructor.hpp"
+#if TEST_STD_VER >= 11
+#include "container_test_types.h"
+#endif
int main()
{
@@ -46,7 +51,7 @@ int main()
assert(m[6] == 6.5);
assert(m.size() == 8);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
@@ -73,8 +78,42 @@ int main()
assert(m[6] == 6.5);
assert(m.size() == 8);
}
+ {
+ // Use "container_test_types.h" to check what arguments get passed
+ // to the allocator for operator[]
+ using Container = TCT::map<>;
+ using Key = Container::key_type;
+ using MappedType = Container::mapped_type;
+ using ValueTp = Container::value_type;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ Container c;
+ const Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
+ }
+ {
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
+ }
+ }
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp b/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
index 6511dcc85f53..e5580bca3955 100644
--- a/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
+++ b/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class map
@@ -17,12 +19,13 @@
#include <cassert>
#include "test_macros.h"
+#include "count_new.hpp"
#include "MoveOnly.h"
#include "min_allocator.h"
+#include "container_test_types.h"
int main()
{
-#if TEST_STD_VER >= 11
{
std::map<MoveOnly, double> m;
assert(m.size() == 0);
@@ -52,5 +55,27 @@ int main()
assert(m[6] == 6.5);
assert(m.size() == 2);
}
-#endif
+ {
+ // Use "container_test_types.h" to check what arguments get passed
+ // to the allocator for operator[]
+ using Container = TCT::map<>;
+ using Key = Container::key_type;
+ using MappedType = Container::mapped_type;
+ using ValueTp = Container::value_type;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key &&>&&, std::tuple<>&&>();
+ MappedType& mref = c[std::move(k)];
+ assert(!cc->unchecked());
+ {
+ Key k2(1);
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[std::move(k2)];
+ assert(&mref == &mref2);
+ }
+ }
+ }
}
diff --git a/test/std/containers/associative/map/map.access/iterator.pass.cpp b/test/std/containers/associative/map/map.access/iterator.pass.cpp
index 552e87d8fc8d..4f66eb6a8e31 100644
--- a/test/std/containers/associative/map/map.access/iterator.pass.cpp
+++ b/test/std/containers/associative/map/map.access/iterator.pass.cpp
@@ -119,7 +119,7 @@ int main()
assert(i->second == 1);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.access/max_size.pass.cpp b/test/std/containers/associative/map/map.access/max_size.pass.cpp
index 551120d331e1..c67d8b1f674d 100644
--- a/test/std/containers/associative/map/map.access/max_size.pass.cpp
+++ b/test/std/containers/associative/map/map.access/max_size.pass.cpp
@@ -25,7 +25,7 @@ int main()
M m;
assert(m.max_size() != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/map/map.access/size.pass.cpp b/test/std/containers/associative/map/map.access/size.pass.cpp
index 07c12322a460..b9d56167a4b0 100644
--- a/test/std/containers/associative/map/map.access/size.pass.cpp
+++ b/test/std/containers/associative/map/map.access/size.pass.cpp
@@ -37,7 +37,7 @@ int main()
m.erase(m.begin());
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/map/map.cons/alloc.pass.cpp b/test/std/containers/associative/map/map.cons/alloc.pass.cpp
index 2292c47ef74b..6ff102e6873c 100644
--- a/test/std/containers/associative/map/map.cons/alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/alloc.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
index 482d1acff840..679600662fda 100644
--- a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
std::map<int, double, std::less<int>, min_allocator<V>> m =
diff --git a/test/std/containers/associative/map/map.cons/compare.pass.cpp b/test/std/containers/associative/map/map.cons/compare.pass.cpp
index 5a213c8e8b8f..5d8d5e252507 100644
--- a/test/std/containers/associative/map/map.cons/compare.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/compare.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
diff --git a/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
index 56b3c3315e08..ea1374a53dac 100644
--- a/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
@@ -31,7 +31,7 @@ int main()
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..81ccba3bbc96
--- /dev/null
+++ b/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// Check that std::map fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::map<int, int, Comp<int> > m;
+}
diff --git a/test/std/containers/associative/map/map.cons/copy.pass.cpp b/test/std/containers/associative/map/map.cons/copy.pass.cpp
index be5274133082..a1de1b13aed2 100644
--- a/test/std/containers/associative/map/map.cons/copy.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/copy.pass.cpp
@@ -92,7 +92,7 @@ int main()
assert(*next(mo.begin(), 2) == V(3, 1));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
index fcbe5976d6da..8a9f7c86a2c7 100644
--- a/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
@@ -56,7 +56,7 @@ int main()
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp b/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
index a1bcb30f4294..fc6641ae34b9 100644
--- a/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
@@ -107,7 +107,7 @@ int main()
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/default.pass.cpp b/test/std/containers/associative/map/map.cons/default.pass.cpp
index 1832a32fffb3..265c59ef24cd 100644
--- a/test/std/containers/associative/map/map.cons/default.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/default.pass.cpp
@@ -25,7 +25,7 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
assert(m.empty());
diff --git a/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
index dedc89bd435e..817f1207ac94 100644
--- a/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,19 +31,19 @@ struct some_comp
{
typedef T value_type;
some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
@@ -50,5 +53,4 @@ int main()
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
index 9baa19b53d05..efdf5a2ed184 100644
--- a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
@@ -11,26 +11,24 @@
// ~map() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const noexcept { return false; }
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -48,5 +46,4 @@ int main()
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
index 196943653a14..c55d18f54094 100644
--- a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
@@ -41,7 +41,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
std::map<int, double, std::less<int>, min_allocator<V>> m =
diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
index 08f8a529f030..3133eb2e0dd6 100644
--- a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
@@ -42,7 +42,7 @@ int main()
assert(*next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
index 765428a631e5..1210fe0e49e1 100644
--- a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(m.key_comp() == C(3));
assert(m.get_allocator() == A(6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
diff --git a/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp b/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
index c1029af6889e..48610f3b3e58 100644
--- a/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
@@ -42,7 +42,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp b/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
index 837fa8c6cdea..1389f71449c8 100644
--- a/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
index 67fb5d644762..42376e268332 100644
--- a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/move.pass.cpp b/test/std/containers/associative/map/map.cons/move.pass.cpp
index c06f2ee5021b..2d19b88bdda8 100644
--- a/test/std/containers/associative/map/map.cons/move.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move.pass.cpp
@@ -69,7 +69,7 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef min_allocator<V> A;
diff --git a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
index e5d43f266c08..4ccf56118aec 100644
--- a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
@@ -169,7 +169,7 @@ int main()
M m1(I(a1), I(a1+num), C(), A());
assert(Counter_base::gConstructed == num+3);
-
+
M m2(m1);
assert(m2 == m1);
assert(Counter_base::gConstructed == num+6);
@@ -187,9 +187,9 @@ int main()
}
assert(Counter_base::gConstructed == num+3);
}
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
diff --git a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
index 8ae8265cdc12..09b41d3b130b 100644
--- a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
@@ -144,7 +144,7 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
diff --git a/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
index 3b28118b5b1e..95ddf6dcb82f 100644
--- a/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
@@ -28,11 +30,11 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -50,5 +52,4 @@ int main()
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
index 0f1fd396639e..1c2a242edf43 100644
--- a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
@@ -26,11 +28,11 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -48,5 +50,4 @@ int main()
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/map/map.modifiers/clear.pass.cpp b/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
index c37499df307a..1f36a6f10cb0 100644
--- a/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
m.clear();
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
index 81846c6647c6..63d014fe8cc5 100644
--- a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
@@ -92,7 +92,7 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
typedef std::pair<M::iterator, bool> R;
diff --git a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
index 15f74b17e786..319a239525ad 100644
--- a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
@@ -64,7 +64,7 @@ int main()
assert(m.size() == 1);
assert(m.begin()->first == 2);
assert(m.begin()->second == Emplaceable());
- r = m.emplace_hint(m.end(), std::piecewise_construct,
+ r = m.emplace_hint(m.end(), std::piecewise_construct,
std::forward_as_tuple(1),
std::forward_as_tuple(2, 3.5));
assert(r == m.begin());
@@ -89,7 +89,7 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
typedef M::iterator R;
@@ -130,7 +130,7 @@ int main()
assert(m.size() == 1);
assert(m.begin()->first == 2);
assert(m.begin()->second == Emplaceable());
- r = m.emplace_hint(m.end(), std::piecewise_construct,
+ r = m.emplace_hint(m.end(), std::piecewise_construct,
std::forward_as_tuple(1),
std::forward_as_tuple(2, 3.5));
assert(r == m.begin());
diff --git a/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp b/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
index 15c5ce041b68..cd65c4302af7 100644
--- a/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
@@ -134,7 +134,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
@@ -242,7 +242,7 @@ int main()
assert(i == m.end());
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
index 1b49956d8a5a..144cfac2ccb5 100644
--- a/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp b/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
index e41f5129140e..c1b31e78d3ef 100644
--- a/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
@@ -145,7 +145,7 @@ int main()
assert(m.size() == 0);
assert(s == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
new file mode 100644
index 000000000000..d98047d02e7d
--- /dev/null
+++ b/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// insert(...);
+// emplace(...);
+// emplace_hint(...);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <map>
+
+#include "container_test_types.h"
+#include "../../../map_allocator_requirement_test_templates.h"
+
+int main()
+{
+ testMapInsert<TCT::map<> >();
+ testMapInsertHint<TCT::map<> >();
+ testMapEmplace<TCT::map<> >();
+ testMapEmplaceHint<TCT::map<> >();
+}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
index 3d28242fd322..e2ffcba375fa 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
@@ -16,74 +16,57 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-int main()
+template <class Container>
+void do_insert_cv_test()
{
- {
- typedef std::map<int, double> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2, 2.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2.5);
-
- r = m.insert(M::value_type(1, 1.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1.5);
+ typedef Container M;
+ typedef std::pair<typename M::iterator, bool> R;
+ typedef typename M::value_type VT;
+ M m;
- r = m.insert(M::value_type(3, 3.5));
- assert(r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
+ const VT v1(2, 2.5);
+ R r = m.insert(v1);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2.5);
- r = m.insert(M::value_type(3, 3.5));
- assert(!r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
- }
-#if __cplusplus >= 201103L
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2, 2.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2.5);
+ const VT v2(1, 1.5);
+ r = m.insert(v2);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1.5);
- r = m.insert(M::value_type(1, 1.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1.5);
+ const VT v3(3, 3.5);
+ r = m.insert(v3);
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
- r = m.insert(M::value_type(3, 3.5));
- assert(r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
+ const VT v4(3, 4.5);
+ r = m.insert(v4);
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
+}
- r = m.insert(M::value_type(3, 3.5));
- assert(!r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
+int main()
+{
+ do_insert_cv_test<std::map<int, double> >();
+#if TEST_STD_VER >= 11
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ do_insert_cv_test<M>();
}
#endif
}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
index ab325ed45bfc..9cf3f3dcf74f 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
std::map<int, double, std::less<int>, min_allocator<V>> m =
diff --git a/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
index 278db4631a8c..0c7e124e0d1c 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
@@ -16,66 +16,53 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-int main()
+template <class Container>
+void do_insert_iter_cv_test()
{
- {
- typedef std::map<int, double> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
-
- r = m.insert(m.end(), M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ M m;
+ const VT v1(2, 2.5);
+ R r = m.insert(m.end(), v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
- }
-#if __cplusplus >= 201103L
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
+ const VT v2(1, 1.5);
+ r = m.insert(m.end(), v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
- r = m.insert(m.end(), M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ const VT v3(3, 3.5);
+ r = m.insert(m.end(), v3);
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v4(3, 4.5);
+ r = m.insert(m.end(), v4);
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+}
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+int main()
+{
+ do_insert_iter_cv_test<std::map<int, double> >();
+#if TEST_STD_VER >= 11
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ do_insert_iter_cv_test<M>();
}
#endif
}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
index 964738b4a68a..edc1a1e2c62b 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(next(m.begin(), 2)->first == 3);
assert(next(m.begin(), 2)->second == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
index 9db1e5c70732..3edb9c06e7c0 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class map
@@ -21,70 +23,49 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main()
+template <class Container, class Pair>
+void do_insert_iter_rv_test()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- {
- typedef std::map<int, MoveOnly> M;
- typedef std::pair<int, MoveOnly> P;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), P(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
+ typedef Container M;
+ typedef Pair P;
+ typedef typename M::iterator R;
+ M m;
+ R r = m.insert(m.end(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
- r = m.insert(m.end(), P(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
+ r = m.insert(m.end(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
- r = m.insert(m.end(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
+ r = m.insert(m.end(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.end(), P(3, 4));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+}
+int main()
+{
+ do_insert_iter_rv_test<std::map<int, MoveOnly>, std::pair<int, MoveOnly>>();
+ do_insert_iter_rv_test<std::map<int, MoveOnly>, std::pair<const int, MoveOnly>>();
- r = m.insert(m.end(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
- }
-#if TEST_STD_VER >= 11
{
typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
typedef std::pair<int, MoveOnly> P;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), P(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
-
- r = m.insert(m.end(), P(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
-
- r = m.insert(m.end(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = m.insert(m.end(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
+ typedef std::pair<const int, MoveOnly> CP;
+ do_insert_iter_rv_test<M, P>();
+ do_insert_iter_rv_test<M, CP>();
}
-#endif
-#if TEST_STD_VER > 14
{
typedef std::map<int, MoveOnly> M;
typedef M::iterator R;
@@ -113,6 +94,5 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#endif
+
}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
index 484ed06247d1..8689dc7284d5 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <map>
@@ -22,7 +22,6 @@
// template <class M>
// iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
-#include <__config>
#include <map>
#include <cassert>
#include <tuple>
@@ -60,9 +59,6 @@ public:
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
{ // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
typedef std::map<int, Moveable> M;
typedef std::pair<M::iterator, bool> R;
@@ -186,7 +182,4 @@ int main()
assert(r->first.get() == 3); // key
assert(r->second.get() == 5); // value
}
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-} \ No newline at end of file
+}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
index 23eb84d687ff..503d9291076d 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class map
@@ -22,76 +24,54 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main()
+template <class Container, class Pair>
+void do_insert_rv_test()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- {
- typedef std::map<int, MoveOnly> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2, 2));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2);
+ typedef Container M;
+ typedef Pair P;
+ typedef std::pair<typename M::iterator, bool> R;
+ M m;
+ R r = m.insert(P(2, 2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2);
- r = m.insert(M::value_type(1, 1));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1);
+ r = m.insert(P(1, 1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1);
- r = m.insert(M::value_type(3, 3));
- assert(r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
+ r = m.insert(P(3, 3));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
- r = m.insert(M::value_type(3, 3));
- assert(!r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2, 2));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2);
-
- r = m.insert(M::value_type(1, 1));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1);
+ r = m.insert(P(3, 3));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+}
- r = m.insert(M::value_type(3, 3));
- assert(r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
+int main()
+{
+ do_insert_rv_test<std::map<int, MoveOnly>, std::pair<int, MoveOnly>>();
+ do_insert_rv_test<std::map<int, MoveOnly>, std::pair<const int, MoveOnly>>();
- r = m.insert(M::value_type(3, 3));
- assert(!r.second);
- assert(r.first == prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
+ {
+ typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef std::pair<const int, MoveOnly> CP;
+ do_insert_rv_test<M, P>();
+ do_insert_rv_test<M, CP>();
}
-#endif
-#if TEST_STD_VER > 14
{
typedef std::map<int, MoveOnly> M;
typedef std::pair<M::iterator, bool> R;
@@ -124,6 +104,4 @@ int main()
assert(r.first->first == 3);
assert(r.first->second == 3);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp b/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
index 8e0dd7577bbd..63704c91440e 100644
--- a/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <map>
@@ -22,7 +22,6 @@
// template <class... Args>
// iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
-#include <__config>
#include <map>
#include <cassert>
#include <tuple>
@@ -58,9 +57,6 @@ public:
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
{ // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
typedef std::map<int, Moveable> M;
typedef std::pair<M::iterator, bool> R;
@@ -104,7 +100,7 @@ int main()
assert(r.first->second.get() == -1); // value
}
- { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
+ { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
typedef std::map<Moveable, Moveable> M;
typedef std::pair<M::iterator, bool> R;
M m;
@@ -140,7 +136,7 @@ int main()
m.try_emplace ( i, Moveable(i, (double) i));
assert(m.size() == 10);
M::const_iterator it = m.find(2);
-
+
Moveable mv1(3, 3.0);
for (int i=0; i < 20; i += 2)
{
@@ -183,7 +179,4 @@ int main()
assert(r->first.get() == 3); // key
assert(r->second.get() == 4); // value
}
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/map/map.ops/count.pass.cpp b/test/std/containers/associative/map/map.ops/count.pass.cpp
index ae87ae8345e9..f3df31951c79 100644
--- a/test/std/containers/associative/map/map.ops/count.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/count.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(r == 0);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
diff --git a/test/std/containers/associative/map/map.ops/count0.pass.cpp b/test/std/containers/associative/map/map.ops/count0.pass.cpp
index ce549366e7ab..0278343006a8 100644
--- a/test/std/containers/associative/map/map.ops/count0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/count0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/count1.fail.cpp b/test/std/containers/associative/map/map.ops/count1.fail.cpp
index 9c15059d490e..075a5ba2e0ab 100644
--- a/test/std/containers/associative/map/map.ops/count1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/count2.fail.cpp b/test/std/containers/associative/map/map.ops/count2.fail.cpp
index 7aa1553ef47a..de1899021805 100644
--- a/test/std/containers/associative/map/map.ops/count2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/count3.fail.cpp b/test/std/containers/associative/map/map.ops/count3.fail.cpp
index 7e7bb8f6d370..b139689fec74 100644
--- a/test/std/containers/associative/map/map.ops/count3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/equal_range.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
index a71149a47212..8beeb8b30f58 100644
--- a/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
@@ -159,7 +159,7 @@ int main()
assert(r.second == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
diff --git a/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
index c95c3dffa9a5..3b98426868e4 100644
--- a/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp
index 8f0da08eb322..c66c2c512142 100644
--- a/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp
index e73122d6533b..85083d4f4796 100644
--- a/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
index bb72e9e7a6d4..c9f1126e5baf 100644
--- a/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/find.pass.cpp b/test/std/containers/associative/map/map.ops/find.pass.cpp
index 17463b65740f..225f0f406042 100644
--- a/test/std/containers/associative/map/map.ops/find.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/find.pass.cpp
@@ -93,7 +93,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
diff --git a/test/std/containers/associative/map/map.ops/find0.pass.cpp b/test/std/containers/associative/map/map.ops/find0.pass.cpp
index 5f310b07c599..d7de579d8b44 100644
--- a/test/std/containers/associative/map/map.ops/find0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/find0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/find1.fail.cpp b/test/std/containers/associative/map/map.ops/find1.fail.cpp
index c33b5a9a34cf..4fe61117613c 100644
--- a/test/std/containers/associative/map/map.ops/find1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/find2.fail.cpp b/test/std/containers/associative/map/map.ops/find2.fail.cpp
index 40bf323a4538..3532dc8765b3 100644
--- a/test/std/containers/associative/map/map.ops/find2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/find3.fail.cpp b/test/std/containers/associative/map/map.ops/find3.fail.cpp
index 9526c0e24d9e..be77330a29c8 100644
--- a/test/std/containers/associative/map/map.ops/find3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp b/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
index 3cbfbf7d869f..e4359fa548b9 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
@@ -125,7 +125,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
@@ -317,7 +317,7 @@ int main()
r = m.lower_bound(C2Int(20));
assert(r == next(m.begin(), 8));
}
-
+
{
typedef PrivateConstructor PC;
typedef std::map<PC, double, std::less<>> M;
diff --git a/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp b/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
index 2fc095a8f2c1..ea121df73002 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp
index a4a986c1a7a4..97bbf553205f 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp
index 3f6380e5e25f..eeae8e657387 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp
index 18f2c7b71fde..ba27ae3c5172 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp b/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
index 037ceb962cd8..8c721947a2c3 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
@@ -124,7 +124,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
@@ -280,7 +280,7 @@ int main()
r = m.upper_bound(20);
assert(r == next(m.begin(), 8));
}
-
+
{
typedef PrivateConstructor PC;
typedef std::map<PC, double, std::less<>> M;
diff --git a/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp b/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
index c58e55f29793..2e597b85cf0c 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp
index 4647681b5cd1..6568e04bfad4 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp
index 11852fe0cc9f..bbb857e6f25a 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp
index 9cddeb8acbdc..ed9a41e4f03f 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/map/map.special/member_swap.pass.cpp b/test/std/containers/associative/map/map.special/member_swap.pass.cpp
index 7c3ad9d50ae4..f0913a77c2eb 100644
--- a/test/std/containers/associative/map/map.special/member_swap.pass.cpp
+++ b/test/std/containers/associative/map/map.special/member_swap.pass.cpp
@@ -96,7 +96,7 @@ int main()
assert(m2 == m1_save);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
diff --git a/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp b/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
index b042a4878f8a..103a57b17e07 100644
--- a/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
@@ -98,6 +98,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef test_allocator<V> A;
typedef test_compare<std::less<int> > C;
@@ -166,8 +167,7 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A(1));
}
- }
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
@@ -242,6 +242,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef min_allocator<V> A;
typedef test_compare<std::less<int> > C;
@@ -276,6 +277,5 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A());
}
- }
#endif
}
diff --git a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
index f25dff2c86da..cbbf4577ce62 100644
--- a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// void swap(map& c)
@@ -15,13 +17,14 @@
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
// This tests a conforming extension
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,23 +32,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
- void deallocate(void*, unsigned) {}
-
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -57,7 +57,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -69,7 +69,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -82,7 +82,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -93,7 +93,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -145,5 +144,4 @@ int main()
}
#endif
-#endif
}
diff --git a/test/std/containers/associative/map/types.pass.cpp b/test/std/containers/associative/map/types.pass.cpp
index d117deff693d..67cd5acaae89 100644
--- a/test/std/containers/associative/map/types.pass.cpp
+++ b/test/std/containers/associative/map/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
diff --git a/test/std/containers/associative/multimap/empty.pass.cpp b/test/std/containers/associative/multimap/empty.pass.cpp
index 2384960d10db..f1388d8bfa5a 100644
--- a/test/std/containers/associative/multimap/empty.pass.cpp
+++ b/test/std/containers/associative/multimap/empty.pass.cpp
@@ -29,7 +29,7 @@ int main()
m.clear();
assert(m.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/multimap/incomplete_type.pass.cpp b/test/std/containers/associative/multimap/incomplete_type.pass.cpp
new file mode 100644
index 000000000000..c461eb38139d
--- /dev/null
+++ b/test/std/containers/associative/multimap/incomplete_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// Check that std::multimap and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <map>
+
+struct A {
+ typedef std::multimap<A, A> Map;
+ int data;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+int main() {
+ A a;
+}
diff --git a/test/std/containers/associative/multimap/iterator.pass.cpp b/test/std/containers/associative/multimap/iterator.pass.cpp
index 2763129acc2a..ef7c5ef18af1 100644
--- a/test/std/containers/associative/multimap/iterator.pass.cpp
+++ b/test/std/containers/associative/multimap/iterator.pass.cpp
@@ -121,7 +121,7 @@ int main()
assert(i->second == d);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/max_size.pass.cpp b/test/std/containers/associative/multimap/max_size.pass.cpp
index ccd8b10638c1..b7cf226d8f13 100644
--- a/test/std/containers/associative/multimap/max_size.pass.cpp
+++ b/test/std/containers/associative/multimap/max_size.pass.cpp
@@ -25,7 +25,7 @@ int main()
M m;
assert(m.max_size() != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
index 87bf0447e5be..69660fcd2772 100644
--- a/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
index 0c8991832529..4c0326d90fe6 100644
--- a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
index 9a4e0f987fd0..59a972f45687 100644
--- a/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
std::multimap<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
diff --git a/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
index 1224884939cf..836532892499 100644
--- a/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
@@ -31,7 +31,7 @@ int main()
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..e6f6c3efee5b
--- /dev/null
+++ b/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// Check that std::multimap fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::multimap<int, int, Comp<int> > m;
+}
diff --git a/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
index 3d6626eaadbb..97dcf39e10c9 100644
--- a/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
@@ -74,7 +74,7 @@ int main()
assert(mo.key_comp() == C(5));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
index 22594e32d718..46b9459cad28 100644
--- a/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(mo.get_allocator() == A(7));
assert(mo.key_comp() == C(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
index 2bdc4d6a70ab..b0bf8cc135f2 100644
--- a/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
@@ -94,7 +94,7 @@ int main()
assert(mo.get_allocator() == A(2));
assert(mo.key_comp() == C(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
index 1c3ab8ce6c4b..d39cc1d0ee8a 100644
--- a/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
@@ -25,7 +25,7 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
assert(m.empty());
diff --git a/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
index 5f05a0dca28e..6f97a5f3e756 100644
--- a/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,19 +31,19 @@ struct some_comp
{
typedef T value_type;
some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
@@ -50,5 +53,4 @@ int main()
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
index dd1701240c63..3a240cd48af3 100644
--- a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
@@ -11,26 +11,24 @@
// ~multimap() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -48,5 +46,4 @@ int main()
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
index 937a202a55ea..6f645b63b44c 100644
--- a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
index e6677039c90c..6d20d14f4200 100644
--- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
@@ -53,7 +53,7 @@ int main()
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > Cmp;
typedef std::multimap<int, double, Cmp, min_allocator<std::pair<const int, double>>> C;
diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
index 0e73f72793e5..f5d3463aec42 100644
--- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
@@ -57,7 +57,7 @@ int main()
assert(m.get_allocator() == A(5));
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > Cmp;
typedef min_allocator<std::pair<const int, double> > A;
diff --git a/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
index fa062e2be0b8..46c56aa0b3ff 100644
--- a/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
index d6de59428dd6..614b3ed8a754 100644
--- a/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
index 259fbd145ff6..31bf72dac96f 100644
--- a/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
@@ -55,7 +55,7 @@ int main()
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
index aed08867c3cc..7edec77365d8 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
@@ -75,7 +75,7 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef min_allocator<V> A;
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
index 3ec79eea3554..41771f62aaea 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
@@ -169,7 +169,7 @@ int main()
M m1(I(a1), I(a1+num), C(), A());
assert(Counter_base::gConstructed == 2*num);
-
+
M m2(m1);
assert(m2 == m1);
assert(Counter_base::gConstructed == 3*num);
@@ -187,9 +187,9 @@ int main()
}
assert(Counter_base::gConstructed == 2*num);
}
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
index 48854e388e10..924e9ddf1936 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
@@ -144,7 +144,7 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
index 635a8dca0357..890cac867f9e 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
@@ -28,11 +30,11 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -50,5 +52,4 @@ int main()
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
index 0f31f04ff829..8932b4f83d48 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <map>
#include <cassert>
@@ -26,11 +28,11 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -48,5 +50,4 @@ int main()
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
index fe9b8c8ba128..321f4d0bd000 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
m.clear();
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
index 03da4af59372..7f5b698fa068 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
@@ -84,7 +84,7 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
index 846d5999a17e..a6ed318c7598 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
@@ -89,7 +89,7 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
index ba55351c0bde..6729da41378b 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
@@ -155,7 +155,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
@@ -284,7 +284,7 @@ int main()
assert(i == m.end());
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
index 4d3789493110..1069542c5430 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
index 33821d3e3596..44a6abef6ed0 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
@@ -84,7 +84,7 @@ int main()
assert(m.size() == 0);
assert(i == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
new file mode 100644
index 000000000000..225bf67bb1f6
--- /dev/null
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// insert(...)
+
+// UNSUPPORTED: c++98, c++03
+
+#include <map>
+
+#include "container_test_types.h"
+#include "../../../map_allocator_requirement_test_templates.h"
+
+
+int main()
+{
+ testMultimapInsert<TCT::multimap<> >();
+ testMultimapInsertHint<TCT::multimap<> >();
+}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
index d9afc9d0fdf0..53874311c782 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
@@ -16,66 +16,54 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-int main()
-{
- {
- typedef std::multimap<int, double> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
+template <class Container>
+void do_insert_test() {
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ const VT v1(2, 2.5);
+ R r = m.insert(v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
- r = m.insert(M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ const VT v2(1, 1.5);
+ r = m.insert(v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
- r = m.insert(M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v3(3, 3.5);
+ r = m.insert(v3);
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
- r = m.insert(M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v4(3, 3.5);
+ r = m.insert(v4);
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+}
+
+int main()
+{
+ {
+ typedef std::multimap<int, double> Container;
+ do_insert_test<Container>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
-
- r = m.insert(M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
-
- r = m.insert(M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
-
- r = m.insert(M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> Container;
+ do_insert_test<Container>();
}
#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
index 5e1a1d4125ef..89befb3e9971 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
@@ -53,7 +53,7 @@ int main()
assert(*++i == V(3, 2));
assert(*++i == V(3, 1.5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
index b83c802c04cf..05e1096cb547 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
@@ -16,66 +16,52 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-int main()
+template <class Container>
+void do_insert_hint_test()
{
- {
- typedef std::multimap<int, double> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ const VT v1(2, 2.5);
+ R r = m.insert(m.end(), v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
- r = m.insert(m.end(), M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ const VT v2(1, 1.5);
+ r = m.insert(m.end(), v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v3(3, 3.5);
+ r = m.insert(m.end(), v3);
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
- r = m.insert(prev(m.end()), M::value_type(3, 4.5));
- assert(r == prev(m.end(), 2));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 4.5);
- }
-#if __cplusplus >= 201103L
+ const VT v4(3, 4.5);
+ r = m.insert(prev(m.end()), v4);
+ assert(r == prev(m.end(), 2));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 4.5);
+}
+
+int main()
+{
+ do_insert_hint_test<std::multimap<int, double> >();
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), M::value_type(2, 2.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
-
- r = m.insert(m.end(), M::value_type(1, 1.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
-
- r = m.insert(m.end(), M::value_type(3, 3.5));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
-
- r = m.insert(prev(m.end()), M::value_type(3, 4.5));
- assert(r == prev(m.end(), 2));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 4.5);
+ do_insert_hint_test<M>();
}
#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
index 70ff7ef6d6b8..1bf437a93443 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(next(m.begin(), 8)->first == 3);
assert(next(m.begin(), 8)->second == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
typedef std::pair<int, double> P;
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
index 7035de83f990..47e0d371bb48 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class multimap
@@ -21,73 +23,53 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main()
+template <class Container, class Pair>
+void do_insert_rv_test()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- {
- typedef std::multimap<int, MoveOnly> M;
- typedef std::pair<int, MoveOnly> P;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), P(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
+ typedef Container M;
+ typedef Pair P;
+ typedef typename M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
- r = m.insert(m.cend(), P(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
+ r = m.insert(m.cend(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
- r = m.insert(m.cend(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
+ r = m.insert(m.cend(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.cend(), P(3, 2));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 2);
+}
+
+int main()
+{
+ do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<int, MoveOnly> >();
+ do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<const int, MoveOnly> >();
- r = m.insert(m.cend(), P(3, 2));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 2);
- }
-#if TEST_STD_VER >= 11
{
typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
typedef std::pair<int, MoveOnly> P;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), P(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
+ typedef std::pair<const int, MoveOnly> CP;
+ do_insert_rv_test<M, P>();
+ do_insert_rv_test<M, CP>();
- r = m.insert(m.cend(), P(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
-
- r = m.insert(m.cend(), P(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = m.insert(m.cend(), P(3, 2));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 2);
}
-#endif
-#if TEST_STD_VER > 14
{
typedef std::multimap<int, MoveOnly> M;
- typedef std::pair<int, MoveOnly> P;
typedef M::iterator R;
M m;
R r = m.insert(m.cend(), {2, MoveOnly(2)});
@@ -114,6 +96,4 @@ int main()
assert(r->first == 3);
assert(r->second == 2);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
index 825e304f65a8..022de873f7f1 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// class multimap
@@ -21,68 +23,45 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main()
+template <class Container>
+void do_insert_rv_test()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- {
- typedef std::multimap<int, MoveOnly> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
+ typedef std::multimap<int, MoveOnly> M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ R r = m.insert(VT(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
- r = m.insert(M::value_type(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
+ r = m.insert(VT(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
- r = m.insert(M::value_type(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
+ r = m.insert(VT(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
- r = m.insert(M::value_type(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3);
- }
-#if TEST_STD_VER >= 11
+ r = m.insert(VT(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3);
+}
+
+int main()
+{
+ do_insert_rv_test<std::multimap<int, MoveOnly>>();
{
typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2, 2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
-
- r = m.insert(M::value_type(1, 1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
-
- r = m.insert(M::value_type(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = m.insert(M::value_type(3, 3));
- assert(r == prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3);
+ do_insert_rv_test<M>();
}
-#endif
-#if TEST_STD_VER > 14
{
typedef std::multimap<int, MoveOnly> M;
typedef M::iterator R;
@@ -111,6 +90,4 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
index c666c295f3a0..92f90f551d44 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
@@ -56,7 +56,7 @@ int main()
assert(r == 0);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
index 7da13bb0d66d..b993f4f89087 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
index f30d1bfd88d6..d0f3f1c0fdb7 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
index ffb7eb6a559a..86d492f7f5e0 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
index 4bb9d14634f3..55095efb3d6a 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
index 5a071042461a..31eac26816ac 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
@@ -101,7 +101,7 @@ int main()
assert(r.second == m.end());
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
index c0f07468ec5e..a3a51e6ccbf9 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp
index f022e94324fd..f793bf8859ba 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp
index 695e71703e3b..d099a8c81a1b 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp
index 59c2855e8f69..e53fff942793 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
index a60e42cf8592..2fd8c05b5f5e 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
@@ -83,7 +83,7 @@ int main()
assert(r == m.end());
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
index 4f3369870c8f..03a6e1883051 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
index e1eef034064d..2759af46be14 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
index 4c03f583fa1c..c67f3b39dabd 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
index f10bc60aa864..e53fc4d55887 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
@@ -13,9 +13,9 @@
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
index 38b931802f8e..5c0315f956a8 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
@@ -87,7 +87,7 @@ int main()
assert(r == m.end());
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
index c5271f65d7e5..77927bb5abed 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp
index b452be864e2b..9b39573a5f42 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp
index a2ba30236a40..68710bd1bc38 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp
index 50d9fca91ad9..f254ef4785a1 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp
@@ -13,9 +13,9 @@
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
index 7c647a9426cb..012354cef7bb 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
@@ -87,7 +87,7 @@ int main()
assert(r == m.end());
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
index 322c6f55130c..3f6852d085c3 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: c++03, c++11
+// XFAIL: c++98, c++03, c++11
// <map>
@@ -15,9 +15,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp
index bb78ad698160..d47d7bfc89f4 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp
index a79d5938e56e..a3da9d82c95c 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
index 1c1dc74b72c7..6ffdb206cc30 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
@@ -13,9 +13,9 @@
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
-//
-// The member function templates find, count, lower_bound, upper_bound, and
-// equal_range shall not participate in overload resolution unless the
+//
+// The member function templates find, count, lower_bound, upper_bound, and
+// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
diff --git a/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp b/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
index fb17e7340bd4..f216f9f76a11 100644
--- a/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
@@ -96,7 +96,7 @@ int main()
assert(m2 == m1_save);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
diff --git a/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp b/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
index a91dfebb14a9..a075919bba9a 100644
--- a/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
@@ -98,6 +98,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef test_allocator<V> A;
typedef test_compare<std::less<int> > C;
@@ -166,8 +167,7 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A(1));
}
- }
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
@@ -242,6 +242,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef min_allocator<V> A;
typedef test_compare<std::less<int> > C;
@@ -276,6 +277,5 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A());
}
- }
#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
index e70ee1fae565..ffc71b0eeb92 100644
--- a/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <map>
// void swap(multimap& c)
@@ -15,13 +17,14 @@
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
// This tests a conforming extension
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,23 +32,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
- void deallocate(void*, unsigned) {}
-
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -57,7 +57,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -69,7 +69,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -82,7 +82,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -93,7 +93,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -144,6 +143,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/associative/multimap/size.pass.cpp b/test/std/containers/associative/multimap/size.pass.cpp
index ac71d4c95b64..7ba7ceb2be6e 100644
--- a/test/std/containers/associative/multimap/size.pass.cpp
+++ b/test/std/containers/associative/multimap/size.pass.cpp
@@ -37,7 +37,7 @@ int main()
m.erase(m.begin());
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
diff --git a/test/std/containers/associative/multimap/types.pass.cpp b/test/std/containers/associative/multimap/types.pass.cpp
index a0f4db056a83..999ecbb7c223 100644
--- a/test/std/containers/associative/multimap/types.pass.cpp
+++ b/test/std/containers/associative/multimap/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
diff --git a/test/std/containers/associative/multiset/clear.pass.cpp b/test/std/containers/associative/multiset/clear.pass.cpp
index 3069de5a300d..f762ef7d3504 100644
--- a/test/std/containers/associative/multiset/clear.pass.cpp
+++ b/test/std/containers/associative/multiset/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
m.clear();
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/multiset/count.pass.cpp b/test/std/containers/associative/multiset/count.pass.cpp
index 93bd6f80eaad..997a949388cf 100644
--- a/test/std/containers/associative/multiset/count.pass.cpp
+++ b/test/std/containers/associative/multiset/count.pass.cpp
@@ -55,7 +55,7 @@ int main()
assert(r == 0);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/emplace.pass.cpp b/test/std/containers/associative/multiset/emplace.pass.cpp
index 450ee6cd35a3..93842a250f8e 100644
--- a/test/std/containers/associative/multiset/emplace.pass.cpp
+++ b/test/std/containers/associative/multiset/emplace.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/emplace_hint.pass.cpp b/test/std/containers/associative/multiset/emplace_hint.pass.cpp
index 194adf761c4c..48519fd4356a 100644
--- a/test/std/containers/associative/multiset/emplace_hint.pass.cpp
+++ b/test/std/containers/associative/multiset/emplace_hint.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/empty.pass.cpp b/test/std/containers/associative/multiset/empty.pass.cpp
index 32aef90d4188..acca4e021e0c 100644
--- a/test/std/containers/associative/multiset/empty.pass.cpp
+++ b/test/std/containers/associative/multiset/empty.pass.cpp
@@ -29,7 +29,7 @@ int main()
m.clear();
assert(m.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/multiset/equal_range.pass.cpp b/test/std/containers/associative/multiset/equal_range.pass.cpp
index 8c69d0c61ec5..7ab95cfb8f67 100644
--- a/test/std/containers/associative/multiset/equal_range.pass.cpp
+++ b/test/std/containers/associative/multiset/equal_range.pass.cpp
@@ -100,7 +100,7 @@ int main()
assert(r.second == next(m.begin(), 9));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/erase_iter.pass.cpp b/test/std/containers/associative/multiset/erase_iter.pass.cpp
index 1d41540edb8a..8ee45c64cff0 100644
--- a/test/std/containers/associative/multiset/erase_iter.pass.cpp
+++ b/test/std/containers/associative/multiset/erase_iter.pass.cpp
@@ -106,7 +106,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
@@ -186,7 +186,7 @@ int main()
assert(i == m.end());
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp b/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
index e1d7090d816f..70d3477907e3 100644
--- a/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
+++ b/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
@@ -78,7 +78,7 @@ int main()
assert(m.size() == 0);
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/multiset/erase_key.pass.cpp b/test/std/containers/associative/multiset/erase_key.pass.cpp
index e9bce1e1b640..7293bcfb2c35 100644
--- a/test/std/containers/associative/multiset/erase_key.pass.cpp
+++ b/test/std/containers/associative/multiset/erase_key.pass.cpp
@@ -72,7 +72,7 @@ int main()
assert(m.size() == 0);
assert(i == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/multiset/find.pass.cpp b/test/std/containers/associative/multiset/find.pass.cpp
index 364460a6ca3a..3b7d96fe9110 100644
--- a/test/std/containers/associative/multiset/find.pass.cpp
+++ b/test/std/containers/associative/multiset/find.pass.cpp
@@ -92,7 +92,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/incomplete_type.pass.cpp b/test/std/containers/associative/multiset/incomplete_type.pass.cpp
new file mode 100644
index 000000000000..0355e18f9f29
--- /dev/null
+++ b/test/std/containers/associative/multiset/incomplete_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// Check that std::multiset and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <set>
+
+struct A {
+ typedef std::multiset<A> Set;
+ int data;
+ Set m;
+ Set::iterator it;
+ Set::const_iterator cit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+int main() {
+ A a;
+}
diff --git a/test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp b/test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp
new file mode 100644
index 000000000000..a280d10d5ab2
--- /dev/null
+++ b/test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+// insert(...)
+
+// UNSUPPORTED: c++98, c++03
+
+#include <set>
+
+#include "container_test_types.h"
+#include "../../set_allocator_requirement_test_templates.h"
+
+int main()
+{
+ testMultisetInsert<TCT::multiset<> >();
+}
diff --git a/test/std/containers/associative/multiset/insert_cv.pass.cpp b/test/std/containers/associative/multiset/insert_cv.pass.cpp
index 179715753ab0..2aa920d70972 100644
--- a/test/std/containers/associative/multiset/insert_cv.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_cv.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(m.size() == 4);
assert(*r == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
index 7e923f2516dd..7b82cea5fbea 100644
--- a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
@@ -39,7 +39,7 @@ int main()
assert(*++i == V(10));
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp b/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
index 7d204024c212..ca08bacad2f1 100644
--- a/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(m.size() == 4);
assert(*r == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp b/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
index 189c45498669..fb664d74e4be 100644
--- a/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
@@ -51,7 +51,7 @@ int main()
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
index ee631f005c93..0afc8dc87c23 100644
--- a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(*r == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/insert_rv.pass.cpp b/test/std/containers/associative/multiset/insert_rv.pass.cpp
index 29c233e9a119..3ee464bc5bc7 100644
--- a/test/std/containers/associative/multiset/insert_rv.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_rv.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(*r == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/multiset/iterator.pass.cpp b/test/std/containers/associative/multiset/iterator.pass.cpp
index d1f0ecfd6aa0..c152a4398196 100644
--- a/test/std/containers/associative/multiset/iterator.pass.cpp
+++ b/test/std/containers/associative/multiset/iterator.pass.cpp
@@ -70,7 +70,7 @@ int main()
std::multiset<int>::const_iterator k = i;
assert(i == k);
for (int j = 1; j <= 8; ++j)
- for (int k = 0; k < 3; ++k, ++i)
+ for (int n = 0; n < 3; ++n, ++i)
assert(*i == j);
}
{
@@ -113,7 +113,7 @@ int main()
for (int k = 0; k < 3; ++k, ++i)
assert(*i == j);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
@@ -151,7 +151,7 @@ int main()
std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
assert(i == k);
for (int j = 1; j <= 8; ++j)
- for (int k = 0; k < 3; ++k, ++i)
+ for (int n = 0; n < 3; ++n, ++i)
assert(*i == j);
}
{
diff --git a/test/std/containers/associative/multiset/lower_bound.pass.cpp b/test/std/containers/associative/multiset/lower_bound.pass.cpp
index e466791d9356..ae8cfe6eff4d 100644
--- a/test/std/containers/associative/multiset/lower_bound.pass.cpp
+++ b/test/std/containers/associative/multiset/lower_bound.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(r == next(m.begin(), 9));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/max_size.pass.cpp b/test/std/containers/associative/multiset/max_size.pass.cpp
index 5524f771b341..79492c9b1c40 100644
--- a/test/std/containers/associative/multiset/max_size.pass.cpp
+++ b/test/std/containers/associative/multiset/max_size.pass.cpp
@@ -25,7 +25,7 @@ int main()
M m;
assert(m.max_size() != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
index 7d76581d6d8e..2c5318afd73b 100644
--- a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
@@ -37,7 +37,7 @@ int main()
assert(*++i == V(6));
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..2eade5299d6f
--- /dev/null
+++ b/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// Check that std::multiset fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::multiset<int, Comp<int> > m;
+}
diff --git a/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
index 5bb0312f012b..0bc50ab7aaf8 100644
--- a/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
@@ -25,7 +25,7 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::multiset<int, std::less<int>, min_allocator<int>> m;
assert(m.empty());
diff --git a/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
index bf8c53b9ee5d..15520e7834ff 100644
--- a/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,18 +31,18 @@ struct some_comp
{
typedef T value_type;
some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
@@ -49,5 +52,4 @@ int main()
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
index fd612c06dbbc..f4e868ebbc8f 100644
--- a/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
@@ -11,26 +11,24 @@
// ~multiset() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -47,5 +45,4 @@ int main()
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
index dadafec7c3b1..7327bf62646b 100644
--- a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
@@ -36,7 +36,7 @@ int main()
assert(*++i == V(6));
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
index f6c1fd76de14..ebe8353bab1f 100644
--- a/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
index 4ed00c7124cc..4313f46a03d7 100644
--- a/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
@@ -24,6 +24,7 @@
int main()
{
+ {
typedef int V;
V ar[] =
{
@@ -55,6 +56,7 @@ int main()
assert(*next(m.begin(), 6) == 3);
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
+ }
#if _LIBCPP_STD_VER > 11
{
typedef int V;
diff --git a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
index 40321cd247e1..5a905cf15a08 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
@@ -77,7 +77,7 @@ int main()
assert(distance(mo.begin(), mo.end()) == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
index 4408208f2ac4..3da3fc09a45f 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
@@ -163,7 +163,7 @@ int main()
M m1(I(a1), I(a1+num), C(), A());
assert(Counter_base::gConstructed == 2*num);
-
+
M m2(m1);
assert(m2 == m1);
assert(Counter_base::gConstructed == 3*num);
@@ -181,7 +181,7 @@ int main()
}
assert(Counter_base::gConstructed == 2*num);
}
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
index ca1ba971f5a4..b0ec4f39451c 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
@@ -142,7 +142,7 @@ int main()
assert(m1.empty());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef MoveOnly V;
typedef test_compare<std::less<MoveOnly> > C;
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
index 211bb36e7e95..57388637e97a 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
@@ -28,11 +30,11 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -49,5 +51,4 @@ int main()
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
index 31a34cbde306..e3a7beedb92b 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
@@ -26,11 +28,11 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -47,5 +49,4 @@ int main()
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp b/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
index 7745ddab78c3..7036138f8439 100644
--- a/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
@@ -96,7 +96,7 @@ int main()
assert(m2 == m1_save);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp b/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
index f456de7f6243..91ec4ce93a27 100644
--- a/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
@@ -21,6 +21,7 @@
int main()
{
typedef int V;
+ {
typedef std::multiset<int> M;
{
M m1;
@@ -94,6 +95,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef test_allocator<V> A;
typedef test_compare<std::less<int> > C;
diff --git a/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
index 8e2c67c9b5ec..87639943a0b5 100644
--- a/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <set>
// void swap(multiset& c)
@@ -15,13 +17,14 @@
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
// This tests a conforming extension
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,23 +32,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
- void deallocate(void*, unsigned) {}
-
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -57,7 +57,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -69,7 +69,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -82,7 +82,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -93,7 +93,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::multiset<MoveOnly> C;
C c1, c2;
@@ -143,6 +142,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/associative/multiset/size.pass.cpp b/test/std/containers/associative/multiset/size.pass.cpp
index 68099b566dfd..d11975b79935 100644
--- a/test/std/containers/associative/multiset/size.pass.cpp
+++ b/test/std/containers/associative/multiset/size.pass.cpp
@@ -37,7 +37,7 @@ int main()
m.erase(m.begin());
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/multiset/types.pass.cpp b/test/std/containers/associative/multiset/types.pass.cpp
index e1e3ad9100c3..b37b9b328f8f 100644
--- a/test/std/containers/associative/multiset/types.pass.cpp
+++ b/test/std/containers/associative/multiset/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
diff --git a/test/std/containers/associative/multiset/upper_bound.pass.cpp b/test/std/containers/associative/multiset/upper_bound.pass.cpp
index 7ad3d6ced3d6..7bb0c3cb41f3 100644
--- a/test/std/containers/associative/multiset/upper_bound.pass.cpp
+++ b/test/std/containers/associative/multiset/upper_bound.pass.cpp
@@ -86,7 +86,7 @@ int main()
assert(r == next(m.begin(), 9));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/clear.pass.cpp b/test/std/containers/associative/set/clear.pass.cpp
index 4439ad3b1e4e..7a5bf4b14a71 100644
--- a/test/std/containers/associative/set/clear.pass.cpp
+++ b/test/std/containers/associative/set/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
m.clear();
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/set/count.pass.cpp b/test/std/containers/associative/set/count.pass.cpp
index 32fe0b8bcee9..ddc913910b5e 100644
--- a/test/std/containers/associative/set/count.pass.cpp
+++ b/test/std/containers/associative/set/count.pass.cpp
@@ -56,7 +56,7 @@ int main()
r = m.count(4);
assert(r == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/emplace.pass.cpp b/test/std/containers/associative/set/emplace.pass.cpp
index 5ebab4d24b92..47ef455a996b 100644
--- a/test/std/containers/associative/set/emplace.pass.cpp
+++ b/test/std/containers/associative/set/emplace.pass.cpp
@@ -74,7 +74,7 @@ int main()
assert(m.size() == 1);
assert(*r.first == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef std::pair<M::iterator, bool> R;
diff --git a/test/std/containers/associative/set/emplace_hint.pass.cpp b/test/std/containers/associative/set/emplace_hint.pass.cpp
index 5fdeb4ffef3a..036f4d6dfb68 100644
--- a/test/std/containers/associative/set/emplace_hint.pass.cpp
+++ b/test/std/containers/associative/set/emplace_hint.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/set/empty.pass.cpp b/test/std/containers/associative/set/empty.pass.cpp
index eb1080263f4f..1eaa8fc90537 100644
--- a/test/std/containers/associative/set/empty.pass.cpp
+++ b/test/std/containers/associative/set/empty.pass.cpp
@@ -29,7 +29,7 @@ int main()
m.clear();
assert(m.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/set/equal_range.pass.cpp b/test/std/containers/associative/set/equal_range.pass.cpp
index 8a180ef49248..ed41f691a459 100644
--- a/test/std/containers/associative/set/equal_range.pass.cpp
+++ b/test/std/containers/associative/set/equal_range.pass.cpp
@@ -158,7 +158,7 @@ int main()
assert(r.second == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/erase_iter.pass.cpp b/test/std/containers/associative/set/erase_iter.pass.cpp
index 36828be86f28..85be1f5b9c21 100644
--- a/test/std/containers/associative/set/erase_iter.pass.cpp
+++ b/test/std/containers/associative/set/erase_iter.pass.cpp
@@ -106,7 +106,7 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
@@ -186,7 +186,7 @@ int main()
assert(i == m.end());
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/associative/set/erase_iter_iter.pass.cpp b/test/std/containers/associative/set/erase_iter_iter.pass.cpp
index 479950316655..775e6cea06fa 100644
--- a/test/std/containers/associative/set/erase_iter_iter.pass.cpp
+++ b/test/std/containers/associative/set/erase_iter_iter.pass.cpp
@@ -78,7 +78,7 @@ int main()
assert(m.size() == 0);
assert(i == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/set/erase_key.pass.cpp b/test/std/containers/associative/set/erase_key.pass.cpp
index 9d92bd70d700..6fc15d9ccfd4 100644
--- a/test/std/containers/associative/set/erase_key.pass.cpp
+++ b/test/std/containers/associative/set/erase_key.pass.cpp
@@ -109,7 +109,7 @@ int main()
assert(m.size() == 0);
assert(i == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/set/find.pass.cpp b/test/std/containers/associative/set/find.pass.cpp
index d08d2fb1e245..60f16fcd65d4 100644
--- a/test/std/containers/associative/set/find.pass.cpp
+++ b/test/std/containers/associative/set/find.pass.cpp
@@ -92,7 +92,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/incomplete_type.pass.cpp b/test/std/containers/associative/set/incomplete_type.pass.cpp
new file mode 100644
index 000000000000..d3a1d6638d7e
--- /dev/null
+++ b/test/std/containers/associative/set/incomplete_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// Check that std::set and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <set>
+
+struct A {
+ typedef std::set<A> Set;
+ int data;
+ Set m;
+ Set::iterator it;
+ Set::const_iterator cit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+int main() {
+ A a;
+}
diff --git a/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp b/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
new file mode 100644
index 000000000000..b14340b1d763
--- /dev/null
+++ b/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// insert(...)
+// emplace(...)
+// emplace_hint(...)
+
+// UNSUPPORTED: c++98, c++03
+
+#include <set>
+#include "container_test_types.h"
+#include "../../set_allocator_requirement_test_templates.h"
+
+int main()
+{
+ testSetInsert<TCT::set<> >();
+ testSetEmplace<TCT::set<> >();
+ testSetEmplaceHint<TCT::set<> >();
+}
diff --git a/test/std/containers/associative/set/insert_cv.pass.cpp b/test/std/containers/associative/set/insert_cv.pass.cpp
index 18d5c2e03395..8d5290a97af9 100644
--- a/test/std/containers/associative/set/insert_cv.pass.cpp
+++ b/test/std/containers/associative/set/insert_cv.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(m.size() == 3);
assert(*r.first == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef std::pair<M::iterator, bool> R;
diff --git a/test/std/containers/associative/set/insert_initializer_list.pass.cpp b/test/std/containers/associative/set/insert_initializer_list.pass.cpp
index fc6d612b2ebe..60a6e754e17e 100644
--- a/test/std/containers/associative/set/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/set/insert_initializer_list.pass.cpp
@@ -38,7 +38,7 @@ int main()
assert(*++i == V(8));
assert(*++i == V(10));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/set/insert_iter_cv.pass.cpp b/test/std/containers/associative/set/insert_iter_cv.pass.cpp
index 718e720559f4..12d6402a87c2 100644
--- a/test/std/containers/associative/set/insert_iter_cv.pass.cpp
+++ b/test/std/containers/associative/set/insert_iter_cv.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(m.size() == 3);
assert(*r == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/set/insert_iter_iter.pass.cpp b/test/std/containers/associative/set/insert_iter_iter.pass.cpp
index ff729a0e7b9b..46edd0db0468 100644
--- a/test/std/containers/associative/set/insert_iter_iter.pass.cpp
+++ b/test/std/containers/associative/set/insert_iter_iter.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
diff --git a/test/std/containers/associative/set/insert_iter_rv.pass.cpp b/test/std/containers/associative/set/insert_iter_rv.pass.cpp
index 296ead84914d..be827d644d26 100644
--- a/test/std/containers/associative/set/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/set/insert_iter_rv.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(m.size() == 3);
assert(*r == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
typedef M::iterator R;
diff --git a/test/std/containers/associative/set/insert_rv.pass.cpp b/test/std/containers/associative/set/insert_rv.pass.cpp
index 32cede154956..e528ef347b88 100644
--- a/test/std/containers/associative/set/insert_rv.pass.cpp
+++ b/test/std/containers/associative/set/insert_rv.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(m.size() == 3);
assert(*r.first == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
typedef std::pair<M::iterator, bool> R;
diff --git a/test/std/containers/associative/set/iterator.pass.cpp b/test/std/containers/associative/set/iterator.pass.cpp
index ecd950f03a00..c318341ce859 100644
--- a/test/std/containers/associative/set/iterator.pass.cpp
+++ b/test/std/containers/associative/set/iterator.pass.cpp
@@ -111,7 +111,7 @@ int main()
for (int j = 1; j <= m.size(); ++j, ++i)
assert(*i == j);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/set/lower_bound.pass.cpp b/test/std/containers/associative/set/lower_bound.pass.cpp
index df202f31a4c3..55d49a097ef6 100644
--- a/test/std/containers/associative/set/lower_bound.pass.cpp
+++ b/test/std/containers/associative/set/lower_bound.pass.cpp
@@ -124,7 +124,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
@@ -281,7 +281,7 @@ int main()
r = m.lower_bound(20);
assert(r == next(m.begin(), 8));
}
-
+
{
typedef PrivateConstructor V;
typedef std::set<V, std::less<>> M;
diff --git a/test/std/containers/associative/set/max_size.pass.cpp b/test/std/containers/associative/set/max_size.pass.cpp
index cde4397c7178..9df6a4157e11 100644
--- a/test/std/containers/associative/set/max_size.pass.cpp
+++ b/test/std/containers/associative/set/max_size.pass.cpp
@@ -25,7 +25,7 @@ int main()
M m;
assert(m.max_size() != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
index 892ae5a0a799..70e174a59612 100644
--- a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
@@ -36,7 +36,7 @@ int main()
assert(*++i == V(5));
assert(*++i == V(6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..dcf23effc443
--- /dev/null
+++ b/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// Check that std::set fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::set<int, Comp<int> > m;
+}
diff --git a/test/std/containers/associative/set/set.cons/default.pass.cpp b/test/std/containers/associative/set/set.cons/default.pass.cpp
index 746a2d173071..4c924ca70e96 100644
--- a/test/std/containers/associative/set/set.cons/default.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/default.pass.cpp
@@ -25,7 +25,7 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::set<int, std::less<int>, min_allocator<int>> m;
assert(m.empty());
diff --git a/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
index 2156169acbc4..6293c24a43d3 100644
--- a/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,18 +31,18 @@ struct some_comp
{
typedef T value_type;
some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
@@ -49,5 +52,4 @@ int main()
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
index b554d828d486..60d1d42c3d9c 100644
--- a/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
@@ -11,26 +11,24 @@
// ~set() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -47,5 +45,4 @@ int main()
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
index 2ad538e143f8..5bb5460ddc0d 100644
--- a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
@@ -35,7 +35,7 @@ int main()
assert(*++i == V(5));
assert(*++i == V(6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp b/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
index 7ca7fe14d6c4..db765bd9e337 100644
--- a/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
index 5ccb6e5cbcd7..077a749caaca 100644
--- a/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
@@ -28,6 +28,7 @@
int main()
{
+ {
typedef int V;
V ar[] =
{
@@ -53,6 +54,7 @@ int main()
assert(*m.begin() == 1);
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
+ }
#if _LIBCPP_STD_VER > 11
{
typedef int V;
diff --git a/test/std/containers/associative/set/set.cons/move.pass.cpp b/test/std/containers/associative/set/set.cons/move.pass.cpp
index 4026ec70c3e1..c836d4550203 100644
--- a/test/std/containers/associative/set/set.cons/move.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move.pass.cpp
@@ -70,7 +70,7 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
index 799f0e402d63..ba2adf5bb520 100644
--- a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
@@ -163,7 +163,7 @@ int main()
M m1(I(a1), I(a1+num), C(), A());
assert(Counter_base::gConstructed == 3+num);
-
+
M m2(m1);
assert(m2 == m1);
assert(Counter_base::gConstructed == 6+num);
@@ -181,7 +181,7 @@ int main()
}
assert(Counter_base::gConstructed == 3+num);
}
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
index ed0e77ae1796..07cb4153fa4a 100644
--- a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
@@ -141,7 +141,7 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef MoveOnly V;
typedef test_compare<std::less<MoveOnly> > C;
diff --git a/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
index 3999c55e9e7c..3f7d783b7630 100644
--- a/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
@@ -28,11 +30,11 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -49,5 +51,4 @@ int main()
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
index 5ccfed4675c5..72c2f7530a9e 100644
--- a/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <set>
#include <cassert>
@@ -26,11 +28,11 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -47,5 +49,4 @@ int main()
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/associative/set/set.special/member_swap.pass.cpp b/test/std/containers/associative/set/set.special/member_swap.pass.cpp
index b5129f880afd..486d5f44291b 100644
--- a/test/std/containers/associative/set/set.special/member_swap.pass.cpp
+++ b/test/std/containers/associative/set/set.special/member_swap.pass.cpp
@@ -96,7 +96,7 @@ int main()
assert(m2 == m1_save);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
diff --git a/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp b/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
index 0ac14464c70f..3d2d7d7d3bbc 100644
--- a/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
@@ -21,6 +21,7 @@
int main()
{
typedef int V;
+ {
typedef std::set<int> M;
{
M m1;
@@ -94,6 +95,7 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
{
typedef test_allocator<V> A;
typedef test_compare<std::less<int> > C;
diff --git a/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp b/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
index 3ec697612754..0eb7d871b8b4 100644
--- a/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <set>
// void swap(set& c)
@@ -15,13 +17,14 @@
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
// This tests a conforming extension
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,23 +32,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
- void deallocate(void*, unsigned) {}
-
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -57,7 +57,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -69,7 +69,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -82,7 +82,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -93,7 +93,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::set<MoveOnly> C;
C c1, c2;
@@ -144,5 +143,4 @@ int main()
}
#endif
-#endif
}
diff --git a/test/std/containers/associative/set/size.pass.cpp b/test/std/containers/associative/set/size.pass.cpp
index e78654735508..853aeca74366 100644
--- a/test/std/containers/associative/set/size.pass.cpp
+++ b/test/std/containers/associative/set/size.pass.cpp
@@ -37,7 +37,7 @@ int main()
m.erase(m.begin());
assert(m.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> M;
M m;
diff --git a/test/std/containers/associative/set/types.pass.cpp b/test/std/containers/associative/set/types.pass.cpp
index 3362c42aee42..f1ce8a7c975c 100644
--- a/test/std/containers/associative/set/types.pass.cpp
+++ b/test/std/containers/associative/set/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
diff --git a/test/std/containers/associative/set/upper_bound.pass.cpp b/test/std/containers/associative/set/upper_bound.pass.cpp
index 10a28f064698..9d4ab2805d0d 100644
--- a/test/std/containers/associative/set/upper_bound.pass.cpp
+++ b/test/std/containers/associative/set/upper_bound.pass.cpp
@@ -124,7 +124,7 @@ int main()
assert(r == next(m.begin(), 8));
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
@@ -281,7 +281,7 @@ int main()
r = m.upper_bound(20);
assert(r == next(m.begin(), 8));
}
-
+
{
typedef PrivateConstructor V;
typedef std::set<V, std::less<>> M;
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
index 66ca614126f4..dc5cca3c5568 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
@@ -16,6 +16,7 @@
#include <queue>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class C>
@@ -41,11 +42,11 @@ struct test
: base(comp, a) {}
test(const value_compare& comp, const container_type& c,
const test_allocator<int>& a) : base(comp, c, a) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11 // testing rvalue constructor
test(const value_compare& comp, container_type&& c,
const test_allocator<int>& a) : base(comp, std::move(c), a) {}
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
test_allocator<int> get_allocator() {return c.get_allocator();}
using base::c;
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
index 643b0c625abb..a27a6e205123 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
@@ -16,6 +16,7 @@
#include <queue>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class C>
@@ -41,11 +42,11 @@ struct test
: base(comp, a) {}
test(const value_compare& comp, const container_type& c,
const test_allocator<int>& a) : base(comp, c, a) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11 // testing rvalue ctor
test(const value_compare& comp, container_type&& c,
const test_allocator<int>& a) : base(comp, std::move(c), a) {}
test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
test_allocator<int> get_allocator() {return c.get_allocator();}
using base::c;
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
index cdfa58b58554..c79feb93eb6c 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
@@ -15,17 +15,18 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::priority_queue<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
index e3d071d9aad0..3cedefef2c87 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
@@ -11,6 +11,8 @@
// ~priority_queue() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
@@ -18,10 +20,8 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::priority_queue<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
index 590d82fe6da4..f14c3ae7ce43 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
@@ -22,10 +24,8 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::priority_queue<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
index 05ff253d31b4..0218992670f2 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
@@ -22,10 +24,8 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::priority_queue<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
index 4d2b441c60ee..bfff607590fe 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
@@ -22,11 +24,9 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::priority_queue<MoveOnly> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/priority.queue/types.fail.cpp b/test/std/containers/container.adaptors/priority.queue/types.fail.cpp
new file mode 100644
index 000000000000..0d3025e1739a
--- /dev/null
+++ b/test/std/containers/container.adaptors/priority.queue/types.fail.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container = vector<T>,
+// class Compare = less<typename Container::value_type>>
+// class priority_queue
+// {
+// public:
+// typedef Container container_type;
+// typedef typename container_type::value_type value_type;
+// typedef typename container_type::reference reference;
+// typedef typename container_type::const_reference const_reference;
+// typedef typename container_type::size_type size_type;
+//
+// protected:
+// container_type c;
+// Compare comp;
+
+#include <queue>
+#include <cassert>
+#include <type_traits>
+
+int main()
+{
+// LWG#2566 says that the first template param must match the second one's value type
+ std::priority_queue<double, std::deque<int>> t;
+}
diff --git a/test/std/containers/container.adaptors/priority.queue/types.pass.cpp b/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
index ade20d47d4e3..6bc476a3ce05 100644
--- a/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
@@ -15,6 +15,7 @@
// {
// public:
// typedef Container container_type;
+// typedef Compare value_compare; // LWG#2684
// typedef typename container_type::value_type value_type;
// typedef typename container_type::reference reference;
// typedef typename container_type::const_reference const_reference;
@@ -26,7 +27,11 @@
#include <queue>
#include <cassert>
+#include <deque>
+#include <functional>
+#include <memory>
#include <type_traits>
+#include <vector>
struct test
: private std::priority_queue<int>
@@ -48,13 +53,16 @@ struct C
int main()
{
- static_assert((std::is_same<std::priority_queue<int>::container_type, std::vector<int> >::value), "");
- static_assert((std::is_same<std::priority_queue<double, std::deque<int> >::container_type, std::deque<int> >::value), "");
- static_assert((std::is_same<std::priority_queue<double, std::deque<int> >::value_type, int>::value), "");
- static_assert((std::is_same<std::priority_queue<int>::reference, std::vector<int>::reference>::value), "");
- static_assert((std::is_same<std::priority_queue<int>::const_reference, std::vector<int>::const_reference>::value), "");
- static_assert((std::is_same<std::priority_queue<int>::size_type, std::vector<int>::size_type>::value), "");
- static_assert((std::uses_allocator<std::priority_queue<int>, std::allocator<int> >::value), "");
+ static_assert(( std::is_same<std::priority_queue<int>::container_type, std::vector<int> >::value), "");
+ static_assert(( std::is_same<std::priority_queue<int, std::deque<int> >::container_type, std::deque<int> >::value), "");
+ static_assert(( std::is_same<std::priority_queue<int, std::deque<int> >::value_type, int>::value), "");
+ static_assert(( std::is_same<std::priority_queue<int>::reference, std::vector<int>::reference>::value), "");
+ static_assert(( std::is_same<std::priority_queue<int>::const_reference, std::vector<int>::const_reference>::value), "");
+ static_assert(( std::is_same<std::priority_queue<int>::size_type, std::vector<int>::size_type>::value), "");
+ static_assert(( std::is_same<std::priority_queue<int>::value_compare, std::less<int> >::value), "");
+ static_assert(( std::is_same<std::priority_queue<int, std::deque<int> >::value_compare, std::less<int> >::value), "");
+ static_assert(( std::is_same<std::priority_queue<int, std::deque<int>, std::greater<int> >::value_compare, std::greater<int> >::value), "");
+ static_assert(( std::uses_allocator<std::priority_queue<int>, std::allocator<int> >::value), "");
static_assert((!std::uses_allocator<std::priority_queue<int, C>, std::allocator<int> >::value), "");
test t;
}
diff --git a/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
index 392853432669..43045893fe07 100644
--- a/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
@@ -14,17 +14,18 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::queue<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
index d9b8f731f28a..2a6783287b09 100644
--- a/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
@@ -11,6 +11,8 @@
// ~queue() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
@@ -18,10 +20,8 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::queue<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
index beef0f12ffb7..42e1c458c9da 100644
--- a/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
@@ -21,10 +23,8 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::queue<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
index 2402e609b988..1c13b622c0a5 100644
--- a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
@@ -21,10 +23,8 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::queue<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/queue/queue.defn/types.fail.cpp b/test/std/containers/container.adaptors/queue/queue.defn/types.fail.cpp
new file mode 100644
index 000000000000..2b8341fff009
--- /dev/null
+++ b/test/std/containers/container.adaptors/queue/queue.defn/types.fail.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+#include <queue>
+#include <cassert>
+#include <type_traits>
+
+int main()
+{
+// LWG#2566 says that the first template param must match the second one's value type
+ std::queue<double, std::deque<int>> t;
+}
diff --git a/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp
index cc918a361707..7f1883a16838 100644
--- a/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp
@@ -46,13 +46,13 @@ struct C
int main()
{
- static_assert((std::is_same<std::queue<int>::container_type, std::deque<int> >::value), "");
- static_assert((std::is_same<std::queue<double, std::vector<int> >::container_type, std::vector<int> >::value), "");
- static_assert((std::is_same<std::queue<double, std::vector<int> >::value_type, int>::value), "");
- static_assert((std::is_same<std::queue<int>::reference, std::deque<int>::reference>::value), "");
- static_assert((std::is_same<std::queue<int>::const_reference, std::deque<int>::const_reference>::value), "");
- static_assert((std::is_same<std::queue<int>::size_type, std::deque<int>::size_type>::value), "");
- static_assert((std::uses_allocator<std::queue<int>, std::allocator<int> >::value), "");
+ static_assert(( std::is_same<std::queue<int>::container_type, std::deque<int> >::value), "");
+ static_assert(( std::is_same<std::queue<int, std::vector<int> >::container_type, std::vector<int> >::value), "");
+ static_assert(( std::is_same<std::queue<int, std::vector<int> >::value_type, int>::value), "");
+ static_assert(( std::is_same<std::queue<int>::reference, std::deque<int>::reference>::value), "");
+ static_assert(( std::is_same<std::queue<int>::const_reference, std::deque<int>::const_reference>::value), "");
+ static_assert(( std::is_same<std::queue<int>::size_type, std::deque<int>::size_type>::value), "");
+ static_assert(( std::uses_allocator<std::queue<int>, std::allocator<int> >::value), "");
static_assert((!std::uses_allocator<std::queue<int, C>, std::allocator<int> >::value), "");
test t;
}
diff --git a/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
index cfe4a1bb7076..e18f80a91198 100644
--- a/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <queue>
#include <cassert>
@@ -21,11 +23,9 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::queue<MoveOnly> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
index bab55863b55f..2d1f9437fc45 100644
--- a/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
@@ -14,17 +14,18 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <stack>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::stack<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp
index 477bd57a6d10..0a0111b4dc46 100644
--- a/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp
@@ -11,6 +11,8 @@
// ~stack() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <stack>
#include <cassert>
@@ -18,10 +20,8 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::stack<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp
index dd836796dc17..d5822839cabf 100644
--- a/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <stack>
#include <cassert>
@@ -21,10 +23,8 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::stack<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
index cfc660b36def..7eb563c76835 100644
--- a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <stack>
#include <cassert>
@@ -21,10 +23,8 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::stack<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/container.adaptors/stack/stack.defn/types.fail.cpp b/test/std/containers/container.adaptors/stack/stack.defn/types.fail.cpp
new file mode 100644
index 000000000000..ee4c5441e7c3
--- /dev/null
+++ b/test/std/containers/container.adaptors/stack/stack.defn/types.fail.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container = vector<T>,
+// class Compare = less<typename Container::value_type>>
+// class priority_queue
+// {
+// public:
+// typedef Container container_type;
+// typedef typename container_type::value_type value_type;
+// typedef typename container_type::reference reference;
+// typedef typename container_type::const_reference const_reference;
+// typedef typename container_type::size_type size_type;
+//
+// protected:
+// container_type c;
+// Compare comp;
+
+#include <stack>
+#include <cassert>
+#include <type_traits>
+
+int main()
+{
+// LWG#2566 says that the first template param must match the second one's value type
+ std::stack<double, std::deque<int>> t;
+}
diff --git a/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp
index afc5ebd53753..77a798b8382a 100644
--- a/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp
@@ -47,13 +47,13 @@ struct C
int main()
{
- static_assert((std::is_same<std::stack<int>::container_type, std::deque<int> >::value), "");
- static_assert((std::is_same<std::stack<double, std::vector<int> >::container_type, std::vector<int> >::value), "");
- static_assert((std::is_same<std::stack<double, std::vector<int> >::value_type, int>::value), "");
- static_assert((std::is_same<std::stack<int>::reference, std::deque<int>::reference>::value), "");
- static_assert((std::is_same<std::stack<int>::const_reference, std::deque<int>::const_reference>::value), "");
- static_assert((std::is_same<std::stack<int>::size_type, std::deque<int>::size_type>::value), "");
- static_assert((std::uses_allocator<std::stack<int>, std::allocator<int> >::value), "");
+ static_assert(( std::is_same<std::stack<int>::container_type, std::deque<int> >::value), "");
+ static_assert(( std::is_same<std::stack<int, std::vector<int> >::container_type, std::vector<int> >::value), "");
+ static_assert(( std::is_same<std::stack<int, std::vector<int> >::value_type, int>::value), "");
+ static_assert(( std::is_same<std::stack<int>::reference, std::deque<int>::reference>::value), "");
+ static_assert(( std::is_same<std::stack<int>::const_reference, std::deque<int>::const_reference>::value), "");
+ static_assert(( std::is_same<std::stack<int>::size_type, std::deque<int>::size_type>::value), "");
+ static_assert(( std::uses_allocator<std::stack<int>, std::allocator<int> >::value), "");
static_assert((!std::uses_allocator<std::stack<int, C>, std::allocator<int> >::value), "");
test t;
}
diff --git a/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
index 80e024f5f1e0..976e362a0483 100644
--- a/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <stack>
#include <cassert>
@@ -21,11 +23,9 @@
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::stack<MoveOnly> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
-#endif
}
diff --git a/test/std/containers/map_allocator_requirement_test_templates.h b/test/std/containers/map_allocator_requirement_test_templates.h
new file mode 100644
index 000000000000..2ae3a2e3c87a
--- /dev/null
+++ b/test/std/containers/map_allocator_requirement_test_templates.h
@@ -0,0 +1,743 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef MAP_ALLOCATOR_REQUIREMENT_TEST_TEMPLATES_H
+#define MAP_ALLOCATOR_REQUIREMENT_TEST_TEMPLATES_H
+
+// <map>
+// <unordered_map>
+
+// class map
+// class unordered_map
+
+// insert(...);
+// emplace(...);
+// emplace_hint(...);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <cassert>
+
+#include "test_macros.h"
+#include "count_new.hpp"
+#include "container_test_types.h"
+#include "assert_checkpoint.h"
+
+
+template <class Container>
+void testMapInsert()
+{
+ typedef typename Container::value_type ValueTp;
+ typedef typename Container::key_type Key;
+ typedef typename Container::mapped_type Mapped;
+ typedef Container C;
+ typedef std::pair<typename C::iterator, bool> R;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::insert(const value_type&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&>();
+ assert(c.insert(v).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42, 1);
+ assert(c.insert(v2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(value_type&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<const ValueTp&>();
+ assert(c.insert(v).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42, 1);
+ assert(c.insert(v2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(value_type&&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&&>();
+ assert(c.insert(std::move(v)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42, 1);
+ assert(c.insert(std::move(v2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(const value_type&&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&>();
+ assert(c.insert(std::move(v)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42, 1);
+ assert(c.insert(std::move(v2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert({key, value})");
+ Container c;
+ cc->expect<ValueTp&&>();
+ assert(c.insert({42, 1}).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42, 1);
+ assert(c.insert(std::move(v2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(std::initializer_list<ValueTp>)");
+ Container c;
+ std::initializer_list<ValueTp> il = { ValueTp(1, 1), ValueTp(2, 1) };
+ cc->expect<ValueTp const&>(2);
+ c.insert(il);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ c.insert(il);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type const&");
+ Container c;
+ const ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1) };
+ cc->expect<ValueTp const&>(3);
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type&&");
+ Container c;
+ ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ cc->expect<ValueTp&&>(3);
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)),
+ std::move_iterator<ValueTp*>(std::end(ValueList)));
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp ValueList2[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList2)),
+ std::move_iterator<ValueTp*>(std::end(ValueList2)));
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type&");
+ Container c;
+ ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ cc->expect<ValueTp const&>(3);
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ }
+ }
+}
+
+
+template <class Container>
+void testMapInsertHint()
+{
+ typedef typename Container::value_type ValueTp;
+ typedef typename Container::key_type Key;
+ typedef typename Container::mapped_type Mapped;
+ typedef typename std::pair<Key, Mapped> NonConstKeyPair;
+ typedef Container C;
+ typedef typename C::iterator It;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::insert(p, const value_type&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&>();
+ It ret = c.insert(c.end(), v);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42, 1);
+ It ret2 = c.insert(c.begin(), v2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(p, value_type&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp const&>();
+ It ret = c.insert(c.end(), v);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42, 1);
+ It ret2 = c.insert(c.begin(), v2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(p, value_type&&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&&>();
+ It ret = c.insert(c.end(), std::move(v));
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42, 1);
+ It ret2 = c.insert(c.begin(), std::move(v2));
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(p, {key, value})");
+ Container c;
+ cc->expect<ValueTp&&>();
+ It ret = c.insert(c.end(), {42, 1});
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ It ret2 = c.insert(c.begin(), {42, 1});
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(p, const value_type&&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&>();
+ It ret = c.insert(c.end(), std::move(v));
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42, 1);
+ It ret2 = c.insert(c.begin(), std::move(v2));
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(p, pair<Key, Mapped> const&)");
+ Container c;
+ const NonConstKeyPair v(42, 1);
+ cc->expect<const NonConstKeyPair&>();
+ It ret = c.insert(c.end(), v);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const NonConstKeyPair v2(42, 1);
+ It ret2 = c.insert(c.begin(), v2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(p, pair<Key, Mapped>&&)");
+ Container c;
+ NonConstKeyPair v(42, 1);
+ cc->expect<NonConstKeyPair&&>();
+ It ret = c.insert(c.end(), std::move(v));
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ NonConstKeyPair v2(42, 1);
+ It ret2 = c.insert(c.begin(), std::move(v2));
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+
+
+}
+
+
+template <class Container>
+void testMapEmplace()
+{
+ typedef typename Container::value_type ValueTp;
+ typedef typename Container::key_type Key;
+ typedef typename Container::mapped_type Mapped;
+ typedef typename std::pair<Key, Mapped> NonConstKeyPair;
+ typedef Container C;
+ typedef std::pair<typename C::iterator, bool> R;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::emplace(const value_type&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&>();
+ assert(c.emplace(v).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42, 1);
+ assert(c.emplace(v2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(value_type&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&>();
+ assert(c.emplace(v).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42, 1);
+ assert(c.emplace(v2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(value_type&&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&&>();
+ assert(c.emplace(std::move(v)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42, 1);
+ assert(c.emplace(std::move(v2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(const value_type&&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&&>();
+ assert(c.emplace(std::move(v)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42, 1);
+ assert(c.emplace(std::move(v2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(pair<Key, Mapped> const&)");
+ Container c;
+ const NonConstKeyPair v(42, 1);
+ cc->expect<const NonConstKeyPair&>();
+ assert(c.emplace(v).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const NonConstKeyPair v2(42, 1);
+ assert(c.emplace(v2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(pair<Key, Mapped> &&)");
+ Container c;
+ NonConstKeyPair v(42, 1);
+ cc->expect<NonConstKeyPair&&>();
+ assert(c.emplace(std::move(v)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ NonConstKeyPair v2(42, 1);
+ assert(c.emplace(std::move(v2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(const Key&, ConvertibleToMapped&&)");
+ Container c;
+ const Key k(42);
+ cc->expect<Key const&, int&&>();
+ assert(c.emplace(k, 1).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const Key k2(42);
+ assert(c.emplace(k2, 2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(Key&, Mapped&)");
+ Container c;
+ Key k(42);
+ Mapped m(1);
+ cc->expect<Key&, Mapped&>();
+ assert(c.emplace(k, m).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ Key k2(42);
+ assert(c.emplace(k2, m).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(Key&&, Mapped&&)");
+ Container c;
+ Key k(42);
+ Mapped m(1);
+ cc->expect<Key&&, Mapped&&>();
+ assert(c.emplace(std::move(k), std::move(m)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ Key k2(42);
+ Mapped m2(2);
+ assert(c.emplace(std::move(k2), std::move(m2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(ConvertibleToKey&&, ConvertibleToMapped&&)");
+ Container c;
+ cc->expect<int&&, int&&>();
+ assert(c.emplace(42, 1).second);
+ assert(!cc->unchecked());
+ {
+ // test that emplacing a duplicate item allocates. We cannot optimize
+ // this case because int&& does not match the type of key exactly.
+ cc->expect<int&&, int&&>();
+ assert(c.emplace(42, 1).second == false);
+ assert(!cc->unchecked());
+ }
+ }
+}
+
+
+template <class Container>
+void testMapEmplaceHint()
+{
+ typedef typename Container::value_type ValueTp;
+ typedef typename Container::key_type Key;
+ typedef typename Container::mapped_type Mapped;
+ typedef typename std::pair<Key, Mapped> NonConstKeyPair;
+ typedef Container C;
+ typedef typename C::iterator It;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, const value_type&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&>();
+ It ret = c.emplace_hint(c.end(), v);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42, 1);
+ It ret2 = c.emplace_hint(c.begin(), v2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, value_type&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&>();
+ It ret = c.emplace_hint(c.end(), v);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42, 1);
+ It ret2 = c.emplace_hint(c.begin(), v2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, value_type&&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&&>();
+ It ret = c.emplace_hint(c.end(), std::move(v));
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42, 1);
+ It ret2 = c.emplace_hint(c.begin(), std::move(v2));
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, const value_type&&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&&>();
+ It ret = c.emplace_hint(c.end(), std::move(v));
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42, 1);
+ It ret2 = c.emplace_hint(c.begin(), std::move(v2));
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, pair<Key, Mapped> const&)");
+ Container c;
+ const NonConstKeyPair v(42, 1);
+ cc->expect<const NonConstKeyPair&>();
+ It ret = c.emplace_hint(c.end(), v);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const NonConstKeyPair v2(42, 1);
+ It ret2 = c.emplace_hint(c.begin(), v2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, pair<Key, Mapped>&&)");
+ Container c;
+ NonConstKeyPair v(42, 1);
+ cc->expect<NonConstKeyPair&&>();
+ It ret = c.emplace_hint(c.end(), std::move(v));
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ NonConstKeyPair v2(42, 1);
+ It ret2 = c.emplace_hint(c.begin(), std::move(v2));
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, const Key&, ConvertibleToMapped&&)");
+ Container c;
+ const Key k(42);
+ cc->expect<Key const&, int&&>();
+ It ret = c.emplace_hint(c.end(), k, 42);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const Key k2(42);
+ It ret2 = c.emplace_hint(c.begin(), k2, 1);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, Key&, Mapped&)");
+ Container c;
+ Key k(42);
+ Mapped m(1);
+ cc->expect<Key&, Mapped&>();
+ It ret = c.emplace_hint(c.end(), k, m);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ Key k2(42);
+ Mapped m2(2);
+ It ret2 = c.emplace_hint(c.begin(), k2, m2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, Key&&, Mapped&&)");
+ Container c;
+ Key k(42);
+ Mapped m(1);
+ cc->expect<Key&&, Mapped&&>();
+ It ret = c.emplace_hint(c.end(), std::move(k), std::move(m));
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ Key k2(42);
+ Mapped m2(2);
+ It ret2 = c.emplace_hint(c.begin(), std::move(k2), std::move(m2));
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, ConvertibleToKey&&, ConvertibleToMapped&&)");
+ Container c;
+ cc->expect<int&&, int&&>();
+ It ret = c.emplace_hint(c.end(), 42, 1);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ cc->expect<int&&, int&&>();
+ It ret2 = c.emplace_hint(c.begin(), 42, 2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ }
+ }
+
+}
+
+
+template <class Container>
+void testMultimapInsert()
+{
+ typedef typename Container::value_type ValueTp;
+ typedef Container C;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::insert(const value_type&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&>();
+ c.insert(v);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(value_type&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&>();
+ c.insert(v);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(value_type&&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&&>();
+ c.insert(std::move(v));
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert({key, value})");
+ Container c;
+ cc->expect<ValueTp&&>();
+ c.insert({42, 1});
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(std::initializer_list<ValueTp>)");
+ Container c;
+ std::initializer_list<ValueTp> il = { ValueTp(1, 1), ValueTp(2, 1) };
+ cc->expect<ValueTp const&>(2);
+ c.insert(il);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type const&");
+ Container c;
+ const ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1) };
+ cc->expect<ValueTp const&>(3);
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type&&");
+ Container c;
+ ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ cc->expect<ValueTp&&>(3);
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)),
+ std::move_iterator<ValueTp*>(std::end(ValueList)));
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type&");
+ Container c;
+ ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ cc->expect<ValueTp&>(3);
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ assert(!cc->unchecked());
+ }
+}
+
+
+template <class Container>
+void testMultimapInsertHint()
+{
+ typedef typename Container::value_type ValueTp;
+ typedef Container C;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::insert(p, const value_type&)");
+ Container c;
+ const ValueTp v(42, 1);
+ cc->expect<const ValueTp&>();
+ c.insert(c.begin(), v);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(p, value_type&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&>();
+ c.insert(c.begin(), v);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(p, value_type&&)");
+ Container c;
+ ValueTp v(42, 1);
+ cc->expect<ValueTp&&>();
+ c.insert(c.begin(), std::move(v));
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(p, {key, value})");
+ Container c;
+ cc->expect<ValueTp&&>();
+ c.insert(c.begin(), {42, 1});
+ assert(!cc->unchecked());
+ }
+}
+
+#endif
diff --git a/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp b/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
index 5e429adb6fc9..64ea75a40064 100644
--- a/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
+++ b/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
@@ -35,4 +35,18 @@ int main()
C c = {};
assert(c.size() == 0);
}
+
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c = {1};
+ assert(c.size() == 3.0);
+ assert(c[0] == 1);
+ }
+ {
+ typedef int T;
+ typedef std::array<T, 1> C;
+ C c = {};
+ assert(c.size() == 1);
+ }
}
diff --git a/test/std/containers/sequences/array/array.special/swap.pass.cpp b/test/std/containers/sequences/array/array.special/swap.pass.cpp
index c1b0b235ab34..413f291a2a36 100644
--- a/test/std/containers/sequences/array/array.special/swap.pass.cpp
+++ b/test/std/containers/sequences/array/array.special/swap.pass.cpp
@@ -14,10 +14,28 @@
#include <array>
#include <cassert>
+#include "test_macros.h"
// std::array is explicitly allowed to be initialized with A a = { init-list };.
// Disable the missing braces warning for this reason.
#include "disable_missing_braces_warning.h"
+struct NonSwappable {
+ NonSwappable() {}
+private:
+ NonSwappable(NonSwappable const&);
+ NonSwappable& operator=(NonSwappable const&);
+};
+
+template <class Tp>
+decltype(swap(std::declval<Tp>(), std::declval<Tp>()))
+can_swap_imp(int);
+
+template <class Tp>
+std::false_type can_swap_imp(...);
+
+template <class Tp>
+struct can_swap : std::is_same<decltype(can_swap_imp<Tp>(0)), void> {};
+
int main()
{
{
@@ -44,4 +62,24 @@ int main()
assert(c1.size() == 0);
assert(c2.size() == 0);
}
+ {
+ typedef NonSwappable T;
+ typedef std::array<T, 0> C0;
+ static_assert(can_swap<C0&>::value, "");
+ C0 l = {};
+ C0 r = {};
+ swap(l, r);
+#if TEST_STD_VER >= 11
+ static_assert(noexcept(swap(l, r)), "");
+#endif
+ }
+#if TEST_STD_VER >= 11
+ {
+ // NonSwappable is still considered swappable in C++03 because there
+ // is no access control SFINAE.
+ typedef NonSwappable T;
+ typedef std::array<T, 42> C1;
+ static_assert(!can_swap<C1&>::value, "");
+ }
+#endif
}
diff --git a/test/std/containers/sequences/array/array.swap/swap.pass.cpp b/test/std/containers/sequences/array/array.swap/swap.pass.cpp
index 651798e1e790..8d01dbf959ce 100644
--- a/test/std/containers/sequences/array/array.swap/swap.pass.cpp
+++ b/test/std/containers/sequences/array/array.swap/swap.pass.cpp
@@ -10,14 +10,24 @@
// <array>
// void swap(array& a);
+// namespace std { void swap(array<T, N> &x, array<T, N> &y);
-#include <array>
#include <cassert>
+#include <array>
+
+#include "test_macros.h"
// std::array is explicitly allowed to be initialized with A a = { init-list };.
// Disable the missing braces warning for this reason.
#include "disable_missing_braces_warning.h"
+struct NonSwappable {
+ NonSwappable() {}
+private:
+ NonSwappable(NonSwappable const&);
+ NonSwappable& operator=(NonSwappable const&);
+};
+
int main()
{
{
@@ -37,6 +47,22 @@ int main()
}
{
typedef double T;
+ typedef std::array<T, 3> C;
+ C c1 = {1, 2, 3.5};
+ C c2 = {4, 5, 6.5};
+ std::swap(c1, c2);
+ assert(c1.size() == 3);
+ assert(c1[0] == 4);
+ assert(c1[1] == 5);
+ assert(c1[2] == 6.5);
+ assert(c2.size() == 3);
+ assert(c2[0] == 1);
+ assert(c2[1] == 2);
+ assert(c2[2] == 3.5);
+ }
+
+ {
+ typedef double T;
typedef std::array<T, 0> C;
C c1 = {};
C c2 = {};
@@ -44,4 +70,24 @@ int main()
assert(c1.size() == 0);
assert(c2.size() == 0);
}
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c1 = {};
+ C c2 = {};
+ std::swap(c1, c2);
+ assert(c1.size() == 0);
+ assert(c2.size() == 0);
+ }
+ {
+ typedef NonSwappable T;
+ typedef std::array<T, 0> C0;
+ C0 l = {};
+ C0 r = {};
+ l.swap(r);
+#if TEST_STD_VER >= 11
+ static_assert(noexcept(l.swap(r)), "");
+#endif
+ }
+
}
diff --git a/test/std/containers/sequences/array/at.pass.cpp b/test/std/containers/sequences/array/at.pass.cpp
index 5cb89dfeeb9a..9707beeb3946 100644
--- a/test/std/containers/sequences/array/at.pass.cpp
+++ b/test/std/containers/sequences/array/at.pass.cpp
@@ -49,14 +49,14 @@ int main()
const C c = {1, 2, 3.5};
C::const_reference r1 = c.at(0);
assert(r1 == 1);
-
+
C::const_reference r2 = c.at(2);
assert(r2 == 3.5);
try { (void) c.at(3); }
catch (const std::out_of_range &) {}
}
-
+
#if TEST_STD_VER > 11
{
typedef double T;
diff --git a/test/std/containers/sequences/array/front_back.pass.cpp b/test/std/containers/sequences/array/front_back.pass.cpp
index bccaade986ea..7d53b8265e96 100644
--- a/test/std/containers/sequences/array/front_back.pass.cpp
+++ b/test/std/containers/sequences/array/front_back.pass.cpp
@@ -34,7 +34,7 @@ int main()
assert(r1 == 1);
r1 = 5.5;
assert(c[0] == 5.5);
-
+
C::reference r2 = c.back();
assert(r2 == 3.5);
r2 = 7.5;
diff --git a/test/std/containers/sequences/array/indexing.pass.cpp b/test/std/containers/sequences/array/indexing.pass.cpp
index 5ccb0b487b95..64d2716a7592 100644
--- a/test/std/containers/sequences/array/indexing.pass.cpp
+++ b/test/std/containers/sequences/array/indexing.pass.cpp
@@ -33,7 +33,7 @@ int main()
assert(r1 == 1);
r1 = 5.5;
assert(c.front() == 5.5);
-
+
C::reference r2 = c[2];
assert(r2 == 3.5);
r2 = 7.5;
diff --git a/test/std/containers/sequences/array/iterators.pass.cpp b/test/std/containers/sequences/array/iterators.pass.cpp
index 98997d8c26d5..233e9328c4ed 100644
--- a/test/std/containers/sequences/array/iterators.pass.cpp
+++ b/test/std/containers/sequences/array/iterators.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert ( c.cend() == std::cend(c));
assert ( c.rend() == std::rend(c));
assert ( c.crend() == std::crend(c));
-
+
assert ( std::begin(c) != std::end(c));
assert ( std::rbegin(c) != std::rend(c));
assert ( std::cbegin(c) != std::cend(c));
diff --git a/test/std/containers/sequences/array/types.pass.cpp b/test/std/containers/sequences/array/types.pass.cpp
index 065ade959d05..9cf390c4eacb 100644
--- a/test/std/containers/sequences/array/types.pass.cpp
+++ b/test/std/containers/sequences/array/types.pass.cpp
@@ -29,6 +29,25 @@
#include <iterator>
#include <type_traits>
+#include "test_macros.h"
+
+template <class C>
+void test_iterators() {
+ typedef std::iterator_traits<typename C::iterator> ItT;
+ typedef std::iterator_traits<typename C::const_iterator> CItT;
+ static_assert((std::is_same<typename ItT::iterator_category, std::random_access_iterator_tag>::value), "");
+ static_assert((std::is_same<typename ItT::value_type, typename C::value_type>::value), "");
+ static_assert((std::is_same<typename ItT::reference, typename C::reference>::value), "");
+ static_assert((std::is_same<typename ItT::pointer, typename C::pointer>::value), "");
+ static_assert((std::is_same<typename ItT::difference_type, typename C::difference_type>::value), "");
+
+ static_assert((std::is_same<typename CItT::iterator_category, std::random_access_iterator_tag>::value), "");
+ static_assert((std::is_same<typename CItT::value_type, typename C::value_type>::value), "");
+ static_assert((std::is_same<typename CItT::reference, typename C::const_reference>::value), "");
+ static_assert((std::is_same<typename CItT::pointer, typename C::const_pointer>::value), "");
+ static_assert((std::is_same<typename CItT::difference_type, typename C::difference_type>::value), "");
+}
+
int main()
{
{
@@ -36,27 +55,43 @@ int main()
typedef std::array<T, 10> C;
static_assert((std::is_same<C::reference, T&>::value), "");
static_assert((std::is_same<C::const_reference, const T&>::value), "");
- static_assert((std::is_same<C::iterator, T*>::value), "");
- static_assert((std::is_same<C::const_iterator, const T*>::value), "");
+ LIBCPP_STATIC_ASSERT((std::is_same<C::iterator, T*>::value), "");
+ LIBCPP_STATIC_ASSERT((std::is_same<C::const_iterator, const T*>::value), "");
+ test_iterators<C>();
static_assert((std::is_same<C::pointer, T*>::value), "");
static_assert((std::is_same<C::const_pointer, const T*>::value), "");
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
{
typedef int* T;
typedef std::array<T, 0> C;
static_assert((std::is_same<C::reference, T&>::value), "");
static_assert((std::is_same<C::const_reference, const T&>::value), "");
- static_assert((std::is_same<C::iterator, T*>::value), "");
- static_assert((std::is_same<C::const_iterator, const T*>::value), "");
+ LIBCPP_STATIC_ASSERT((std::is_same<C::iterator, T*>::value), "");
+ LIBCPP_STATIC_ASSERT((std::is_same<C::const_iterator, const T*>::value), "");
+ test_iterators<C>();
static_assert((std::is_same<C::pointer, T*>::value), "");
static_assert((std::is_same<C::const_pointer, const T*>::value), "");
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
}
diff --git a/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
index 996fc9a18fe7..a6a8e7424b25 100644
--- a/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(c.front() == 0);
assert(c.back() == 9);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10);
for (unsigned i = 0; i < 10; ++i)
diff --git a/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
index 84f04f9d52da..53c6bd3380a2 100644
--- a/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
@@ -12,6 +12,8 @@
// void resize(size_type n);
#include <deque>
+#include <algorithm>
+#include <iterator>
#include <cassert>
#include "test_macros.h"
diff --git a/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
index 2bf2423fb9af..12af64386bd8 100644
--- a/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
@@ -12,6 +12,8 @@
// void resize(size_type n, const value_type& v);
#include <deque>
+#include <algorithm>
+#include <iterator>
#include <cassert>
#include "test_macros.h"
diff --git a/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
index 841bfd9f8a7f..787c2394b38e 100644
--- a/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
@@ -31,7 +31,7 @@ int main()
{
test<int>(std::allocator<int>());
test<NotConstructible>(test_allocator<NotConstructible>(3));
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<int>(min_allocator<int>());
test<NotConstructible>(min_allocator<NotConstructible>{});
#endif
diff --git a/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
index c760b4372444..dea6492a515d 100644
--- a/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(d[2] == 5);
assert(d[3] == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::deque<int, min_allocator<int>> d;
d.assign({3, 4, 5, 6});
diff --git a/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp b/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
index fa0c1203ede9..ec73555b9c4f 100644
--- a/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(v2.get_allocator() == other_allocator<int>(-2));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab)/sizeof(ab[0]);
diff --git a/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
index efea4948eba1..3a49a8bc0c66 100644
--- a/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
@@ -40,7 +40,7 @@ int main()
test(std::deque<int, other_allocator<int> >(ab, an, other_allocator<int>(3)),
other_allocator<int>(4));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab)/sizeof(ab[0]);
diff --git a/test/std/containers/sequences/deque/deque.cons/default.pass.cpp b/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
index b725dade70b2..7c42d9e7786e 100644
--- a/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
@@ -24,7 +24,7 @@ test()
{
std::deque<T, Allocator> d;
assert(d.size() == 0);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
std::deque<T, Allocator> d1 = {};
assert(d1.size() == 0);
#endif
@@ -34,7 +34,7 @@ int main()
{
test<int, std::allocator<int> >();
test<NotConstructible, stack_allocator<NotConstructible, 1> >();
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<int, min_allocator<int> >();
test<NotConstructible, min_allocator<NotConstructible> >();
#endif
diff --git a/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp
index c612dbc5e838..30cca929da11 100644
--- a/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp
@@ -14,9 +14,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,14 +32,13 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::deque<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
@@ -46,5 +48,4 @@ int main()
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
index ecdc2404c855..503e1237e9eb 100644
--- a/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
@@ -11,14 +11,14 @@
// ~deque() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <deque>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_alloc
{
@@ -27,11 +27,8 @@ struct some_alloc
~some_alloc() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::deque<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -48,5 +45,4 @@ int main()
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
index a9e0218e2e0b..dbf27053a9f9 100644
--- a/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
@@ -27,7 +27,7 @@ int main()
assert(d[2] == 5);
assert(d[3] == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::deque<int, min_allocator<int>> d = {3, 4, 5, 6};
assert(d.size() == 4);
diff --git a/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
index 36c5af60ee34..9be3c63a6b31 100644
--- a/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(d[2] == 5);
assert(d[3] == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::deque<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
assert(d.get_allocator() == min_allocator<int>());
diff --git a/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
index faadf2b1a1db..12a7faf686db 100644
--- a/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
@@ -56,7 +56,7 @@ int main()
test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an));
test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an));
test<stack_allocator<int, 4096> >(ab, an);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<min_allocator<int> >(ab, an);
#endif
}
diff --git a/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
index b8c3e889929d..c8f7759a19d6 100644
--- a/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
@@ -42,7 +42,7 @@ int main()
test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), test_allocator<int>(4));
test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), test_allocator<int>(5));
test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), test_allocator<int>(6));
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test(input_iterator<const int*>(ab), input_iterator<const int*>(an), min_allocator<int>());
test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), min_allocator<int>());
test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), min_allocator<int>());
diff --git a/test/std/containers/sequences/deque/deque.cons/move.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
index 4a7aa8a058eb..68875139da1a 100644
--- a/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
@@ -51,7 +51,7 @@ int main()
assert(c1.size() == 0);
assert(c3.get_allocator() == c1.get_allocator());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab)/sizeof(ab[0]);
diff --git a/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
index 1a5db6db6500..4aa0fa6827e7 100644
--- a/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
@@ -66,7 +66,7 @@ int main()
assert(c3.get_allocator() == A(3));
assert(c1.size() != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab)/sizeof(ab[0]);
diff --git a/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
index e50cd8ed508d..ed8f1544bc8f 100644
--- a/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
@@ -69,7 +69,7 @@ int main()
assert(c1.size() == 0);
assert(c3.get_allocator() == A(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab)/sizeof(ab[0]);
diff --git a/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp
index 24180b5b5bdd..cebf76a15a4a 100644
--- a/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp
@@ -16,6 +16,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <deque>
#include <cassert>
@@ -31,7 +33,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::deque<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -48,5 +49,4 @@ int main()
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
index 0ea0431be8e2..f53e1ba6c807 100644
--- a/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <deque>
#include <cassert>
@@ -29,7 +31,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::deque<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -46,5 +47,4 @@ int main()
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp b/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
index 3a6ec8370b84..6aac6b20c49e 100644
--- a/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<int>(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab)/sizeof(ab[0]);
diff --git a/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
index 6468e4329bda..597f642db3ce 100644
--- a/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(d[2] == 5);
assert(d[3] == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::deque<int, min_allocator<int>> d;
d = {3, 4, 5, 6};
diff --git a/test/std/containers/sequences/deque/deque.cons/size.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
index d2e324b0e3f5..b3fccf6671c9 100644
--- a/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
@@ -100,7 +100,7 @@ int main()
test1<DefaultOnly, stack_allocator<DefaultOnly, 4096> >(4095);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<DefaultOnly, min_allocator<DefaultOnly> >(4095);
#endif
diff --git a/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
index 859deba1e1ae..aeda168d19d4 100644
--- a/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
@@ -45,7 +45,7 @@ int main()
test<int, std::allocator<int> >(4096, 1165);
test<int, std::allocator<int> >(4097, 157);
test<int, stack_allocator<int, 4096> >(4095, 90);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<int, min_allocator<int> >(4095, 90);
#endif
}
diff --git a/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
index 5693be702de7..ed8a7e13baa5 100644
--- a/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
@@ -47,7 +47,7 @@ int main()
test(4096, 1165, a);
test(4097, 157, a);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
min_allocator<int> a;
test(0, 5, a);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
index cf717c2e2f27..784b3a38553a 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
@@ -16,6 +16,7 @@
#include "../../../Emplaceable.h"
#include "min_allocator.h"
+#include "test_allocator.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -74,7 +75,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@@ -82,6 +83,17 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
}
+ {
+ std::deque<Tag_X, TaggingAllocator<Tag_X>> c;
+ c.emplace_back();
+ assert(c.size() == 1);
+ c.emplace_back(1, 2, 3);
+ assert(c.size() == 2);
+ c.emplace_front();
+ assert(c.size() == 3);
+ c.emplace_front(1, 2, 3);
+ assert(c.size() == 4);
+ }
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
index becf94ffb4ef..afc0e4972e38 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
@@ -74,7 +74,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp
index 49465cddaef7..a7a93571f509 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp
@@ -23,9 +23,9 @@ void del_at_start(C c)
typename C::iterator first = c.begin();
typename C::iterator it1 = first + 1;
typename C::iterator it2 = c.end() - 1;
-
+
c.erase (first);
-
+
typename C::iterator it3 = c.begin();
typename C::iterator it4 = c.end() - 1;
assert( it1 == it3);
@@ -42,7 +42,7 @@ void del_at_end(C c)
typename C::iterator first = c.end() - 1;
typename C::iterator it1 = c.begin();
typename C::iterator it2 = first - 1;
-
+
c.erase (first);
typename C::iterator it3 = c.begin();
@@ -60,7 +60,7 @@ int main()
std::deque<int> queue;
for (int i = 0; i < 20; ++i)
queue.push_back(i);
-
+
while (queue.size() > 1)
{
del_at_start(queue);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
index a45b75d25c9c..116ed9aa4b5a 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
@@ -12,6 +12,8 @@
// iterator erase(const_iterator p)
#include <deque>
+#include <algorithm>
+#include <iterator>
#include <cassert>
#include "min_allocator.h"
@@ -78,7 +80,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp
index c785e264db06..a0ccd200bfb7 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp
@@ -26,9 +26,9 @@ void del_at_start(C c, size_t num)
typename C::iterator last = first + num;
typename C::iterator it1 = last;
typename C::iterator it2 = c.end() - 1;
-
+
c.erase (first, last);
-
+
typename C::iterator it3 = c.begin();
typename C::iterator it4 = c.end() - 1;
assert( it1 == it3);
@@ -38,7 +38,7 @@ void del_at_start(C c, size_t num)
assert( *it2 == *it4);
assert(&*it2 == &*it4);
}
-
+
template <typename C>
void del_at_end(C c, size_t num)
{
@@ -46,7 +46,7 @@ void del_at_end(C c, size_t num)
typename C::iterator first = last - num;
typename C::iterator it1 = c.begin();
typename C::iterator it2 = first - 1;
-
+
c.erase (first, last);
typename C::iterator it3 = c.begin();
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
index 0576aca5c1a8..a53abaf85d33 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
@@ -14,6 +14,8 @@
// iterator erase(const_iterator f, const_iterator l)
#include <deque>
+#include <algorithm>
+#include <iterator>
#include <cassert>
#include "min_allocator.h"
@@ -84,7 +86,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp
index 1d84f73ccb56..0f5f8e67a24b 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp
@@ -22,9 +22,9 @@ void test(C c)
{
typename C::iterator it1 = c.begin();
typename C::iterator it2 = c.end() - 2;
-
+
c.pop_back();
-
+
typename C::iterator it3 = c.begin();
typename C::iterator it4 = c.end() - 1;
assert( it1 == it3);
@@ -40,7 +40,7 @@ int main()
std::deque<int> queue;
for (int i = 0; i < 20; ++i)
queue.push_back(i);
-
+
while (queue.size() > 1)
{
test(queue);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
index b345faaf89e9..aeb62c9d996a 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
@@ -72,7 +72,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp
index 78317f3a3f9c..d7fd910cca5f 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp
@@ -22,9 +22,9 @@ void test(C c)
{
typename C::iterator it1 = c.begin() + 1;
typename C::iterator it2 = c.end() - 1;
-
+
c.pop_front();
-
+
typename C::iterator it3 = c.begin();
typename C::iterator it4 = c.end() - 1;
assert( it1 == it3);
@@ -40,7 +40,7 @@ int main()
std::deque<int> queue;
for (int i = 0; i < 20; ++i)
queue.push_back(i);
-
+
while (queue.size() > 1)
{
test(queue);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
index d570ec333715..c7a3a625eab6 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
@@ -72,7 +72,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
index 96df6097d994..198cbcf67cc7 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
@@ -62,7 +62,7 @@ int main()
for (int j = 0; j < N; ++j)
test<std::deque<int> >(rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
index b37e961e442f..1fe1da102f37 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
@@ -26,11 +26,11 @@ class CMyClass {
bool equal(const CMyClass &rhs) const
{ return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
-
+
private:
int fMagicValue;
int fTag;
-
+
private: static int kStartedConstructionMagicValue;
private: static int kFinishedConstructionMagicValue;
};
@@ -84,7 +84,7 @@ int main()
assert(vec==vec2);
}
}
-
+
{
typedef std::deque<CMyClass, test_allocator<CMyClass> > C;
C vec;
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
index d4ab0d3e2f26..b5c881064a95 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
@@ -68,7 +68,7 @@ int main()
for (int j = 0; j < N; ++j)
test<std::deque<MoveOnly> >(rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
index 4d6443b1f967..ee4f3d7f9ed7 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
@@ -71,7 +71,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
index b4caa947aed8..7464870f07e1 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
@@ -30,7 +30,7 @@ class CMyClass {
private:
int fMagicValue;
int fTag;
-
+
private: static int kStartedConstructionMagicValue;
private: static int kFinishedConstructionMagicValue;
};
@@ -84,7 +84,7 @@ int main()
assert(vec==vec2);
}
}
-
+
{
typedef std::deque<CMyClass, test_allocator<CMyClass> > C;
C vec;
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
index ea91ec1b0a44..ab15ca3326bf 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
@@ -77,7 +77,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<MoveOnly> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.special/copy.pass.cpp b/test/std/containers/sequences/deque/deque.special/copy.pass.cpp
index 3a9962b330a4..846d87c6b664 100644
--- a/test/std/containers/sequences/deque/deque.special/copy.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.special/copy.pass.cpp
@@ -76,7 +76,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp b/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp
index ccb30a9997d8..e7f37f98d270 100644
--- a/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp
@@ -75,7 +75,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.special/move.pass.cpp b/test/std/containers/sequences/deque/deque.special/move.pass.cpp
index abd8e079975a..1bdbeaf9d5c6 100644
--- a/test/std/containers/sequences/deque/deque.special/move.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.special/move.pass.cpp
@@ -75,7 +75,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp b/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp
index ea04f6a15acf..8e909c63c912 100644
--- a/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp
@@ -75,7 +75,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.special/swap.pass.cpp b/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
index 26757c351f1a..ab21f434937e 100644
--- a/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
@@ -85,7 +85,7 @@ int main()
assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
assert(c2.get_allocator() == A(1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
index 83bcac8997ed..2f999e9a7a5d 100644
--- a/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <deque>
// void swap(deque& c)
@@ -21,6 +23,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,7 +31,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -40,7 +43,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -51,7 +54,6 @@ struct some_alloc2
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::deque<MoveOnly> C;
C c1, c2;
@@ -86,5 +88,4 @@ int main()
}
#endif
-#endif
}
diff --git a/test/std/containers/sequences/deque/iterators.pass.cpp b/test/std/containers/sequences/deque/iterators.pass.cpp
index 8ec491fae4da..19d7996f824f 100644
--- a/test/std/containers/sequences/deque/iterators.pass.cpp
+++ b/test/std/containers/sequences/deque/iterators.pass.cpp
@@ -33,7 +33,7 @@ int main()
j = c.cbegin();
assert(i == j);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::deque<int, min_allocator<int>> C;
C c;
@@ -68,7 +68,7 @@ int main()
assert ( (cii >= ii1 ));
assert (cii - ii1 == 0);
assert (ii1 - cii == 0);
-
+
// std::deque<int> c;
// assert ( ii1 != c.cbegin());
// assert ( cii != c.begin());
diff --git a/test/std/containers/sequences/deque/types.pass.cpp b/test/std/containers/sequences/deque/types.pass.cpp
index da9470d8a6c6..53b33d9e6be9 100644
--- a/test/std/containers/sequences/deque/types.pass.cpp
+++ b/test/std/containers/sequences/deque/types.pass.cpp
@@ -64,6 +64,12 @@ test()
static_assert((std::is_same<
typename C::const_reverse_iterator,
std::reverse_iterator<typename C::const_iterator> >::value), "");
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
int main()
@@ -73,7 +79,8 @@ int main()
test<Copyable, test_allocator<Copyable> >();
static_assert((std::is_same<std::deque<char>::allocator_type,
std::allocator<char> >::value), "");
-#if __cplusplus >= 201103L
+
+#if TEST_STD_VER >= 11
{
typedef std::deque<short, min_allocator<short>> C;
static_assert((std::is_same<C::value_type, short>::value), "");
@@ -85,6 +92,13 @@ int main()
// min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
#endif
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp
index 2ec9b8713326..ae14eda50173 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp
@@ -38,7 +38,7 @@ int main()
assert(c.front() == 0);
assert(*c.begin() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp
index 7aba906ec20d..352945c852d8 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(c.get_allocator() == A(12));
assert(c.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<NotConstructible> A;
typedef A::value_type T;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp
index 0b9263db9899..244054477d56 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp
@@ -117,7 +117,7 @@ int main()
assert(c1 == c0);
assert(c1.get_allocator() == A(10));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef min_allocator<int> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp
index e0382a10db49..d4dda02b8413 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp
@@ -42,7 +42,7 @@ int main()
assert(*i == 10+n);
assert(n == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp
index 1532b53e7a83..935284831d07 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp
@@ -159,7 +159,7 @@ int main()
assert(c1.get_allocator() == A(10));
assert(c0.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef MoveOnly T;
typedef min_allocator<T> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp
index 551908fea166..3d35916ccacb 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp
@@ -42,7 +42,7 @@ int main()
assert(*i == 10+n);
assert(n == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
index 0b348e6920ca..ccefa2df7ce0 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(*i == 10+n);
assert(n == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp
index ea53e1c37320..1a1610d37c2f 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp
@@ -41,7 +41,7 @@ int main()
assert(*i == 10);
assert(n == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
index 2fc53bc3a514..5240afa82b80 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(c.get_allocator() == A(-2));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef min_allocator<int> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
index bcc24e1cc68e..e4b73bb54e9b 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(c == c0);
assert(c.get_allocator() == A(9));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef min_allocator<int> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp
index 38e95fad8396..04c4524cf980 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp
@@ -24,7 +24,7 @@ int main()
C c;
assert(c.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp
index 5167a065a9ad..0ec1f80562a8 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp
@@ -14,9 +14,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <forward_list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,14 +32,13 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::forward_list<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
@@ -46,5 +48,4 @@ int main()
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
index da41bf4eb1fc..85d929b4e32e 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
@@ -11,14 +11,14 @@
// ~forward_list() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <forward_list>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_alloc
{
@@ -27,11 +27,8 @@ struct some_alloc
~some_alloc() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::forward_list<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -48,5 +45,4 @@ int main()
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
index 5b31c4dad0a0..c783f60ff4c9 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(*i == n);
assert(n == 10);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
index 750486b829f2..ba9984f969b5 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
@@ -31,7 +31,7 @@ int main()
assert(n == 10);
assert(c.get_allocator() == A(14));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef min_allocator<T> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
index 88ecb7540951..a3e204ec28da 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(c0.empty());
assert(c.get_allocator() == A(10));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef MoveOnly T;
typedef min_allocator<T> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
index 3f0e45af1f0b..6a1afe1334b0 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(!c0.empty());
assert(c.get_allocator() == A(9));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef MoveOnly T;
typedef min_allocator<T> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp
index 28ce2c12b619..b9a6ef7ab8a8 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp
@@ -16,6 +16,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <forward_list>
#include <cassert>
@@ -31,7 +33,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::forward_list<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -48,5 +49,4 @@ int main()
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
index 7b001ea67b19..0359133afc9b 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <forward_list>
#include <cassert>
@@ -29,7 +31,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::forward_list<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -46,5 +47,4 @@ int main()
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
index 763952439f00..3c0f2b8403ca 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
@@ -32,7 +32,7 @@ int main()
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
index d72c3581022d..96a29d24e89c 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
@@ -36,7 +36,7 @@ int main()
assert(n == std::end(t) - std::begin(t));
assert(c.get_allocator() == A(13));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef min_allocator<T> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
index e02dcb4bf691..736d59936aa3 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
@@ -45,7 +45,7 @@ int main()
#endif
assert(n == N);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef DefaultOnly T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp
index 05ab98bb205d..56ce632e0a48 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(*i == v);
assert(n == N);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp
index 1d631ab12ba1..86338a275a55 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp
@@ -32,7 +32,7 @@ int main()
assert(n == N);
assert(c.get_allocator() == A(12));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<int> A;
typedef A::value_type T;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp
index 083cec2886da..c6104e73350b 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp
@@ -60,7 +60,7 @@ int main()
C::const_iterator i = c.before_begin();
assert(std::distance(i, c.end()) == 11);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
index 6f3ac548db8b..925cca4d5e8d 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
@@ -71,7 +71,7 @@ int main()
C::iterator i;
C::const_iterator j;
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
@@ -127,7 +127,7 @@ int main()
std::forward_list<int>::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
-
+
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
index 2739b49d8eb2..0e625ac76a02 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
@@ -38,7 +38,7 @@ int main()
c.clear();
assert(distance(c.begin(), c.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef NotConstructible T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
index e305c5b6ab52..dd8ea88c2c1a 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(*next(c.begin(), 3) == Emplaceable(2, 3.5));
assert(distance(c.begin(), c.end()) == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef Emplaceable T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
index c02337e0562d..18ed69d33f0b 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
@@ -32,7 +32,7 @@ int main()
assert(*next(c.begin()) == Emplaceable());
assert(distance(c.begin(), c.end()) == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef Emplaceable T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
index bd9b15300efa..df859c69a117 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
@@ -84,7 +84,7 @@ int main()
assert(i == c.end());
assert(distance(c.begin(), c.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
index 4f51498bc651..bf6a88a65406 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
@@ -55,7 +55,7 @@ int main()
assert(i == c.end());
assert(distance(c.begin(), c.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
index ec650b695727..82dca739410f 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(*next(c.begin(), 3) == 2);
assert(distance(c.begin(), c.end()) == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
index 4d3018199809..15e1a08b08bf 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(*next(c.begin(), 3) == 1);
assert(*next(c.begin(), 4) == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
index 103475f1edab..a41f8dbbfb2b 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(*next(c.begin(), 3) == 1);
assert(*next(c.begin(), 4) == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
index f7f376caa090..2e21cc79d269 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(*next(c.begin(), 3) == 2);
assert(distance(c.begin(), c.end()) == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef MoveOnly T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
index b2da2ecd3bbd..f4b7e344112a 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(*next(c.begin(), 3) == 3);
assert(*next(c.begin(), 4) == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
index 7f14e54a2e6f..d831ceb28918 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(distance(c.begin(), c.end()) == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
index 85958afc1ce3..4b55a0b1d808 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
@@ -30,7 +30,7 @@ int main()
assert(*next(c.begin()) == 1);
assert(distance(c.begin(), c.end()) == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
index d7c9d758aa03..dfcd2cf90ebc 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
@@ -32,7 +32,7 @@ int main()
assert(*next(c.begin()) == 1);
assert(distance(c.begin(), c.end()) == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef MoveOnly T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
index ef7ef82626dc..6337cd779722 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
@@ -64,7 +64,7 @@ int main()
assert(*next(c.begin(), 4) == 0);
assert(*next(c.begin(), 5) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef DefaultOnly T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
index d4bd6b4e0111..356e0d657c35 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
@@ -14,9 +14,14 @@
#include <forward_list>
#include <cassert>
+#include "test_macros.h"
#include "DefaultOnly.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 11
+#include "container_test_types.h"
+#endif
+
int main()
{
{
@@ -49,7 +54,7 @@ int main()
assert(*next(c.begin(), 4) == 10);
assert(*next(c.begin(), 5) == 10);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
@@ -80,5 +85,19 @@ int main()
assert(*next(c.begin(), 4) == 10);
assert(*next(c.begin(), 5) == 10);
}
+ {
+ // Test that the allocator's construct method is being used to
+ // construct the new elements and that it's called exactly N times.
+ typedef int T;
+ typedef std::forward_list<int, ContainerTestAllocator<int, int>> Container;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ Container c;
+ cc->expect<int const&>(6);
+ c.resize(6, 42);
+ assert(!cc->unchecked());
+ }
+ }
#endif
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/merge.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/merge.pass.cpp
index 3b6f853c84cd..a67dd1a4b120 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/merge.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/merge.pass.cpp
@@ -31,7 +31,7 @@ int main()
C c3(std::begin(t3), std::end(t3));
assert(c1 == c3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp
index 7e873bdddd09..6b4e323bd02d 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp
@@ -32,7 +32,7 @@ int main()
C c3(std::begin(t3), std::end(t3));
assert(c1 == c3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
index 18d4cae8cc61..b7607e190bbf 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
@@ -103,7 +103,7 @@ int main()
}
assert ( it == c.end ());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
index ed408fbd685c..ef6f6a0f1887 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
@@ -88,7 +88,7 @@ int main()
assert(c1 == c2);
assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef unary_counting_predicate<bool(*)(T), T> Predicate;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp
index 9bf0d03a8855..2876f65d0630 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp
@@ -35,7 +35,7 @@ int main()
{
for (int i = 0; i < 10; ++i)
test<std::forward_list<int> >(i);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
for (int i = 0; i < 10; ++i)
test<std::forward_list<int, min_allocator<int>> >(i);
#endif
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp
index 06e40c595ecb..65512e317cea 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp
@@ -40,7 +40,7 @@ int main()
{
for (int i = 0; i < 40; ++i)
test<std::forward_list<int> >(i);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
for (int i = 0; i < 40; ++i)
test<std::forward_list<int, min_allocator<int>> >(i);
#endif
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp
index 8b6ca39b2aab..6e5cce39e67d 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp
@@ -41,7 +41,7 @@ int main()
{
for (int i = 0; i < 40; ++i)
test<std::forward_list<int> >(i);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
for (int i = 0; i < 40; ++i)
test<std::forward_list<int, min_allocator<int>> >(i);
#endif
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
index 51da651970cd..c8d4e2d34f1e 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
@@ -55,7 +55,7 @@ int main()
}
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
// splicing different containers
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp
index 90a159959632..006869d6db69 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp
@@ -121,7 +121,7 @@ int main()
}
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
// splicing different containers
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp
index 25db6e64b8a9..e79abb6b6519 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp
@@ -67,7 +67,7 @@ int main()
c1.unique();
assert(c1 == c2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
index b7dce20b7092..11228afe83e6 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
@@ -72,7 +72,7 @@ int main()
c1.unique(g);
assert(c1 == c2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
index 2b2be7b6c222..e7a8d048f6f6 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
@@ -176,7 +176,7 @@ int main()
assert(distance(c2.begin(), c2.end()) == 0);
assert(c2.get_allocator() == A(1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef min_allocator<T> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
index d6ba5a47cbe6..983d8140571b 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
@@ -177,7 +177,7 @@ int main()
assert(distance(c2.begin(), c2.end()) == 0);
assert(c2.get_allocator() == A(1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef min_allocator<T> A;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
index cbe8142eeb4b..5f8cf95aa737 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <forward_list>
// void swap(forward_list& c)
@@ -21,6 +23,7 @@
#include <forward_list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,7 +31,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -40,7 +43,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -51,7 +54,6 @@ struct some_alloc2
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::forward_list<MoveOnly> C;
C c1, c2;
@@ -85,6 +87,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/sequences/forwardlist/incomplete.pass.cpp b/test/std/containers/sequences/forwardlist/incomplete.pass.cpp
new file mode 100644
index 000000000000..df273449eac1
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/incomplete.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list()
+// forward_list::iterator()
+// forward_list::const_iterator()
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+struct A {
+ std::forward_list<A> d;
+ std::forward_list<A>::iterator it;
+ std::forward_list<A>::const_iterator it2;
+};
+
+#if TEST_STD_VER >= 11
+struct B {
+ typedef std::forward_list<B, min_allocator<B>> FList;
+ FList d;
+ FList::iterator it;
+ FList::const_iterator it2;
+};
+#endif
+
+int main()
+{
+ {
+ A a;
+ assert(a.d.empty());
+ a.it = a.d.begin();
+ a.it2 = a.d.cbefore_begin();
+ }
+#if TEST_STD_VER >= 11
+ {
+ B b;
+ assert(b.d.empty());
+ b.it = b.d.begin();
+ b.it2 = b.d.cbefore_begin();
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/forwardlist/max_size.pass.cpp b/test/std/containers/sequences/forwardlist/max_size.pass.cpp
index be7ebaf44b03..a7f39bf90fb8 100644
--- a/test/std/containers/sequences/forwardlist/max_size.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/max_size.pass.cpp
@@ -24,7 +24,7 @@ int main()
C c;
assert(c.max_size() > 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/types.pass.cpp b/test/std/containers/sequences/forwardlist/types.pass.cpp
index a1f8862debbe..5ed7e34b9202 100644
--- a/test/std/containers/sequences/forwardlist/types.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/types.pass.cpp
@@ -44,8 +44,15 @@ int main()
static_assert((std::is_same<C::const_pointer, const char*>::value), "");
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::forward_list<char, min_allocator<char>> C;
static_assert((std::is_same<C::value_type, char>::value), "");
@@ -57,6 +64,13 @@ int main()
// min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
#endif
}
diff --git a/test/std/containers/sequences/list/iterators.pass.cpp b/test/std/containers/sequences/list/iterators.pass.cpp
index a33ee3ecd2db..fe0ac0799687 100644
--- a/test/std/containers/sequences/list/iterators.pass.cpp
+++ b/test/std/containers/sequences/list/iterators.pass.cpp
@@ -77,7 +77,7 @@ int main()
C::iterator i;
C::const_iterator j;
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp b/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp
index 14629b173a6c..df934699d5ad 100644
--- a/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp
+++ b/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(std::distance(l.begin(), l.end()) == 20);
}
#endif // __LIBCPP_MOVE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l(5, 2);
l.resize(2);
diff --git a/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp b/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp
index 2738ffbbefdd..4609ef986835 100644
--- a/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp
+++ b/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp
@@ -33,7 +33,7 @@ int main()
assert(l.front() == 2);
assert(l.back() == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<double, min_allocator<double>> l(5, 2);
l.resize(2, 3.5);
diff --git a/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp b/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp
index b851eb9dc5a0..7c8cee2a5581 100644
--- a/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp
@@ -32,7 +32,7 @@ int main()
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<int>(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
std::list<int, min_allocator<int> > l2(l, min_allocator<int>());
diff --git a/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp
index 24bd140c4e4f..9b2c6d68cbe5 100644
--- a/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(*i++ == 5);
assert(*i++ == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> d;
d.assign({3, 4, 5, 6});
diff --git a/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp b/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp
index 0fd586f84af7..2f863c6169fc 100644
--- a/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp
@@ -62,7 +62,7 @@ int main()
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
diff --git a/test/std/containers/sequences/list/list.cons/copy.pass.cpp b/test/std/containers/sequences/list/list.cons/copy.pass.cpp
index 530690a925d4..a6abd1f3c30b 100644
--- a/test/std/containers/sequences/list/list.cons/copy.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/copy.pass.cpp
@@ -38,7 +38,7 @@ int main()
assert(l2.get_allocator() == other_allocator<int>(-2));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l(3, 2);
std::list<int, min_allocator<int>> l2 = l;
diff --git a/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp
index 99fe9f115f94..a164298f4fae 100644
--- a/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp
@@ -31,7 +31,7 @@ int main()
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<int>(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
std::list<int, min_allocator<int> > l2(l, min_allocator<int>());
diff --git a/test/std/containers/sequences/list/list.cons/default.pass.cpp b/test/std/containers/sequences/list/list.cons/default.pass.cpp
index c05bd74ca79e..3c1c2ef166d4 100644
--- a/test/std/containers/sequences/list/list.cons/default.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/default.pass.cpp
@@ -33,7 +33,7 @@ int main()
assert(l.size() == 0);
assert(std::distance(l.begin(), l.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l;
assert(l.size() == 0);
diff --git a/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp
index 2455fb39a79a..6f76d8c56882 100644
--- a/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp
@@ -14,9 +14,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,14 +32,13 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::list<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
@@ -46,5 +48,4 @@ int main()
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
index 9d9946b68966..4b88580e12ca 100644
--- a/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
@@ -33,7 +33,7 @@ int main()
assert(l.size() == 0);
assert(std::distance(l.begin(), l.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l;
assert(l.size() == 0);
diff --git a/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
index ca7ade6d19cb..3d11f13358b5 100644
--- a/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
@@ -11,14 +11,14 @@
// ~list() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <list>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_alloc
{
@@ -27,11 +27,8 @@ struct some_alloc
~some_alloc() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::list<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -48,5 +45,4 @@ int main()
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp
index 3307017989eb..40413203bdfc 100644
--- a/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(*i++ == 5);
assert(*i++ == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> d = {3, 4, 5, 6};
assert(d.size() == 4);
diff --git a/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
index 4a85e378c1ce..72add79f6670 100644
--- a/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
@@ -30,7 +30,7 @@ int main()
assert(*i++ == 5);
assert(*i++ == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
assert(d.get_allocator() == min_allocator<int>());
diff --git a/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp b/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
index 09eae8ab43c1..0dd71d70f85b 100644
--- a/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
@@ -51,7 +51,7 @@ int main()
for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
assert(*i == j);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a[] = {0, 1, 2, 3};
std::list<int, min_allocator<int>> l(input_iterator<const int*>(a),
diff --git a/test/std/containers/sequences/list/list.cons/move.pass.cpp b/test/std/containers/sequences/list/list.cons/move.pass.cpp
index 54209a55f7e2..1049b1b03982 100644
--- a/test/std/containers/sequences/list/list.cons/move.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/move.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <list>
// list(list&& c);
@@ -19,7 +21,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
@@ -46,7 +47,6 @@ int main()
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
}
-#if __cplusplus >= 201103L
{
std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
@@ -60,15 +60,4 @@ int main()
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
}
-#endif
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int> l1 = {1, 2, 3};
- std::list<int>::iterator i = l1.begin();
- std::list<int> l2 = std::move(l1);
- assert(*l2.erase(i) == 2);
- assert(l2.size() == 2);
- }
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp
index 8f82702b296f..9f8a536b33c5 100644
--- a/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(!l.empty());
assert(l2.get_allocator() == other_allocator<MoveOnly>(4));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
diff --git a/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp
index 280d93d486e6..d4f8fde2c8ff 100644
--- a/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp
@@ -16,6 +16,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <list>
#include <cassert>
@@ -31,7 +33,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::list<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -48,5 +49,4 @@ int main()
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
index e436a29f5d47..da2b6a36cef5 100644
--- a/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <list>
#include <cassert>
@@ -29,7 +31,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::list<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -46,5 +47,4 @@ int main()
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp
index 7b7b8a327b88..1097bdab2198 100644
--- a/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(*i++ == 5);
assert(*i++ == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> d;
d = {3, 4, 5, 6};
diff --git a/test/std/containers/sequences/list/list.cons/size_type.pass.cpp b/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
index 75b93a3dfb6b..07b4f14dc3a2 100644
--- a/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
@@ -80,7 +80,7 @@ int main()
assert(std::distance(l.begin(), l.end()) == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l(3);
assert(l.size() == 3);
diff --git a/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
index 12da86da0a41..ac7b18ea4990 100644
--- a/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
@@ -52,7 +52,7 @@ int main()
++i;
assert(*i == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l(3, 2);
assert(l.size() == 3);
diff --git a/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp b/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
index 38696b6eb503..5d8c41fa1976 100644
--- a/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
@@ -24,7 +24,7 @@ int main()
c.clear();
assert(c.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a[] = {1, 2, 3};
std::list<int, min_allocator<int>> c(a, a+3);
diff --git a/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp b/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp
index 6476d1d6c6ae..e8d46941252e 100644
--- a/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp
@@ -7,17 +7,17 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <list>
// template <class... Args> void emplace(const_iterator p, Args&&... args);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
class A
@@ -37,7 +37,6 @@ public:
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::list<A> c;
c.emplace(c.cbegin(), 2, 3.5);
@@ -51,17 +50,6 @@ int main()
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<A> c1;
- std::list<A> c2;
- std::list<A>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
- assert(false);
- }
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::list<A, min_allocator<A>> c;
c.emplace(c.cbegin(), 2, 3.5);
@@ -75,14 +63,5 @@ int main()
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<A, min_allocator<A>> c1;
- std::list<A, min_allocator<A>> c2;
- std::list<A, min_allocator<A>>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
- assert(false);
- }
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#endif
+
}
diff --git a/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp b/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
index 5983efc59ad1..2ff01f1676f2 100644
--- a/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<A, min_allocator<A>> c;
c.emplace_back(2, 3.5);
diff --git a/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp b/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
index e2e68e331381..8a3df46a31e2 100644
--- a/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(c.back().geti() == 2);
assert(c.back().getd() == 3.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<A, min_allocator<A>> c;
c.emplace_front(2, 3.5);
diff --git a/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp
index c1cc90043670..0924fdb84879 100644
--- a/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp
@@ -39,7 +39,7 @@ int main()
assert(l1.size() == 0);
assert(distance(l1.begin(), l1.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3};
std::list<int, min_allocator<int>> l1(a1, a1+3);
diff --git a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp
index bd3f66b4116a..06b4f0cc654f 100644
--- a/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(distance(l1.cbegin(), l1.cend()) == 0);
assert(i == l1.begin());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l1(a1, a1+3);
std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp
index a82a2696e82a..91845e564b02 100644
--- a/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp
@@ -40,7 +40,7 @@ int main()
assert(*i++ == 1);
assert(*i++ == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> d(10, 1);
std::list<int, min_allocator<int>>::iterator i = d.insert(next(d.cbegin(), 2), {3, 4, 5, 6});
diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
index 736b9baae746..18460a65743c 100644
--- a/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
@@ -7,117 +7,25 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <list>
// template <InputIterator Iter>
// iterator insert(const_iterator position, Iter first, Iter last);
-// UNSUPPORTED: sanitizer-new-delete
-
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <list>
#include <cstdlib>
#include <cassert>
+
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
+#include "count_new.hpp"
-int throw_next = 0xFFFF;
-int count = 0;
-
-void* operator new(std::size_t s) throw(std::bad_alloc)
-{
- if (throw_next == 0)
- throw std::bad_alloc();
- --throw_next;
- ++count;
- return std::malloc(s);
-}
-
-void operator delete(void* p) throw()
-{
- --count;
- std::free(p);
-}
-
-int main()
-{
- {
- int a1[] = {1, 2, 3};
- std::list<int> l1;
- std::list<int>::iterator i = l1.insert(l1.begin(), a1, a1+3);
- assert(i == l1.begin());
- assert(l1.size() == 3);
- assert(distance(l1.begin(), l1.end()) == 3);
- i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- int a2[] = {4, 5, 6};
- i = l1.insert(i, a2, a2+3);
- assert(*i == 4);
- assert(l1.size() == 6);
- assert(distance(l1.begin(), l1.end()) == 6);
- i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 3);
- throw_next = 2;
- int save_count = count;
- try
- {
- i = l1.insert(i, a2, a2+3);
- assert(false);
- }
- catch (...)
- {
- }
- assert(save_count == count);
- assert(l1.size() == 6);
- assert(distance(l1.begin(), l1.end()) == 6);
- i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 3);
- }
- throw_next = 0xFFFF;
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int> v(100);
- std::list<int> v2(100);
- int a[] = {1, 2, 3, 4, 5};
- const int N = sizeof(a)/sizeof(a[0]);
- std::list<int>::iterator i = v.insert(next(v2.cbegin(), 10), input_iterator<const int*>(a),
- input_iterator<const int*>(a+N));
- assert(false);
- }
-#endif
-#if __cplusplus >= 201103L
- {
+template <class List>
+void test() {
int a1[] = {1, 2, 3};
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>>::iterator i = l1.insert(l1.begin(), a1, a1+3);
+ List l1;
+ typename List::iterator i = l1.insert(l1.begin(), a1, a1+3);
assert(i == l1.begin());
assert(l1.size() == 3);
assert(distance(l1.begin(), l1.end()) == 3);
@@ -144,8 +52,10 @@ int main()
assert(*i == 6);
++i;
assert(*i == 3);
- throw_next = 2;
- int save_count = count;
+
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT)
+ globalMemCounter.throw_after = 2;
+ int save_count = globalMemCounter.outstanding_new;
try
{
i = l1.insert(i, a2, a2+3);
@@ -154,7 +64,7 @@ int main()
catch (...)
{
}
- assert(save_count == count);
+ assert(globalMemCounter.checkOutstandingNewEq(save_count));
assert(l1.size() == 6);
assert(distance(l1.begin(), l1.end()) == 6);
i = l1.begin();
@@ -169,18 +79,13 @@ int main()
assert(*i == 6);
++i;
assert(*i == 3);
- }
-#if _LIBCPP_DEBUG >= 1
- {
- throw_next = 0xFFFF;
- std::list<int, min_allocator<int>> v(100);
- std::list<int, min_allocator<int>> v2(100);
- int a[] = {1, 2, 3, 4, 5};
- const int N = sizeof(a)/sizeof(a[0]);
- std::list<int, min_allocator<int>>::iterator i = v.insert(next(v2.cbegin(), 10), input_iterator<const int*>(a),
- input_iterator<const int*>(a+N));
- assert(false);
- }
#endif
+}
+
+int main()
+{
+ test<std::list<int> >();
+#if TEST_STD_VER >= 11
+ test<std::list<int, min_allocator<int>>>();
#endif
}
diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp
index 3d5dec299b95..5d579fcd202e 100644
--- a/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp
@@ -7,14 +7,12 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <list>
// iterator insert(const_iterator position, value_type&& x);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <list>
#include <cassert>
@@ -23,7 +21,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::list<MoveOnly> l1;
l1.insert(l1.cend(), MoveOnly(1));
@@ -34,17 +31,6 @@ int main()
assert(l1.front() == MoveOnly(2));
assert(l1.back() == MoveOnly(1));
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int> v1(3);
- std::list<int> v2(3);
- v1.insert(v2.begin(), 4);
- assert(false);
- }
-#endif
-#if __cplusplus >= 201103L
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::list<MoveOnly, min_allocator<MoveOnly>> l1;
l1.insert(l1.cend(), MoveOnly(1));
@@ -55,14 +41,4 @@ int main()
assert(l1.front() == MoveOnly(2));
assert(l1.back() == MoveOnly(1));
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int, min_allocator<int>> v1(3);
- std::list<int, min_allocator<int>> v2(3);
- v1.insert(v2.begin(), 4);
- assert(false);
- }
-#endif
-#endif
}
diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
index c0f6ed198751..d85c1f4b9987 100644
--- a/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -14,75 +14,23 @@
// UNSUPPORTED: sanitizer-new-delete
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <list>
#include <cstdlib>
#include <cassert>
#include "min_allocator.h"
+#include "count_new.hpp"
-int throw_next = 0xFFFF;
-int count = 0;
-
-void* operator new(std::size_t s) throw(std::bad_alloc)
-{
- if (throw_next == 0)
- throw std::bad_alloc();
- --throw_next;
- ++count;
- return std::malloc(s);
-}
-
-void operator delete(void* p) throw()
-{
- --count;
- std::free(p);
-}
-
-int main()
-{
- {
- int a1[] = {1, 2, 3};
- int a2[] = {1, 4, 4, 4, 4, 4, 2, 3};
- std::list<int> l1(a1, a1+3);
- std::list<int>::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
- assert(i == next(l1.begin()));
- assert(l1 == std::list<int>(a2, a2+8));
- throw_next = 4;
- int save_count = count;
- try
- {
- i = l1.insert(i, 5, 5);
- assert(false);
- }
- catch (...)
- {
- }
- throw_next = 0xFFFF;
- assert(save_count == count);
- assert(l1 == std::list<int>(a2, a2+8));
- }
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int> c1(100);
- std::list<int> c2;
- std::list<int>::iterator i = c1.insert(next(c2.cbegin(), 10), 5, 1);
- assert(false);
- }
-#endif
-#if __cplusplus >= 201103L
- {
+template <class List>
+void test() {
int a1[] = {1, 2, 3};
int a2[] = {1, 4, 4, 4, 4, 4, 2, 3};
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
+ List l1(a1, a1+3);
+ typename List::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
assert(i == next(l1.begin()));
- assert((l1 == std::list<int, min_allocator<int>>(a2, a2+8)));
- throw_next = 4;
- int save_count = count;
+ assert(l1 == List(a2, a2+8));
+ globalMemCounter.throw_after = 4;
+ int save_count = globalMemCounter.outstanding_new;
try
{
i = l1.insert(i, 5, 5);
@@ -91,17 +39,14 @@ int main()
catch (...)
{
}
- throw_next = 0xFFFF;
- assert(save_count == count);
- assert((l1 == std::list<int, min_allocator<int>>(a2, a2+8)));
- }
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int, min_allocator<int>> c1(100);
- std::list<int, min_allocator<int>> c2;
- std::list<int, min_allocator<int>>::iterator i = c1.insert(next(c2.cbegin(), 10), 5, 1);
- assert(false);
- }
-#endif
+ assert(globalMemCounter.checkOutstandingNewEq(save_count));
+ assert(l1 == List(a2, a2+8));
+}
+
+int main()
+{
+ test<std::list<int> >();
+#if TEST_STD_VER >= 11
+ test<std::list<int, min_allocator<int>>>();
#endif
}
diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
index 1aacb63e4a70..87a033be64e9 100644
--- a/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
@@ -7,87 +7,33 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <list>
// iterator insert(const_iterator position, const value_type& x);
-// UNSUPPORTED: sanitizer-new-delete
-
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <list>
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
+#include "count_new.hpp"
-int throw_next = 0xFFFF;
-int count = 0;
-
-void* operator new(std::size_t s) throw(std::bad_alloc)
-{
- if (throw_next == 0)
- throw std::bad_alloc();
- --throw_next;
- ++count;
- return std::malloc(s);
-}
-
-void operator delete(void* p) throw()
-{
- --count;
- std::free(p);
-}
-
-int main()
+template <class List>
+void test()
{
- {
- int a1[] = {1, 2, 3};
- int a2[] = {1, 4, 2, 3};
- std::list<int> l1(a1, a1+3);
- std::list<int>::iterator i = l1.insert(next(l1.cbegin()), 4);
- assert(i == next(l1.begin()));
- assert(l1.size() == 4);
- assert(distance(l1.begin(), l1.end()) == 4);
- assert(l1 == std::list<int>(a2, a2+4));
- throw_next = 0;
- int save_count = count;
- try
- {
- i = l1.insert(i, 5);
- assert(false);
- }
- catch (...)
- {
- }
- throw_next = 0xFFFF;
- assert(save_count == count);
- assert(l1 == std::list<int>(a2, a2+4));
- }
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int> v1(3);
- std::list<int> v2(3);
- int i = 4;
- v1.insert(v2.begin(), i);
- assert(false);
- }
-#endif
-#if __cplusplus >= 201103L
- {
int a1[] = {1, 2, 3};
int a2[] = {1, 4, 2, 3};
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.insert(next(l1.cbegin()), 4);
+ List l1(a1, a1+3);
+ typename List::iterator i = l1.insert(next(l1.cbegin()), 4);
assert(i == next(l1.begin()));
assert(l1.size() == 4);
assert(distance(l1.begin(), l1.end()) == 4);
- assert((l1 == std::list<int, min_allocator<int>>(a2, a2+4)));
- throw_next = 0;
- int save_count = count;
+ assert(l1 == List(a2, a2+4));
+
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT)
+ globalMemCounter.throw_after = 0;
+ int save_count = globalMemCounter.outstanding_new;
try
{
i = l1.insert(i, 5);
@@ -96,18 +42,15 @@ int main()
catch (...)
{
}
- throw_next = 0xFFFF;
- assert(save_count == count);
- assert((l1 == std::list<int, min_allocator<int>>(a2, a2+4)));
- }
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int, min_allocator<int>> v1(3);
- std::list<int, min_allocator<int>> v2(3);
- int i = 4;
- v1.insert(v2.begin(), i);
- assert(false);
- }
+ assert(globalMemCounter.checkOutstandingNewEq(save_count));
+ assert(l1 == List(a2, a2+4));
#endif
+}
+
+int main()
+{
+ test<std::list<int> >();
+#if TEST_STD_VER >= 11
+ test<std::list<int, min_allocator<int>>>();
#endif
}
diff --git a/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp b/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp
index 3add8518809c..c5b0277c6eff 100644
--- a/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp
@@ -11,13 +11,10 @@
// void pop_back();
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -31,12 +28,8 @@ int main()
assert(c == std::list<int>(a, a+1));
c.pop_back();
assert(c.empty());
-#if _LIBCPP_DEBUG >= 1
- c.pop_back();
- assert(false);
-#endif
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a[] = {1, 2, 3};
std::list<int, min_allocator<int>> c(a, a+3);
@@ -46,10 +39,6 @@ int main()
assert((c == std::list<int, min_allocator<int>>(a, a+1)));
c.pop_back();
assert(c.empty());
-#if _LIBCPP_DEBUG >= 1
- c.pop_back();
- assert(false);
-#endif
}
#endif
}
diff --git a/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp b/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp
index aec17cc08f43..bb3ad546984d 100644
--- a/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp
@@ -28,7 +28,7 @@ int main()
c.pop_front();
assert(c.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a[] = {1, 2, 3};
std::list<int, min_allocator<int>> c(a, a+3);
diff --git a/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp
index 2638c541fa1c..3b05cd72968e 100644
--- a/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp
@@ -25,7 +25,7 @@ int main()
int a[] = {0, 1, 2, 3, 4};
assert(c == std::list<int>(a, a+5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> c;
for (int i = 0; i < 5; ++i)
diff --git a/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp
index a2837f813bea..10acede511f4 100644
--- a/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp
@@ -30,7 +30,7 @@ int main()
assert(l1.front() == MoveOnly(1));
assert(l1.back() == MoveOnly(2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<MoveOnly, min_allocator<MoveOnly>> l1;
l1.push_back(MoveOnly(1));
diff --git a/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp
index b7f4febcd385..ed0ef662031a 100644
--- a/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp
@@ -25,7 +25,7 @@ int main()
int a[] = {4, 3, 2, 1, 0};
assert(c == std::list<int>(a, a+5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> c;
for (int i = 0; i < 5; ++i)
diff --git a/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp
index 4f41c3dd390b..5321ee0faed3 100644
--- a/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp
@@ -30,7 +30,7 @@ int main()
assert(l1.front() == MoveOnly(2));
assert(l1.back() == MoveOnly(1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<MoveOnly, min_allocator<MoveOnly>> l1;
l1.push_front(MoveOnly(1));
diff --git a/test/std/containers/sequences/list/list.ops/merge.pass.cpp b/test/std/containers/sequences/list/list.ops/merge.pass.cpp
index d226ed5dc642..7c1287706f35 100644
--- a/test/std/containers/sequences/list/list.ops/merge.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/merge.pass.cpp
@@ -27,7 +27,7 @@ int main()
c1.merge(c2);
assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
diff --git a/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp b/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
index ce861a5dcb88..838ff22b3a53 100644
--- a/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
@@ -28,7 +28,7 @@ int main()
c1.merge(c2, std::greater<int>());
assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {10, 9, 7, 3, 1};
int a2[] = {11, 8, 6, 5, 4, 2, 0};
diff --git a/test/std/containers/sequences/list/list.ops/remove.pass.cpp b/test/std/containers/sequences/list/list.ops/remove.pass.cpp
index f580c94ef486..fed28e442e12 100644
--- a/test/std/containers/sequences/list/list.ops/remove.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/remove.pass.cpp
@@ -57,7 +57,7 @@ int main()
}
assert ( it == c.end ());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3, 4};
int a2[] = {1, 2, 4};
diff --git a/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp b/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp
index 162919ed85de..1b457823d6ab 100644
--- a/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(c == std::list<int>(a2, a2+2));
assert(cp.count() == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3, 4};
int a2[] = {3, 4};
diff --git a/test/std/containers/sequences/list/list.ops/reverse.pass.cpp b/test/std/containers/sequences/list/list.ops/reverse.pass.cpp
index 046453ae5386..120caba38ac9 100644
--- a/test/std/containers/sequences/list/list.ops/reverse.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/reverse.pass.cpp
@@ -25,7 +25,7 @@ int main()
c1.reverse();
assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
diff --git a/test/std/containers/sequences/list/list.ops/sort.pass.cpp b/test/std/containers/sequences/list/list.ops/sort.pass.cpp
index 1c11227237a7..d51aa92dd782 100644
--- a/test/std/containers/sequences/list/list.ops/sort.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/sort.pass.cpp
@@ -25,7 +25,7 @@ int main()
c1.sort();
assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
diff --git a/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp b/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp
index 28125ab83c00..517eb62ccae2 100644
--- a/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp
@@ -26,7 +26,7 @@ int main()
c1.sort(std::greater<int>());
assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
int a2[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
diff --git a/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp b/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp
index 354871c20afa..41d861da0d55 100644
--- a/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp
@@ -11,13 +11,10 @@
// void splice(const_iterator position, list& x);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -403,15 +400,7 @@ int main()
++i;
assert(*i == 6);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int> v1(3);
- std::list<int> v2(3);
- v1.splice(v2.begin(), v2);
- assert(false);
- }
-#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l1;
std::list<int, min_allocator<int>> l2;
@@ -791,13 +780,5 @@ int main()
++i;
assert(*i == 6);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int, min_allocator<int>> v1(3);
- std::list<int, min_allocator<int>> v2(3);
- v1.splice(v2.begin(), v2);
- assert(false);
- }
-#endif
#endif
}
diff --git a/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp b/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp
index 5082c3f85175..427624a1cc3e 100644
--- a/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp
@@ -11,13 +11,10 @@
// void splice(const_iterator position, list<T,Allocator>& x, iterator i);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -180,15 +177,7 @@ int main()
++i;
assert(*i == 2);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int> v1(3);
- std::list<int> v2(3);
- v1.splice(v1.begin(), v2, v1.begin());
- assert(false);
- }
-#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l1;
std::list<int, min_allocator<int>> l2(a2, a2+1);
@@ -345,13 +334,5 @@ int main()
++i;
assert(*i == 2);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int, min_allocator<int>> v1(3);
- std::list<int, min_allocator<int>> v2(3);
- v1.splice(v1.begin(), v2, v1.begin());
- assert(false);
- }
-#endif
#endif
}
diff --git a/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp b/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp
index fcc4acceec57..b7010636d20e 100644
--- a/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp
@@ -11,13 +11,10 @@
// void splice(const_iterator position, list& x, iterator first, iterator last);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -120,15 +117,7 @@ int main()
i = l2.begin();
assert(*i == 4);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int> v1(3);
- std::list<int> v2(3);
- v1.splice(v1.begin(), v2, v2.begin(), v1.end());
- assert(false);
- }
-#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l1(a1, a1+3);
l1.splice(l1.begin(), l1, next(l1.begin()), next(l1.begin()));
@@ -225,13 +214,5 @@ int main()
i = l2.begin();
assert(*i == 4);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::list<int, min_allocator<int>> v1(3);
- std::list<int, min_allocator<int>> v2(3);
- v1.splice(v1.begin(), v2, v2.begin(), v1.end());
- assert(false);
- }
-#endif
#endif
}
diff --git a/test/std/containers/sequences/list/list.ops/unique.pass.cpp b/test/std/containers/sequences/list/list.ops/unique.pass.cpp
index 48cad1ddd156..fa85b0eae77c 100644
--- a/test/std/containers/sequences/list/list.ops/unique.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/unique.pass.cpp
@@ -25,7 +25,7 @@ int main()
c.unique();
assert(c == std::list<int>(a2, a2+4));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {2, 1, 1, 4, 4, 4, 4, 3, 3};
int a2[] = {2, 1, 4, 3};
diff --git a/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp b/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
index f8935b81f6a7..de6347d46f39 100644
--- a/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
@@ -30,7 +30,7 @@ int main()
c.unique(g);
assert(c == std::list<int>(a2, a2+4));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {2, 1, 1, 4, 4, 4, 4, 3, 3};
int a2[] = {2, 1, 4, 3};
diff --git a/test/std/containers/sequences/list/list.special/db_swap_1.pass.cpp b/test/std/containers/sequences/list/list.special/db_swap_1.pass.cpp
deleted file mode 100644
index f7171795cd5f..000000000000
--- a/test/std/containers/sequences/list/list.special/db_swap_1.pass.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <list>
-
-// template <class T, class Alloc>
-// void swap(list<T,Alloc>& x, list<T,Alloc>& y);
-
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <list>
-#include <cassert>
-
-#include <__debug>
-#include "min_allocator.h"
-
-int main()
-{
-#if _LIBCPP_DEBUG >= 1
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::list<int>::iterator i1 = c1.begin();
- std::list<int>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- c2.erase(i1);
- std::list<int>::iterator j = i1;
- c1.erase(i1);
- assert(false);
- }
-#if __cplusplus >= 201103L
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::list<int, min_allocator<int>>::iterator i1 = c1.begin();
- std::list<int, min_allocator<int>>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- c2.erase(i1);
- std::list<int, min_allocator<int>>::iterator j = i1;
- c1.erase(i1);
- assert(false);
- }
-#endif
-#endif
-}
diff --git a/test/std/containers/sequences/list/list.special/swap.pass.cpp b/test/std/containers/sequences/list/list.special/swap.pass.cpp
index bc5f4857edc7..54b262572ded 100644
--- a/test/std/containers/sequences/list/list.special/swap.pass.cpp
+++ b/test/std/containers/sequences/list/list.special/swap.pass.cpp
@@ -59,21 +59,18 @@ int main()
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
}
-#ifndef _LIBCPP_DEBUG_LEVEL
-// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
typedef test_allocator<int> A;
std::list<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
- std::list<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
+ std::list<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(1));
swap(c1, c2);
assert((c1 == std::list<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
assert(c1.get_allocator() == A(1));
assert((c2 == std::list<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator() == A(1));
}
-#endif
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -86,7 +83,7 @@ int main()
assert((c2 == std::list<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
assert(c2.get_allocator() == A(1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -127,8 +124,6 @@ int main()
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
}
-#ifndef _LIBCPP_DEBUG_LEVEL
-// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -142,5 +137,4 @@ int main()
assert(c2.get_allocator() == A());
}
#endif
-#endif
}
diff --git a/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
index 9c83ad58fed4..820da4c78f81 100644
--- a/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <list>
// void swap(list& c)
@@ -21,6 +23,7 @@
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -28,7 +31,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -40,7 +43,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -51,7 +54,6 @@ struct some_alloc2
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::list<MoveOnly> C;
C c1, c2;
@@ -86,5 +88,4 @@ int main()
}
#endif
-#endif
}
diff --git a/test/std/containers/sequences/list/types.pass.cpp b/test/std/containers/sequences/list/types.pass.cpp
index 77303601ae97..7d5f5b6fa2f0 100644
--- a/test/std/containers/sequences/list/types.pass.cpp
+++ b/test/std/containers/sequences/list/types.pass.cpp
@@ -31,18 +31,39 @@ struct A { std::list<A> v; }; // incomplete type support
int main()
{
- static_assert((std::is_same<std::list<int>::value_type, int>::value), "");
- static_assert((std::is_same<std::list<int>::allocator_type, std::allocator<int> >::value), "");
- static_assert((std::is_same<std::list<int>::reference, std::allocator<int>::reference>::value), "");
- static_assert((std::is_same<std::list<int>::const_reference, std::allocator<int>::const_reference>::value), "");
- static_assert((std::is_same<std::list<int>::pointer, std::allocator<int>::pointer>::value), "");
- static_assert((std::is_same<std::list<int>::const_pointer, std::allocator<int>::const_pointer>::value), "");
-#if __cplusplus >= 201103L
- static_assert((std::is_same<std::list<int, min_allocator<int>>::value_type, int>::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::allocator_type, min_allocator<int> >::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::reference, int&>::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::const_reference, const int&>::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::pointer, min_pointer<int>>::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::const_pointer, min_pointer<const int>>::value), "");
+ {
+ typedef std::list<int> C;
+ static_assert((std::is_same<C::value_type, int>::value), "");
+ static_assert((std::is_same<C::allocator_type, std::allocator<int> >::value), "");
+ static_assert((std::is_same<C::reference, std::allocator<int>::reference>::value), "");
+ static_assert((std::is_same<C::const_reference, std::allocator<int>::const_reference>::value), "");
+ static_assert((std::is_same<C::pointer, std::allocator<int>::pointer>::value), "");
+ static_assert((std::is_same<C::const_pointer, std::allocator<int>::const_pointer>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ typedef std::list<int, min_allocator<int>> C;
+ static_assert((std::is_same<C::value_type, int>::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<int> >::value), "");
+ static_assert((std::is_same<C::reference, int&>::value), "");
+ static_assert((std::is_same<C::const_reference, const int&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<int>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const int>>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+ }
#endif
}
diff --git a/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp b/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
index 9501799ae3d0..54b7e84bb092 100644
--- a/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
@@ -19,22 +19,22 @@
int main()
{
{
- std::vector<bool, test_allocator<bool> > l(3, 2, test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > l(3, true, test_allocator<bool>(5));
std::vector<bool, test_allocator<bool> > l2(l, test_allocator<bool>(3));
l2 = l;
assert(l2 == l);
assert(l2.get_allocator() == test_allocator<bool>(3));
}
{
- std::vector<bool, other_allocator<bool> > l(3, 2, other_allocator<bool>(5));
+ std::vector<bool, other_allocator<bool> > l(3, true, other_allocator<bool>(5));
std::vector<bool, other_allocator<bool> > l2(l, other_allocator<bool>(3));
l2 = l;
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<bool>(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
- std::vector<bool, min_allocator<bool> > l(3, 2, min_allocator<bool>());
+ std::vector<bool, min_allocator<bool> > l(3, true, min_allocator<bool>());
std::vector<bool, min_allocator<bool> > l2(l, min_allocator<bool>());
l2 = l;
assert(l2 == l);
diff --git a/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp
index 2925fbc66745..ac7a2ce38adf 100644
--- a/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(d[2] == false);
assert(d[3] == true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> d;
d.assign({true, false, false, true});
diff --git a/test/std/containers/sequences/vector.bool/assign_move.pass.cpp b/test/std/containers/sequences/vector.bool/assign_move.pass.cpp
index df98c817fd59..f07c1d90059d 100644
--- a/test/std/containers/sequences/vector.bool/assign_move.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/assign_move.pass.cpp
@@ -61,7 +61,7 @@ int main()
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{});
std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
diff --git a/test/std/containers/sequences/vector.bool/capacity.pass.cpp b/test/std/containers/sequences/vector.bool/capacity.pass.cpp
index 63bff25f9f9a..3cbb09fe4ef0 100644
--- a/test/std/containers/sequences/vector.bool/capacity.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/capacity.pass.cpp
@@ -29,7 +29,7 @@ int main()
v.push_back(0);
assert(v.capacity() >= 101);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> v;
assert(v.capacity() == 0);
diff --git a/test/std/containers/sequences/vector.bool/construct_default.pass.cpp b/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
index 07824098fc6f..983d363d1940 100644
--- a/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
@@ -29,12 +29,12 @@ test0()
static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
#endif
C c;
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == typename C::allocator_type());
#if TEST_STD_VER >= 11
C c1 = {};
- assert(c1.__invariants());
+ LIBCPP_ASSERT(c1.__invariants());
assert(c1.empty());
assert(c1.get_allocator() == typename C::allocator_type());
#endif
@@ -50,7 +50,7 @@ test1(const typename C::allocator_type& a)
static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
#endif
C c(a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == a);
}
diff --git a/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp b/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
index 94e6801825d8..3d11239702c9 100644
--- a/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
@@ -15,6 +15,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@@ -23,7 +24,7 @@ void
test(Iterator first, Iterator last)
{
C c(first, last);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
@@ -38,7 +39,7 @@ int main()
test<std::vector<bool> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an));
test<std::vector<bool> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an));
test<std::vector<bool> >(a, an);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<bool, min_allocator<bool>> >(input_iterator<const bool*>(a), input_iterator<const bool*>(an));
test<std::vector<bool, min_allocator<bool>> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an));
test<std::vector<bool, min_allocator<bool>> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an));
diff --git a/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
index ea9d41d342f8..196694d73998 100644
--- a/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
@@ -16,6 +16,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@@ -24,7 +25,7 @@ void
test(Iterator first, Iterator last, const typename C::allocator_type& a)
{
C c(first, last, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
@@ -42,7 +43,7 @@ int main()
test<std::vector<bool> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an), alloc);
test<std::vector<bool> >(a, an, alloc);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
min_allocator<bool> alloc;
test<std::vector<bool, min_allocator<bool>> >(input_iterator<const bool*>(a), input_iterator<const bool*>(an), alloc);
diff --git a/test/std/containers/sequences/vector.bool/construct_size.pass.cpp b/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
index 93ecbe87c380..271e4ee33aa4 100644
--- a/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
@@ -15,22 +15,22 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "test_allocator.h"
template <class C>
void
-test2(typename C::size_type n, typename C::allocator_type const& a = typename C::allocator_type ())
+test2(typename C::size_type n,
+ typename C::allocator_type const& a = typename C::allocator_type ())
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
C c(n, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == n);
assert(c.get_allocator() == a);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type());
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}
@@ -39,7 +39,7 @@ void
test1(typename C::size_type n)
{
C c(n);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == n);
assert(c.get_allocator() == typename C::allocator_type());
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
@@ -57,7 +57,7 @@ test(typename C::size_type n)
int main()
{
test<std::vector<bool> >(50);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<bool, min_allocator<bool>> >(50);
test2<std::vector<bool, test_allocator<bool>> >( 100, test_allocator<bool>(23));
#endif
diff --git a/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp b/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
index fc772f10dfc4..c66fd4972899 100644
--- a/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
@@ -15,6 +15,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -22,7 +23,7 @@ void
test(typename C::size_type n, const typename C::value_type& x)
{
C c(n, x);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == n);
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == x);
@@ -30,8 +31,8 @@ test(typename C::size_type n, const typename C::value_type& x)
int main()
{
- test<std::vector<bool> >(50, 3);
-#if __cplusplus >= 201103L
- test<std::vector<bool, min_allocator<bool>> >(50, 3);
+ test<std::vector<bool> >(50, true);
+#if TEST_STD_VER >= 11
+ test<std::vector<bool, min_allocator<bool>> >(50, true);
#endif
}
diff --git a/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
index 6cca948ed834..2ef501271f52 100644
--- a/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
@@ -15,6 +15,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -23,7 +24,7 @@ test(typename C::size_type n, const typename C::value_type& x,
const typename C::allocator_type& a)
{
C c(n, x, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(a == c.get_allocator());
assert(c.size() == n);
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
@@ -32,8 +33,8 @@ test(typename C::size_type n, const typename C::value_type& x,
int main()
{
- test<std::vector<bool> >(50, 3, std::allocator<bool>());
-#if __cplusplus >= 201103L
- test<std::vector<bool, min_allocator<bool>> >(50, 3, min_allocator<bool>());
+ test<std::vector<bool> >(50, true, std::allocator<bool>());
+#if TEST_STD_VER >= 11
+ test<std::vector<bool, min_allocator<bool>> >(50, true, min_allocator<bool>());
#endif
}
diff --git a/test/std/containers/sequences/vector.bool/copy.pass.cpp b/test/std/containers/sequences/vector.bool/copy.pass.cpp
index 58822782ff8b..b3cf9b551f96 100644
--- a/test/std/containers/sequences/vector.bool/copy.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/copy.pass.cpp
@@ -14,6 +14,8 @@
#include <vector>
#include <cassert>
+
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -23,7 +25,7 @@ test(const C& x)
{
unsigned s = x.size();
C c(x);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
assert(c == x);
}
@@ -36,27 +38,25 @@ int main()
test(std::vector<bool>(a, an));
}
{
- std::vector<bool, test_allocator<bool> > v(3, 2, test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > v(3, true, test_allocator<bool>(5));
std::vector<bool, test_allocator<bool> > v2 = v;
assert(v2 == v);
assert(v2.get_allocator() == v.get_allocator());
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
- std::vector<bool, other_allocator<bool> > v(3, 2, other_allocator<bool>(5));
+ std::vector<bool, other_allocator<bool> > v(3, true, other_allocator<bool>(5));
std::vector<bool, other_allocator<bool> > v2 = v;
assert(v2 == v);
assert(v2.get_allocator() == other_allocator<bool>(-2));
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
{
bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
bool* an = a + sizeof(a)/sizeof(a[0]);
test(std::vector<bool, min_allocator<bool>>(a, an));
}
{
- std::vector<bool, min_allocator<bool> > v(3, 2, min_allocator<bool>());
+ std::vector<bool, min_allocator<bool> > v(3, true, min_allocator<bool>());
std::vector<bool, min_allocator<bool> > v2 = v;
assert(v2 == v);
assert(v2.get_allocator() == v.get_allocator());
diff --git a/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
index 2f0192b995ad..aa8646a9b819 100644
--- a/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
@@ -13,6 +13,8 @@
#include <vector>
#include <cassert>
+
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -22,7 +24,7 @@ test(const C& x, const typename C::allocator_type& a)
{
unsigned s = x.size();
C c(x, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
assert(c == x);
}
@@ -30,30 +32,30 @@ test(const C& x, const typename C::allocator_type& a)
int main()
{
{
- int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
- int* an = a + sizeof(a)/sizeof(a[0]);
+ bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+ bool* an = a + sizeof(a)/sizeof(a[0]);
test(std::vector<bool>(a, an), std::allocator<bool>());
}
{
- std::vector<bool, test_allocator<bool> > l(3, 2, test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > l(3, true, test_allocator<bool>(5));
std::vector<bool, test_allocator<bool> > l2(l, test_allocator<bool>(3));
assert(l2 == l);
assert(l2.get_allocator() == test_allocator<bool>(3));
}
{
- std::vector<bool, other_allocator<bool> > l(3, 2, other_allocator<bool>(5));
+ std::vector<bool, other_allocator<bool> > l(3, true, other_allocator<bool>(5));
std::vector<bool, other_allocator<bool> > l2(l, other_allocator<bool>(3));
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<bool>(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
- int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
- int* an = a + sizeof(a)/sizeof(a[0]);
+ bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+ bool* an = a + sizeof(a)/sizeof(a[0]);
test(std::vector<bool, min_allocator<bool>>(a, an), min_allocator<bool>());
}
{
- std::vector<bool, min_allocator<bool> > l(3, 2, min_allocator<bool>());
+ std::vector<bool, min_allocator<bool> > l(3, true, min_allocator<bool>());
std::vector<bool, min_allocator<bool> > l2(l, min_allocator<bool>());
assert(l2 == l);
assert(l2.get_allocator() == min_allocator<bool>());
diff --git a/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
index b94588ead93b..4f860dabac95 100644
--- a/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
@@ -14,9 +14,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -28,14 +31,13 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<bool> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::vector<bool, test_allocator<bool>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::vector<bool, other_allocator<bool>> C;
@@ -45,5 +47,4 @@ int main()
typedef std::vector<bool, some_alloc<bool>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
index 682e74ef03c2..bd2534ad3de7 100644
--- a/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
@@ -11,13 +11,13 @@
// ~vector<bool>() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <vector>
#include <cassert>
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_alloc
{
@@ -26,11 +26,8 @@ struct some_alloc
~some_alloc() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<bool> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -47,5 +44,4 @@ int main()
typedef std::vector<bool, some_alloc<bool>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/vector.bool/emplace.pass.cpp b/test/std/containers/sequences/vector.bool/emplace.pass.cpp
index f3fd1e9926f0..ccdce913c73c 100644
--- a/test/std/containers/sequences/vector.bool/emplace.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/emplace.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <vector>
// vector<bool>
@@ -18,11 +19,10 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef std::vector<bool> C;
C c;
-
+
C::iterator i = c.emplace(c.cbegin());
assert(i == c.begin());
assert(c.size() == 1);
@@ -64,5 +64,4 @@ int main()
assert(c[1] == true);
assert(c.back() == true);
}
-#endif
}
diff --git a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
index 57aa47822f8a..2950ee3882f1 100644
--- a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <vector>
// vector.bool
@@ -19,7 +20,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef std::vector<bool> C;
C c;
@@ -39,7 +39,7 @@ int main()
{
typedef std::vector<bool, min_allocator<bool>> C;
C c;
-
+
c.emplace_back();
assert(c.size() == 1);
assert(c.front() == false);
@@ -53,5 +53,4 @@ int main()
assert(c[1] == true);
assert(c.back() == true);
}
-#endif
}
diff --git a/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp b/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp
index cbf26dd570a5..04e3dd7c25f1 100644
--- a/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp
@@ -40,7 +40,7 @@ int main()
assert(l1.size() == 0);
assert(distance(l1.begin(), l1.end()) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> l1(a1, a1+3);
std::vector<bool, min_allocator<bool>>::const_iterator i = l1.begin();
diff --git a/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp b/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp
index 2c2c4cc48616..2b9f0e31c2fa 100644
--- a/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp
@@ -50,7 +50,7 @@ int main()
assert(distance(l1.cbegin(), l1.cend()) == 0);
assert(i == l1.begin());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> l1(a1, a1+3);
std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
diff --git a/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp
index b9b468654497..07bae0eb7089 100644
--- a/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp
@@ -27,7 +27,7 @@ int main()
assert(d[2] == false);
assert(d[3] == true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> d = {true, false, false, true};
assert(d.size() == 4);
diff --git a/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp
index aea3ad763cde..5f7f5144f841 100644
--- a/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(d[2] == false);
assert(d[3] == true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> d({true, false, false, true}, min_allocator<bool>());
assert(d.get_allocator() == min_allocator<bool>());
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp
index c081cc81c592..3a176d94e860 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp
@@ -39,7 +39,7 @@ int main()
assert(d[12] == true);
assert(d[13] == true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> d(10, true);
std::vector<bool, min_allocator<bool>>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false});
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
index e51f8b589c7f..89fe7a76d409 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
@@ -89,7 +89,7 @@ int main()
for (; j < v.size(); ++j)
assert(v[j] == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> v(100);
bool a[] = {1, 0, 0, 1, 1};
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
index 710ad4885f09..35c57cbd8e42 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
@@ -63,7 +63,7 @@ int main()
for (++j; j < v.size(); ++j)
assert(v[j] == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> v(100);
std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
index 51c4626de0d0..78ffe7ba73cd 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
@@ -60,7 +60,7 @@ int main()
for (++j; j < v.size(); ++j)
assert(v[j] == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> v(100);
std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 1);
diff --git a/test/std/containers/sequences/vector.bool/iterators.pass.cpp b/test/std/containers/sequences/vector.bool/iterators.pass.cpp
index c54fa4a80a95..882ac9be4a5d 100644
--- a/test/std/containers/sequences/vector.bool/iterators.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/iterators.pass.cpp
@@ -58,7 +58,7 @@ int main()
C::iterator i;
C::const_iterator j;
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef bool T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/vector.bool/move.pass.cpp b/test/std/containers/sequences/vector.bool/move.pass.cpp
index e877292ced77..f3a11ec562c0 100644
--- a/test/std/containers/sequences/vector.bool/move.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{});
std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
diff --git a/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp
index deee93261971..7aaa7c55550b 100644
--- a/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp
@@ -58,7 +58,7 @@ int main()
assert(!l.empty());
assert(l2.get_allocator() == other_allocator<bool>(4));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{});
std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
diff --git a/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
index 4dd871c9447e..fe53fbfc17e0 100644
--- a/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
@@ -16,6 +16,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <vector>
#include <cassert>
@@ -32,7 +34,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -45,7 +47,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -56,7 +58,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<bool> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -87,6 +88,4 @@ int main()
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
index 132186b555f2..2153c7956bfc 100644
--- a/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <vector>
#include <cassert>
@@ -28,7 +30,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<bool> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -50,5 +51,4 @@ int main()
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
#endif
}
-#endif
}
diff --git a/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp
index ef3dc5d10796..4b959cf00ad3 100644
--- a/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(d[2] == false);
assert(d[3] == true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> d;
d = {true, false, false, true};
diff --git a/test/std/containers/sequences/vector.bool/push_back.pass.cpp b/test/std/containers/sequences/vector.bool/push_back.pass.cpp
index c6b0fbf41853..3897a438b445 100644
--- a/test/std/containers/sequences/vector.bool/push_back.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/push_back.pass.cpp
@@ -31,7 +31,7 @@ int main()
assert(c[j] == a[j]);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
bool a[] = {0, 1, 1, 0, 1, 0, 0};
const unsigned N = sizeof(a)/sizeof(a[0]);
diff --git a/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp b/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
new file mode 100644
index 000000000000..06351e418ac4
--- /dev/null
+++ b/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+// vector<bool>
+
+// static void swap(reference x, reference y) noexcept;
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+
+ bool a[] = {false, true, false, true};
+ bool* an = a + sizeof(a)/sizeof(a[0]);
+
+ std::vector<bool> v(a, an);
+ std::vector<bool>::reference r1 = v[0];
+ std::vector<bool>::reference r2 = v[3];
+
+#if TEST_STD_VER >= 11
+ static_assert((noexcept(v.swap(r1,r2))), "");
+#endif
+
+ assert(!r1);
+ assert( r2);
+ v.swap(r1, r2);
+ assert( r1);
+ assert(!r2);
+}
diff --git a/test/std/containers/sequences/vector.bool/reserve.pass.cpp b/test/std/containers/sequences/vector.bool/reserve.pass.cpp
index be717a3be8a8..489ca95ee789 100644
--- a/test/std/containers/sequences/vector.bool/reserve.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/reserve.pass.cpp
@@ -34,7 +34,7 @@ int main()
assert(v.size() == 100);
assert(v.capacity() >= 150);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> v;
v.reserve(10);
diff --git a/test/std/containers/sequences/vector.bool/resize_size.pass.cpp b/test/std/containers/sequences/vector.bool/resize_size.pass.cpp
index f75720c94ea3..bc51e0bbba27 100644
--- a/test/std/containers/sequences/vector.bool/resize_size.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/resize_size.pass.cpp
@@ -32,7 +32,7 @@ int main()
assert(v.size() == 300);
assert(v.capacity() >= 400);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> v(100);
v.resize(50);
diff --git a/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp b/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp
index 8cecf44d2fb0..919000732698 100644
--- a/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp
@@ -33,7 +33,7 @@ int main()
for (unsigned i = 50; i < 200; ++i)
assert(v[i] == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> v(100);
v.resize(50, 1);
diff --git a/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp b/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp
index 1f9fcac3d9bf..03997cbec71e 100644
--- a/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp
@@ -26,7 +26,7 @@ int main()
assert(v.capacity() >= 101);
assert(v.size() >= 101);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> v(100);
v.push_back(1);
diff --git a/test/std/containers/sequences/vector.bool/swap.pass.cpp b/test/std/containers/sequences/vector.bool/swap.pass.cpp
index a92c6a6c165f..81af528f2a9a 100644
--- a/test/std/containers/sequences/vector.bool/swap.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/swap.pass.cpp
@@ -62,7 +62,7 @@ int main()
assert(v[0] == false);
assert(v[1] == true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<bool, min_allocator<bool>> v1(100);
std::vector<bool, min_allocator<bool>> v2(200);
diff --git a/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
index 6f36473fa989..7ba44453b371 100644
--- a/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <vector>
// void swap(vector& c)
@@ -22,13 +24,14 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -40,7 +43,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -51,7 +54,6 @@ struct some_alloc2
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<bool> C;
C c1, c2;
@@ -85,6 +87,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/sequences/vector.bool/types.pass.cpp b/test/std/containers/sequences/vector.bool/types.pass.cpp
index b266b3bbb927..4e8edc8891bd 100644
--- a/test/std/containers/sequences/vector.bool/types.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/types.pass.cpp
@@ -46,7 +46,15 @@ test()
static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
static_assert((std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
static_assert((std::is_same<typename C::difference_type, typename std::allocator_traits<Allocator>::difference_type>::value), "");
- static_assert((std::is_same<
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+
+ static_assert((std::is_same<
typename std::iterator_traits<typename C::iterator>::iterator_category,
std::random_access_iterator_tag>::value), "");
static_assert((std::is_same<
@@ -66,7 +74,7 @@ int main()
test<std::allocator<bool> >();
static_assert((std::is_same<std::vector<bool>::allocator_type,
std::allocator<bool> >::value), "");
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<min_allocator<bool> >();
#endif
}
diff --git a/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp b/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
index a78f4fd590be..4f82792fa1fd 100644
--- a/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
@@ -31,18 +31,18 @@ int main()
typedef std::hash<T> H;
static_assert((std::is_same<H::argument_type, T>::value), "" );
static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
-
+
bool ba[] = {true, false, true, true, false};
T vb(std::begin(ba), std::end(ba));
H h;
assert(h(vb) != 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::vector<bool, min_allocator<bool>> T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
bool ba[] = {true, false, true, true, false};
T vb(std::begin(ba), std::end(ba));
H h;
diff --git a/test/std/containers/sequences/vector/contiguous.pass.cpp b/test/std/containers/sequences/vector/contiguous.pass.cpp
index 32f380778335..70084246eae9 100644
--- a/test/std/containers/sequences/vector/contiguous.pass.cpp
+++ b/test/std/containers/sequences/vector/contiguous.pass.cpp
@@ -40,7 +40,7 @@ int main()
test_contiguous(C(A(3)));
test_contiguous(C(7, 9.0, A(5)));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef double T;
typedef min_allocator<T> A;
diff --git a/test/std/containers/sequences/vector/iterators.pass.cpp b/test/std/containers/sequences/vector/iterators.pass.cpp
index 75a08287a863..8dc14977f282 100644
--- a/test/std/containers/sequences/vector/iterators.pass.cpp
+++ b/test/std/containers/sequences/vector/iterators.pass.cpp
@@ -77,7 +77,7 @@ int main()
C::iterator i;
C::const_iterator j;
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/vector/types.pass.cpp b/test/std/containers/sequences/vector/types.pass.cpp
index 0fbc7e38b1a2..2080ac09fc5a 100644
--- a/test/std/containers/sequences/vector/types.pass.cpp
+++ b/test/std/containers/sequences/vector/types.pass.cpp
@@ -45,6 +45,9 @@ test()
{
typedef std::vector<T, Allocator> C;
+// TODO: These tests should use allocator_traits to get stuff, rather than
+// blindly pulling typedefs out of the allocator. This is why we can't call
+// test<int, min_allocator<int>>() below.
static_assert((std::is_same<typename C::value_type, T>::value), "");
static_assert((std::is_same<typename C::value_type, typename Allocator::value_type>::value), "");
static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
@@ -54,6 +57,14 @@ test()
static_assert((std::is_same<typename C::const_reference, typename Allocator::const_reference>::value), "");
static_assert((std::is_same<typename C::pointer, typename Allocator::pointer>::value), "");
static_assert((std::is_same<typename C::const_pointer, typename Allocator::const_pointer>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+// static_assert((std::is_same<typename C::difference_type,
+// typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+// static_assert((std::is_same<typename C::difference_type,
+// typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+
static_assert((std::is_same<
typename std::iterator_traits<typename C::iterator>::iterator_category,
std::random_access_iterator_tag>::value), "");
@@ -75,12 +86,23 @@ int main()
test<Copyable, test_allocator<Copyable> >();
static_assert((std::is_same<std::vector<char>::allocator_type,
std::allocator<char> >::value), "");
-#if __cplusplus >= 201103L
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::value_type, int>::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::allocator_type, min_allocator<int> >::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::reference, int&>::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::const_reference, const int&>::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::pointer, min_pointer<int>>::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::const_pointer, min_pointer<const int>>::value), "");
+#if TEST_STD_VER >= 11
+ {
+
+ typedef std::vector<int, min_allocator<int> > C;
+ static_assert((std::is_same<C::value_type, int>::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<int> >::value), "");
+ static_assert((std::is_same<C::reference, int&>::value), "");
+ static_assert((std::is_same<C::const_reference, const int&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<int>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const int>>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+// static_assert((std::is_same<typename C::difference_type,
+// typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+// static_assert((std::is_same<typename C::difference_type,
+// typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+ }
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp
index 21082c839f56..a87b84061030 100644
--- a/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp
@@ -22,27 +22,27 @@ int main()
{
std::vector<int> v;
assert(v.capacity() == 0);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int> v(100);
assert(v.capacity() == 100);
v.push_back(0);
assert(v.capacity() > 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v;
assert(v.capacity() == 0);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, min_allocator<int>> v(100);
assert(v.capacity() == 100);
v.push_back(0);
assert(v.capacity() > 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
index 4df5702f2ad2..d04e43db508d 100644
--- a/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
@@ -23,7 +23,7 @@ int main()
std::vector<int> v;
v.reserve(10);
assert(v.capacity() >= 10);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int> v(100);
@@ -34,7 +34,7 @@ int main()
v.reserve(150);
assert(v.size() == 100);
assert(v.capacity() == 150);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, stack_allocator<int, 250> > v(100);
@@ -45,14 +45,14 @@ int main()
v.reserve(150);
assert(v.size() == 100);
assert(v.capacity() == 150);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v;
v.reserve(10);
assert(v.capacity() >= 10);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, min_allocator<int>> v(100);
@@ -63,7 +63,7 @@ int main()
v.reserve(150);
assert(v.size() == 100);
assert(v.capacity() == 150);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
index c7988d62060a..ce74cf9b7c23 100644
--- a/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
@@ -26,22 +26,22 @@ int main()
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<MoveOnly, stack_allocator<MoveOnly, 300> > v(100);
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
@@ -49,35 +49,35 @@ int main()
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, stack_allocator<int, 300> > v(100);
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<MoveOnly, min_allocator<MoveOnly>> v(100);
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
index de5126b03d10..3e7df312731f 100644
--- a/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
@@ -28,7 +28,7 @@ int main()
v.resize(200, 1);
assert(v.size() == 200);
assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
for (unsigned i = 0; i < 50; ++i)
assert(v[i] == 0);
for (unsigned i = 50; i < 200; ++i)
@@ -42,20 +42,20 @@ int main()
v.resize(200, 1);
assert(v.size() == 200);
assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v(100);
v.resize(50, 1);
assert(v.size() == 50);
assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert((v == std::vector<int, min_allocator<int>>(50)));
v.resize(200, 1);
assert(v.size() == 200);
assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
for (unsigned i = 0; i < 50; ++i)
assert(v[i] == 0);
for (unsigned i = 50; i < 200; ++i)
@@ -66,11 +66,11 @@ int main()
v.resize(50, 1);
assert(v.size() == 50);
assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.resize(200, 1);
assert(v.size() == 200);
assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
index 49ab9cc71deb..10ce33f43bd2 100644
--- a/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
@@ -22,41 +22,41 @@ int main()
{
std::vector<int> v(100);
v.push_back(1);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
assert(v.capacity() == 101);
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, stack_allocator<int, 401> > v(100);
v.push_back(1);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
assert(v.capacity() == 101);
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#ifndef _LIBCPP_NO_EXCEPTIONS
{
std::vector<int, stack_allocator<int, 400> > v(100);
v.push_back(1);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
- assert(v.capacity() == 200);
+ LIBCPP_ASSERT(v.capacity() == 200); // assumes libc++'s 2x growth factor
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v(100);
v.push_back(1);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
assert(v.capacity() == 101);
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp
index f3d9289c36eb..59529a6dfd36 100644
--- a/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp
@@ -22,29 +22,29 @@ int main()
{
std::vector<int> v1(100);
std::vector<int> v2(200);
- assert(is_contiguous_container_asan_correct(v1));
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v1));
+ assert(is_contiguous_container_asan_correct(v2));
v1.swap(v2);
assert(v1.size() == 200);
assert(v1.capacity() == 200);
- assert(is_contiguous_container_asan_correct(v1));
+ assert(is_contiguous_container_asan_correct(v1));
assert(v2.size() == 100);
assert(v2.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v1(100);
std::vector<int, min_allocator<int>> v2(200);
- assert(is_contiguous_container_asan_correct(v1));
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v1));
+ assert(is_contiguous_container_asan_correct(v2));
v1.swap(v2);
assert(v1.size() == 200);
assert(v1.capacity() == 200);
- assert(is_contiguous_container_asan_correct(v1));
+ assert(is_contiguous_container_asan_correct(v1));
assert(v2.size() == 100);
assert(v2.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v2));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp b/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp
index 6f02c3b7bc2b..d15d24dd969f 100644
--- a/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp
@@ -32,7 +32,7 @@ int main()
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<int>(5));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int> > l(3, 2, min_allocator<int>());
std::vector<int, min_allocator<int> > l2(l, min_allocator<int>());
diff --git a/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp
index 3cb0b3b095f0..222fa9c78f92 100644
--- a/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp
@@ -23,7 +23,7 @@ void test ( Vec &v )
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
v.assign({3, 4, 5, 6});
assert(v.size() == 4);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(v[0] == 3);
assert(v[1] == 4);
assert(v[2] == 5);
@@ -42,7 +42,7 @@ int main()
test(d2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::vector<int, min_allocator<int>> V;
V d1;
diff --git a/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp b/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp
index 8c8b0a04715b..acbee97bcd1c 100644
--- a/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp
@@ -29,72 +29,72 @@ int main()
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(5));
l2 = std::move(l);
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
{
std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(6));
l2 = std::move(l);
assert(l2 == lo);
assert(!l.empty());
assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
{
std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, other_allocator<MoveOnly> > l2(other_allocator<MoveOnly>(6));
l2 = std::move(l);
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
std::vector<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, min_allocator<MoveOnly> > l2(min_allocator<MoveOnly>{});
l2 = std::move(l);
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp b/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp
index e1b30bf11304..8e5d2766c775 100644
--- a/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp
@@ -26,7 +26,7 @@ void test ( Vec &v )
{
v.assign(5, 6);
assert(v.size() == 5);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(std::all_of(v.begin(), v.end(), is6));
}
@@ -41,7 +41,7 @@ int main()
test(d2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::vector<int, min_allocator<int>> V;
V d1;
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
index 5e87c07ef70a..e0542e751f44 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
@@ -32,16 +32,16 @@ test0()
static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
#endif
C c;
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == typename C::allocator_type());
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
#if TEST_STD_VER >= 11
C c1 = {};
- assert(c1.__invariants());
+ LIBCPP_ASSERT(c1.__invariants());
assert(c1.empty());
assert(c1.get_allocator() == typename C::allocator_type());
- assert(is_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c1));
#endif
}
@@ -55,10 +55,10 @@ test1(const typename C::allocator_type& a)
static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
#endif
C c(a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == a);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
}
int main()
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
index 36e231acce12..5542e91059d6 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../stack_allocator.h"
#include "min_allocator.h"
@@ -24,9 +25,9 @@ void
test(Iterator first, Iterator last)
{
C c(first, last);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last));
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}
@@ -46,7 +47,7 @@ int main()
test<std::vector<int, stack_allocator<int, 18> > >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
test<std::vector<int, stack_allocator<int, 18> > >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
test<std::vector<int, stack_allocator<int, 18> > >(a, an);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(input_iterator<const int*>(a), input_iterator<const int*>(an));
test<std::vector<int, min_allocator<int>> >(forward_iterator<const int*>(a), forward_iterator<const int*>(an));
test<std::vector<int, min_allocator<int>> >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
index 7fa748a90d71..f40088ea3e86 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -15,6 +15,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../stack_allocator.h"
#include "min_allocator.h"
@@ -25,19 +26,19 @@ void
test(Iterator first, Iterator last, const A& a)
{
C c(first, last, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last));
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
template <class T>
struct implicit_conv_allocator : min_allocator<T>
{
- implicit_conv_allocator(void* p) {}
+ implicit_conv_allocator(void*) {}
implicit_conv_allocator(const implicit_conv_allocator&) = default;
};
@@ -55,7 +56,7 @@ int main()
test<std::vector<int> >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an), alloc);
test<std::vector<int> >(a, an, alloc);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
int* an = a + sizeof(a)/sizeof(a[0]);
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
index e03389593f16..46e5ecdc9a56 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "DefaultOnly.h"
#include "min_allocator.h"
#include "test_allocator.h"
@@ -23,16 +24,14 @@ template <class C>
void
test2(typename C::size_type n, typename C::allocator_type const& a = typename C::allocator_type ())
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
C c(n, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == n);
assert(c.get_allocator() == a);
- assert(is_contiguous_container_asan_correct(c));
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type());
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}
@@ -41,14 +40,14 @@ void
test1(typename C::size_type n)
{
C c(n);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == n);
assert(c.get_allocator() == typename C::allocator_type());
- assert(is_contiguous_container_asan_correct(c));
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+#if TEST_STD_VER >= 11
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type());
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
template <class C>
@@ -64,7 +63,7 @@ int main()
test<std::vector<int> >(50);
test<std::vector<DefaultOnly> >(500);
assert(DefaultOnly::count == 0);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(50);
test<std::vector<DefaultOnly, min_allocator<DefaultOnly>> >(500);
test2<std::vector<DefaultOnly, test_allocator<DefaultOnly>> >( 100, test_allocator<DefaultOnly>(23));
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
index 5b6c49857044..d3774d1a6595 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "../../../stack_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -23,9 +24,9 @@ void
test(typename C::size_type n, const typename C::value_type& x)
{
C c(n, x);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == n);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == x);
}
@@ -34,7 +35,7 @@ int main()
{
test<std::vector<int> >(50, 3);
test<std::vector<int, stack_allocator<int, 50> > >(50, 5);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(50, 3);
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
index c62b84104aba..4713aa157062 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
@@ -13,6 +13,8 @@
#include <vector>
#include <cassert>
+
+#include "test_macros.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -22,10 +24,10 @@ test(typename C::size_type n, const typename C::value_type& x,
const typename C::allocator_type& a)
{
C c(n, x, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(a == c.get_allocator());
assert(c.size() == n);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == x);
}
@@ -33,7 +35,7 @@ test(typename C::size_type n, const typename C::value_type& x,
int main()
{
test<std::vector<int> >(50, 3, std::allocator<int>());
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(50, 3, min_allocator<int>());
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp b/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
index 677963deeb84..105217bbf15c 100644
--- a/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
@@ -13,6 +13,8 @@
#include <vector>
#include <cassert>
+
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -23,10 +25,10 @@ test(const C& x)
{
unsigned s = x.size();
C c(x);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
assert(c == x);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
}
int main()
@@ -39,26 +41,24 @@ int main()
{
std::vector<int, test_allocator<int> > v(3, 2, test_allocator<int>(5));
std::vector<int, test_allocator<int> > v2 = v;
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
assert(v2 == v);
assert(v2.get_allocator() == v.get_allocator());
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
std::vector<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
std::vector<int, other_allocator<int> > v2 = v;
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
assert(v2 == v);
assert(v2.get_allocator() == other_allocator<int>(-2));
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
{
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
int* an = a + sizeof(a)/sizeof(a[0]);
@@ -67,12 +67,12 @@ int main()
{
std::vector<int, min_allocator<int> > v(3, 2, min_allocator<int>());
std::vector<int, min_allocator<int> > v2 = v;
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
assert(v2 == v);
assert(v2.get_allocator() == v.get_allocator());
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
index 128328c2a7d2..47259c747332 100644
--- a/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
@@ -13,6 +13,8 @@
#include <vector>
#include <cassert>
+
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -23,10 +25,10 @@ test(const C& x, const typename C::allocator_type& a)
{
unsigned s = x.size();
C c(x, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
assert(c == x);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
}
int main()
@@ -48,7 +50,7 @@ int main()
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<int>(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
int* an = a + sizeof(a)/sizeof(a[0]);
diff --git a/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
index 60f7b72c9477..b244f75f21d4 100644
--- a/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <vector>
#include <cassert>
@@ -30,7 +32,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<MoveOnly> C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
@@ -47,5 +48,4 @@ int main()
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
index 0e2cae9ee935..bd538120442d 100644
--- a/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
@@ -11,14 +11,14 @@
// ~vector() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <vector>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_alloc
{
@@ -27,11 +27,8 @@ struct some_alloc
~some_alloc() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -48,5 +45,4 @@ int main()
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp
index 7eb834ff3877..408bcc3b1499 100644
--- a/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp
@@ -22,17 +22,17 @@ int main()
{
std::vector<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
- assert(is_contiguous_container_asan_correct(d));
+ assert(is_contiguous_container_asan_correct(d));
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> d = {3, 4, 5, 6};
assert(d.size() == 4);
- assert(is_contiguous_container_asan_correct(d));
+ assert(is_contiguous_container_asan_correct(d));
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
diff --git a/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp
index 5d7ae884e382..f4c3b5c1e8e0 100644
--- a/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp
@@ -25,18 +25,18 @@ int main()
std::vector<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
- assert(is_contiguous_container_asan_correct(d));
+ assert(is_contiguous_container_asan_correct(d));
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
assert(d.get_allocator() == min_allocator<int>());
assert(d.size() == 4);
- assert(is_contiguous_container_asan_correct(d));
+ assert(is_contiguous_container_asan_correct(d));
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
diff --git a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
index fb419d825d2b..d51b364f3ba0 100644
--- a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
@@ -24,79 +24,79 @@ int main()
{
std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, test_allocator<MoveOnly> > l2 = std::move(l);
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
{
std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, other_allocator<MoveOnly> > l2 = std::move(l);
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
{
int a1[] = {1, 3, 7, 9, 10};
std::vector<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c1));
std::vector<int>::const_iterator i = c1.begin();
std::vector<int> c2 = std::move(c1);
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c2));
std::vector<int>::iterator j = c2.erase(i);
assert(*j == 3);
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
std::vector<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, min_allocator<MoveOnly> > l2 = std::move(l);
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
{
int a1[] = {1, 3, 7, 9, 10};
std::vector<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c1));
std::vector<int, min_allocator<int>>::const_iterator i = c1.begin();
std::vector<int, min_allocator<int>> c2 = std::move(c1);
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c2));
std::vector<int, min_allocator<int>>::iterator j = c2.erase(i);
assert(*j == 3);
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c2));
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp
index aef96917cb32..fcdd35ae1157 100644
--- a/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp
@@ -24,75 +24,75 @@ int main()
{
std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(6));
assert(l2 == lo);
assert(!l.empty());
assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
{
std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(5));
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == test_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
{
std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, other_allocator<MoveOnly> > l2(std::move(l), other_allocator<MoveOnly>(4));
assert(l2 == lo);
assert(!l.empty());
assert(l2.get_allocator() == other_allocator<MoveOnly>(4));
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
std::vector<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, min_allocator<MoveOnly> > l2(std::move(l), min_allocator<MoveOnly>());
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == min_allocator<MoveOnly>());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l2));
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
index c09224497966..14ca7155b5a1 100644
--- a/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
@@ -16,6 +16,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <vector>
#include <cassert>
@@ -33,7 +35,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -46,7 +48,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -58,7 +60,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -91,6 +92,4 @@ int main()
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
index b7bbfaa421c4..a1e3a632f1f2 100644
--- a/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
@@ -14,6 +14,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <vector>
#include <cassert>
@@ -29,7 +31,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -51,5 +52,4 @@ int main()
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
#endif
}
-#endif
}
diff --git a/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp
index 592b71462767..4e5a20413683 100644
--- a/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp
@@ -24,18 +24,18 @@ int main()
std::vector<int> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
- assert(is_contiguous_container_asan_correct(d));
+ assert(is_contiguous_container_asan_correct(d));
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
- assert(is_contiguous_container_asan_correct(d));
+ assert(is_contiguous_container_asan_correct(d));
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
diff --git a/test/std/containers/sequences/vector/vector.data/data.pass.cpp b/test/std/containers/sequences/vector/vector.data/data.pass.cpp
index aed56bc09310..f6c0575d958c 100644
--- a/test/std/containers/sequences/vector/vector.data/data.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.data/data.pass.cpp
@@ -17,28 +17,47 @@
#include "min_allocator.h"
#include "asan_testing.h"
+struct Nasty {
+ Nasty() : i_(0) {}
+ Nasty(int i) : i_(i) {}
+ ~Nasty() {}
+
+ Nasty * operator&() const { assert(false); return nullptr; }
+ int i_;
+ };
+
int main()
{
{
std::vector<int> v;
assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int> v(100);
- assert(v.data() == &v.front());
- assert(is_contiguous_container_asan_correct(v));
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<Nasty> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v;
assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, min_allocator<int>> v(100);
- assert(v.data() == &v.front());
- assert(is_contiguous_container_asan_correct(v));
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<Nasty, min_allocator<Nasty>> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp b/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
index cb6062694e40..c97ad29708b8 100644
--- a/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
@@ -17,28 +17,47 @@
#include "min_allocator.h"
#include "asan_testing.h"
+struct Nasty {
+ Nasty() : i_(0) {}
+ Nasty(int i) : i_(i) {}
+ ~Nasty() {}
+
+ Nasty * operator&() const { assert(false); return nullptr; }
+ int i_;
+ };
+
int main()
{
{
const std::vector<int> v;
assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
const std::vector<int> v(100);
- assert(v.data() == &v.front());
- assert(is_contiguous_container_asan_correct(v));
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<Nasty> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
const std::vector<int, min_allocator<int>> v;
assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
const std::vector<int, min_allocator<int>> v(100);
assert(v.data() == &v.front());
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<Nasty, min_allocator<Nasty>> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
index 8af6bdacd0a8..8bcc23979668 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
@@ -67,7 +67,7 @@ int main()
assert(c.size() == 1);
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
i = c.emplace(c.cend(), 3, 4.5);
assert(i == c.end()-1);
assert(c.size() == 2);
@@ -75,7 +75,7 @@ int main()
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
i = c.emplace(c.cbegin()+1, 4, 6.5);
assert(i == c.begin()+1);
assert(c.size() == 3);
@@ -85,7 +85,7 @@ int main()
assert(c[1].getd() == 6.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
}
{
std::vector<A, stack_allocator<A, 7> > c;
@@ -94,7 +94,7 @@ int main()
assert(c.size() == 1);
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
i = c.emplace(c.cend(), 3, 4.5);
assert(i == c.end()-1);
assert(c.size() == 2);
@@ -102,7 +102,7 @@ int main()
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
i = c.emplace(c.cbegin()+1, 4, 6.5);
assert(i == c.begin()+1);
assert(c.size() == 3);
@@ -112,7 +112,7 @@ int main()
assert(c[1].getd() == 6.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
}
#if _LIBCPP_DEBUG >= 1
{
@@ -122,7 +122,7 @@ int main()
assert(false);
}
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<A, min_allocator<A>> c;
std::vector<A, min_allocator<A>>::iterator i = c.emplace(c.cbegin(), 2, 3.5);
diff --git a/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
index bbf91a4255d7..61ccade76b02 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
@@ -15,6 +15,7 @@
#include <cassert>
#include "../../../stack_allocator.h"
#include "min_allocator.h"
+#include "test_allocator.h"
#include "asan_testing.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -62,14 +63,14 @@ int main()
assert(c.size() == 1);
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
c.emplace_back(3, 4.5);
assert(c.size() == 2);
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
}
{
std::vector<A, stack_allocator<A, 4> > c;
@@ -77,30 +78,38 @@ int main()
assert(c.size() == 1);
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
c.emplace_back(3, 4.5);
assert(c.size() == 2);
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<A, min_allocator<A>> c;
c.emplace_back(2, 3.5);
assert(c.size() == 1);
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
c.emplace_back(3, 4.5);
assert(c.size() == 2);
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
+ }
+ {
+ std::vector<Tag_X, TaggingAllocator<Tag_X>> c;
+ c.emplace_back();
+ assert(c.size() == 1);
+ c.emplace_back(1, 2, 3);
+ assert(c.size() == 2);
+ assert(is_contiguous_container_asan_correct(c));
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp
index 85a47073bcb2..7e4aed8c1b5e 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp
@@ -23,39 +23,39 @@ int main()
{
std::vector<int> v;
v.reserve(3);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v = { 1, 2, 3 };
v.emplace(v.begin(), v.back());
assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int> v;
v.reserve(4);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v = { 1, 2, 3 };
v.emplace(v.begin(), v.back());
assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v;
v.reserve(3);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v = { 1, 2, 3 };
v.emplace(v.begin(), v.back());
assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, min_allocator<int>> v;
v.reserve(4);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
v = { 1, 2, 3 };
v.emplace(v.begin(), v.back());
assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
index 4fa07b729a75..dbdccf13b72e 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
@@ -24,7 +24,7 @@ int main()
int a1[] = {1, 2, 3};
std::vector<int> l1(a1, a1+3);
std::vector<int>::const_iterator i = l1.begin();
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
++i;
std::vector<int>::iterator j = l1.erase(i);
assert(l1.size() == 2);
@@ -32,25 +32,25 @@ int main()
assert(*j == 3);
assert(*l1.begin() == 1);
assert(*next(l1.begin()) == 3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
j = l1.erase(j);
assert(j == l1.end());
assert(l1.size() == 1);
assert(distance(l1.begin(), l1.end()) == 1);
assert(*l1.begin() == 1);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
j = l1.erase(l1.begin());
assert(j == l1.end());
assert(l1.size() == 0);
assert(distance(l1.begin(), l1.end()) == 0);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3};
std::vector<int, min_allocator<int>> l1(a1, a1+3);
std::vector<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
++i;
std::vector<int, min_allocator<int>>::iterator j = l1.erase(i);
assert(l1.size() == 2);
@@ -58,18 +58,18 @@ int main()
assert(*j == 3);
assert(*l1.begin() == 1);
assert(*next(l1.begin()) == 3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
j = l1.erase(j);
assert(j == l1.end());
assert(l1.size() == 1);
assert(distance(l1.begin(), l1.end()) == 1);
assert(*l1.begin() == 1);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
j = l1.erase(l1.begin());
assert(j == l1.end());
assert(l1.size() == 0);
assert(distance(l1.begin(), l1.end()) == 0);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db1.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db1.pass.cpp
index 0478d24c79f6..b2c22d6ae696 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db1.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db1.pass.cpp
@@ -31,7 +31,7 @@ int main()
l1.erase(i);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3};
std::vector<int, min_allocator<int>> l1(a1, a1+3);
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db2.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db2.pass.cpp
index c394f197402b..da0b6d4a059b 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db2.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db2.pass.cpp
@@ -32,7 +32,7 @@ int main()
l1.erase(i);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3};
std::vector<int, min_allocator<int>> l1(a1, a1+3);
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp
index 2e81d133cde0..f7fa0dba27e8 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp
@@ -23,106 +23,106 @@ int main()
int a1[] = {1, 2, 3};
{
std::vector<int> l1(a1, a1+3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
std::vector<int>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
assert(l1.size() == 3);
assert(distance(l1.cbegin(), l1.cend()) == 3);
assert(i == l1.begin());
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
{
std::vector<int> l1(a1, a1+3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
std::vector<int>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin()));
assert(l1.size() == 2);
assert(distance(l1.cbegin(), l1.cend()) == 2);
assert(i == l1.begin());
assert(l1 == std::vector<int>(a1+1, a1+3));
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
{
std::vector<int> l1(a1, a1+3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
std::vector<int>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 2));
assert(l1.size() == 1);
assert(distance(l1.cbegin(), l1.cend()) == 1);
assert(i == l1.begin());
assert(l1 == std::vector<int>(a1+2, a1+3));
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
{
std::vector<int> l1(a1, a1+3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
std::vector<int>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 3));
assert(l1.size() == 0);
assert(distance(l1.cbegin(), l1.cend()) == 0);
assert(i == l1.begin());
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
{
std::vector<std::vector<int> > outer(2, std::vector<int>(1));
- assert(is_contiguous_container_asan_correct(outer));
- assert(is_contiguous_container_asan_correct(outer[0]));
- assert(is_contiguous_container_asan_correct(outer[1]));
+ assert(is_contiguous_container_asan_correct(outer));
+ assert(is_contiguous_container_asan_correct(outer[0]));
+ assert(is_contiguous_container_asan_correct(outer[1]));
outer.erase(outer.begin(), outer.begin());
assert(outer.size() == 2);
assert(outer[0].size() == 1);
assert(outer[1].size() == 1);
- assert(is_contiguous_container_asan_correct(outer));
- assert(is_contiguous_container_asan_correct(outer[0]));
- assert(is_contiguous_container_asan_correct(outer[1]));
+ assert(is_contiguous_container_asan_correct(outer));
+ assert(is_contiguous_container_asan_correct(outer[0]));
+ assert(is_contiguous_container_asan_correct(outer[1]));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> l1(a1, a1+3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
std::vector<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
assert(l1.size() == 3);
assert(distance(l1.cbegin(), l1.cend()) == 3);
assert(i == l1.begin());
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
{
std::vector<int, min_allocator<int>> l1(a1, a1+3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
std::vector<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin()));
assert(l1.size() == 2);
assert(distance(l1.cbegin(), l1.cend()) == 2);
assert(i == l1.begin());
assert((l1 == std::vector<int, min_allocator<int>>(a1+1, a1+3)));
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
{
std::vector<int, min_allocator<int>> l1(a1, a1+3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
std::vector<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 2));
assert(l1.size() == 1);
assert(distance(l1.cbegin(), l1.cend()) == 1);
assert(i == l1.begin());
assert((l1 == std::vector<int, min_allocator<int>>(a1+2, a1+3)));
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
{
std::vector<int, min_allocator<int>> l1(a1, a1+3);
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
std::vector<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 3));
assert(l1.size() == 0);
assert(distance(l1.cbegin(), l1.cend()) == 0);
assert(i == l1.begin());
- assert(is_contiguous_container_asan_correct(l1));
+ assert(is_contiguous_container_asan_correct(l1));
}
{
std::vector<std::vector<int, min_allocator<int>>, min_allocator<std::vector<int, min_allocator<int>>>> outer(2, std::vector<int, min_allocator<int>>(1));
- assert(is_contiguous_container_asan_correct(outer));
- assert(is_contiguous_container_asan_correct(outer[0]));
- assert(is_contiguous_container_asan_correct(outer[1]));
+ assert(is_contiguous_container_asan_correct(outer));
+ assert(is_contiguous_container_asan_correct(outer[0]));
+ assert(is_contiguous_container_asan_correct(outer[1]));
outer.erase(outer.begin(), outer.begin());
assert(outer.size() == 2);
assert(outer[0].size() == 1);
assert(outer[1].size() == 1);
- assert(is_contiguous_container_asan_correct(outer));
- assert(is_contiguous_container_asan_correct(outer[0]));
- assert(is_contiguous_container_asan_correct(outer[1]));
+ assert(is_contiguous_container_asan_correct(outer));
+ assert(is_contiguous_container_asan_correct(outer[0]));
+ assert(is_contiguous_container_asan_correct(outer[1]));
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db1.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db1.pass.cpp
index af6d0f757892..14d3ca803ca3 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db1.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db1.pass.cpp
@@ -31,7 +31,7 @@ int main()
std::vector<int>::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3};
std::vector<int, min_allocator<int>> l1(a1, a1+3);
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db2.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db2.pass.cpp
index eee2c66c5c8c..04c040a8f797 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db2.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db2.pass.cpp
@@ -31,7 +31,7 @@ int main()
std::vector<int>::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3};
std::vector<int, min_allocator<int>> l1(a1, a1+3);
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db3.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db3.pass.cpp
index 505067d05a1a..ba183a83f0b1 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db3.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db3.pass.cpp
@@ -31,7 +31,7 @@ int main()
std::vector<int>::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3};
std::vector<int, min_allocator<int>> l1(a1, a1+3);
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db4.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db4.pass.cpp
index c7e4131cb49c..0fb8071fc679 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db4.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db4.pass.cpp
@@ -30,7 +30,7 @@ int main()
std::vector<int>::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin());
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 2, 3};
std::vector<int, min_allocator<int>> l1(a1, a1+3);
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp
index 30b801788013..b0fe123aac48 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp
@@ -24,7 +24,7 @@ int main()
std::vector<int> d(10, 1);
std::vector<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
assert(d.size() == 14);
- assert(is_contiguous_container_asan_correct(d));
+ assert(is_contiguous_container_asan_correct(d));
assert(i == d.begin() + 2);
assert(d[0] == 1);
assert(d[1] == 1);
@@ -41,12 +41,12 @@ int main()
assert(d[12] == 1);
assert(d[13] == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> d(10, 1);
std::vector<int, min_allocator<int>>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
assert(d.size() == 14);
- assert(is_contiguous_container_asan_correct(d));
+ assert(is_contiguous_container_asan_correct(d));
assert(i == d.begin() + 2);
assert(d[0] == 1);
assert(d[1] == 1);
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
index 782437be87f8..b8953021187f 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
@@ -32,7 +32,7 @@ int main()
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
input_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -49,7 +49,7 @@ int main()
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
forward_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -102,7 +102,7 @@ int main()
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
input_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -119,7 +119,7 @@ int main()
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
forward_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -140,7 +140,7 @@ int main()
assert(false);
}
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v(100);
int a[] = {1, 2, 3, 4, 5};
@@ -148,7 +148,7 @@ int main()
std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
input_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -165,7 +165,7 @@ int main()
std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
forward_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
index e12ec45febfc..e1ad6be054e5 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
@@ -29,7 +29,7 @@ int main()
std::vector<MoveOnly> v(100);
std::vector<MoveOnly>::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -42,7 +42,7 @@ int main()
std::vector<MoveOnly, stack_allocator<MoveOnly, 300> > v(100);
std::vector<MoveOnly, stack_allocator<MoveOnly, 300> >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -59,12 +59,12 @@ int main()
assert(false);
}
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<MoveOnly, min_allocator<MoveOnly>> v(100);
std::vector<MoveOnly, min_allocator<MoveOnly>>::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
index 6997284f258c..ed4d6c976e9c 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
@@ -27,7 +27,7 @@ int main()
std::vector<int> v(100);
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == 105);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -43,7 +43,7 @@ int main()
size_t sz = v.size();
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == sz + 5);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -59,7 +59,7 @@ int main()
size_t sz = v.size();
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == sz + 5);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -73,7 +73,7 @@ int main()
std::vector<int, stack_allocator<int, 300> > v(100);
std::vector<int, stack_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == 105);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -91,12 +91,12 @@ int main()
assert(false);
}
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v(100);
std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == 105);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -110,7 +110,7 @@ int main()
std::vector<int, min_allocator<int>> v(100);
std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == 105);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
index 782e752157a7..ba030e9e3fb7 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
@@ -27,7 +27,7 @@ int main()
std::vector<int> v(100);
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -42,7 +42,7 @@ int main()
size_t sz = v.size();
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == sz + 1);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -58,7 +58,7 @@ int main()
size_t sz = v.size();
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == sz + 1);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -71,7 +71,7 @@ int main()
std::vector<int, stack_allocator<int, 300> > v(100);
std::vector<int, stack_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
@@ -89,12 +89,12 @@ int main()
assert(false);
}
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v(100);
std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
int j;
for (j = 0; j < 10; ++j)
diff --git a/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
index 62fa60103baa..c81e41904fc8 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
@@ -37,9 +37,9 @@ int main()
#if _LIBCPP_DEBUG >= 1
c.pop_back();
assert(false);
-#endif
+#endif
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> c;
c.push_back(1);
@@ -49,7 +49,7 @@ int main()
#if _LIBCPP_DEBUG >= 1
c.pop_back();
assert(false);
-#endif
+#endif
}
-#endif
+#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
index eeeba6242d93..bef3b9c8d17d 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
@@ -23,27 +23,27 @@ int main()
std::vector<int> c;
c.push_back(0);
assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(1);
assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(2);
assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(3);
assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(4);
assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
}
@@ -51,56 +51,56 @@ int main()
std::vector<int, stack_allocator<int, 15> > c;
c.push_back(0);
assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(1);
assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(2);
assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(3);
assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(4);
assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> c;
c.push_back(0);
assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(1);
assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(2);
assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(3);
assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
c.push_back(4);
assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == j);
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
index 785225357d4b..5fa93aab89c7 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
@@ -31,7 +31,7 @@ class CMyClass {
private:
int fMagicValue;
int fTag;
-
+
private: static int kStartedConstructionMagicValue;
private: static int kFinishedConstructionMagicValue;
};
@@ -73,8 +73,8 @@ int main()
vec.push_back(instance);
std::vector<CMyClass> vec2(vec);
- assert(is_contiguous_container_asan_correct(vec));
- assert(is_contiguous_container_asan_correct(vec2));
+ assert(is_contiguous_container_asan_correct(vec));
+ assert(is_contiguous_container_asan_correct(vec2));
gCopyConstructorShouldThow = true;
try {
@@ -82,6 +82,6 @@ int main()
}
catch (...) {
assert(vec==vec2);
- assert(is_contiguous_container_asan_correct(vec));
+ assert(is_contiguous_container_asan_correct(vec));
}
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
index b143cd773b42..64762eb374e8 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
@@ -25,27 +25,27 @@ int main()
std::vector<MoveOnly> c;
c.push_back(MoveOnly(0));
assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(1));
assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(2));
assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(3));
assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(4));
assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
}
@@ -53,56 +53,56 @@ int main()
std::vector<MoveOnly, stack_allocator<MoveOnly, 15> > c;
c.push_back(MoveOnly(0));
assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(1));
assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(2));
assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(3));
assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(4));
assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::vector<MoveOnly, min_allocator<MoveOnly>> c;
c.push_back(MoveOnly(0));
assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(1));
assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(2));
assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(3));
assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(4));
assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
for (int j = 0; j < c.size(); ++j)
assert(c[j] == MoveOnly(j));
}
diff --git a/test/std/containers/sequences/vector/vector.special/db_swap_1.pass.cpp b/test/std/containers/sequences/vector/vector.special/db_swap_1.pass.cpp
index e7f6a0011e1a..1bb761181422 100644
--- a/test/std/containers/sequences/vector/vector.special/db_swap_1.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.special/db_swap_1.pass.cpp
@@ -37,7 +37,7 @@ int main()
c1.erase(i1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
diff --git a/test/std/containers/sequences/vector/vector.special/swap.pass.cpp b/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
index 96aaf7131f53..3d01129fa008 100644
--- a/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
@@ -26,56 +26,56 @@ int main()
int a2[] = {0, 2, 4, 5, 6, 8, 11};
std::vector<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
std::vector<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert(c1 == std::vector<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
assert(c2 == std::vector<int>(a1, a1+sizeof(a1)/sizeof(a1[0])));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
std::vector<int> c1(a1, a1);
std::vector<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert(c1 == std::vector<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
std::vector<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
std::vector<int> c2(a2, a2);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert(c1.empty());
assert(distance(c1.begin(), c1.end()) == 0);
assert(c2 == std::vector<int>(a1, a1+sizeof(a1)/sizeof(a1[0])));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
std::vector<int> c1(a1, a1);
std::vector<int> c2(a2, a2);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert(c1.empty());
assert(distance(c1.begin(), c1.end()) == 0);
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
#ifndef _LIBCPP_DEBUG_LEVEL
// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
@@ -98,72 +98,72 @@ int main()
typedef other_allocator<int> A;
std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert((c1 == std::vector<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
assert(c1.get_allocator() == A(2));
assert((c2 == std::vector<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
assert(c2.get_allocator() == A(1));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
std::vector<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
std::vector<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert((c1 == std::vector<int, min_allocator<int>>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
assert((c2 == std::vector<int, min_allocator<int>>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
std::vector<int, min_allocator<int>> c1(a1, a1);
std::vector<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert((c1 == std::vector<int, min_allocator<int>>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
std::vector<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
std::vector<int, min_allocator<int>> c2(a2, a2);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert(c1.empty());
assert(distance(c1.begin(), c1.end()) == 0);
assert((c2 == std::vector<int, min_allocator<int>>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
std::vector<int, min_allocator<int>> c1(a1, a1);
std::vector<int, min_allocator<int>> c2(a2, a2);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert(c1.empty());
assert(distance(c1.begin(), c1.end()) == 0);
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
#ifndef _LIBCPP_DEBUG_LEVEL
// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
@@ -173,15 +173,15 @@ int main()
typedef min_allocator<int> A;
std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A());
std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A());
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
swap(c1, c2);
assert((c1 == std::vector<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
assert(c1.get_allocator() == A());
assert((c2 == std::vector<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
assert(c2.get_allocator() == A());
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
}
#endif
#endif
diff --git a/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
index 1d00ff387480..89fa301ad9bd 100644
--- a/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <vector>
// void swap(vector& c)
@@ -22,6 +24,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -29,7 +32,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -41,7 +44,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -52,7 +55,6 @@ struct some_alloc2
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::vector<MoveOnly> C;
C c1, c2;
@@ -86,6 +88,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/set_allocator_requirement_test_templates.h b/test/std/containers/set_allocator_requirement_test_templates.h
new file mode 100644
index 000000000000..2e3346f47e2d
--- /dev/null
+++ b/test/std/containers/set_allocator_requirement_test_templates.h
@@ -0,0 +1,354 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef SET_ALLOCATOR_REQUIREMENT_TEST_TEMPLATES_H
+#define SET_ALLOCATOR_REQUIREMENT_TEST_TEMPLATES_H
+
+// <set>
+// <unordered_set>
+
+// class set
+// class unordered_set
+
+// insert(...);
+// emplace(...);
+// emplace_hint(...);
+
+
+#include <cassert>
+
+#include "test_macros.h"
+#include "count_new.hpp"
+#include "container_test_types.h"
+#include "assert_checkpoint.h"
+
+
+template <class Container>
+void testSetInsert()
+{
+ typedef typename Container::value_type ValueTp;
+ typedef Container C;
+ typedef std::pair<typename C::iterator, bool> R;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::insert(const value_type&)");
+ Container c;
+ const ValueTp v(42);
+ cc->expect<const ValueTp&>();
+ assert(c.insert(v).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42);
+ assert(c.insert(v2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(value_type&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<const ValueTp&>();
+ assert(c.insert(v).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42);
+ assert(c.insert(v2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(value_type&&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<ValueTp&&>();
+ assert(c.insert(std::move(v)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42);
+ assert(c.insert(std::move(v2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(const value_type&&)");
+ Container c;
+ const ValueTp v(42);
+ cc->expect<const ValueTp&>();
+ assert(c.insert(std::move(v)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42);
+ assert(c.insert(std::move(v2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(std::initializer_list<ValueTp>)");
+ Container c;
+ std::initializer_list<ValueTp> il = { ValueTp(1), ValueTp(2) };
+ cc->expect<ValueTp const&>(2);
+ c.insert(il);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ c.insert(il);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type const&");
+ Container c;
+ const ValueTp ValueList[] = { ValueTp(1), ValueTp(2), ValueTp(3) };
+ cc->expect<ValueTp const&>(3);
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type&&");
+ Container c;
+ ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ cc->expect<ValueTp&&>(3);
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)),
+ std::move_iterator<ValueTp*>(std::end(ValueList)));
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp ValueList2[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList2)),
+ std::move_iterator<ValueTp*>(std::end(ValueList2)));
+ }
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type&");
+ Container c;
+ ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ cc->expect<ValueTp const&>(3);
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ }
+ }
+}
+
+
+template <class Container>
+void testSetEmplace()
+{
+ typedef typename Container::value_type ValueTp;
+ typedef Container C;
+ typedef std::pair<typename C::iterator, bool> R;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::emplace(const value_type&)");
+ Container c;
+ const ValueTp v(42);
+ cc->expect<const ValueTp&>();
+ assert(c.emplace(v).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42);
+ assert(c.emplace(v2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(value_type&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<ValueTp&>();
+ assert(c.emplace(v).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42);
+ assert(c.emplace(v2).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(value_type&&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<ValueTp&&>();
+ assert(c.emplace(std::move(v)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42);
+ assert(c.emplace(std::move(v2)).second == false);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace(const value_type&&)");
+ Container c;
+ const ValueTp v(42);
+ cc->expect<const ValueTp&&>();
+ assert(c.emplace(std::move(v)).second);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42);
+ assert(c.emplace(std::move(v2)).second == false);
+ }
+ }
+}
+
+
+template <class Container>
+void testSetEmplaceHint()
+{
+ typedef typename Container::value_type ValueTp;
+
+ typedef Container C;
+ typedef typename C::iterator It;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, const value_type&)");
+ Container c;
+ const ValueTp v(42);
+ cc->expect<const ValueTp&>();
+ It ret = c.emplace_hint(c.end(), v);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42);
+ It ret2 = c.emplace_hint(c.begin(), v2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, value_type&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<ValueTp&>();
+ It ret = c.emplace_hint(c.end(), v);
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42);
+ It ret2 = c.emplace_hint(c.begin(), v2);
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, value_type&&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<ValueTp&&>();
+ It ret = c.emplace_hint(c.end(), std::move(v));
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ ValueTp v2(42);
+ It ret2 = c.emplace_hint(c.begin(), std::move(v2));
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+ {
+ CHECKPOINT("Testing C::emplace_hint(p, const value_type&&)");
+ Container c;
+ const ValueTp v(42);
+ cc->expect<const ValueTp&&>();
+ It ret = c.emplace_hint(c.end(), std::move(v));
+ assert(ret != c.end());
+ assert(c.size() == 1);
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ const ValueTp v2(42);
+ It ret2 = c.emplace_hint(c.begin(), std::move(v2));
+ assert(&(*ret2) == &(*ret));
+ assert(c.size() == 1);
+ }
+ }
+}
+
+
+template <class Container>
+void testMultisetInsert()
+{
+ typedef typename Container::value_type ValueTp;
+ typedef Container C;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::insert(const value_type&)");
+ Container c;
+ const ValueTp v(42);
+ cc->expect<const ValueTp&>();
+ c.insert(v);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(value_type&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<const ValueTp&>();
+ c.insert(v);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(value_type&&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<ValueTp&&>();
+ c.insert(std::move(v));
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(std::initializer_list<ValueTp>)");
+ Container c;
+ std::initializer_list<ValueTp> il = { ValueTp(1), ValueTp(2) };
+ cc->expect<ValueTp const&>(2);
+ c.insert(il);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type const&");
+ Container c;
+ const ValueTp ValueList[] = { ValueTp(1), ValueTp(2), ValueTp(3) };
+ cc->expect<ValueTp const&>(3);
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type&&");
+ Container c;
+ ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ cc->expect<ValueTp&&>(3);
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)),
+ std::move_iterator<ValueTp*>(std::end(ValueList)));
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type&");
+ Container c;
+ ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ cc->expect<ValueTp&>(3);
+ c.insert(std::begin(ValueList), std::end(ValueList));
+ assert(!cc->unchecked());
+ }
+}
+
+#endif
diff --git a/test/std/containers/unord/iterator_difference_type.pass.cpp b/test/std/containers/unord/iterator_difference_type.pass.cpp
new file mode 100644
index 000000000000..35bcc27944db
--- /dev/null
+++ b/test/std/containers/unord/iterator_difference_type.pass.cpp
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <unordered_map>
+#include <unordered_set>
+#include <type_traits>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+#include "test_allocator.h"
+
+
+template <class Map, class ValueTp, class PtrT, class CPtrT>
+void testUnorderedMap() {
+ typedef typename Map::difference_type Diff;
+ {
+ typedef typename Map::iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp&>::value), "");
+ static_assert((std::is_same<typename It::pointer, PtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+ }
+ {
+ typedef typename Map::const_iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
+ static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+ }
+ {
+ typedef typename Map::local_iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp&>::value), "");
+ static_assert((std::is_same<typename It::pointer, PtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+ }
+ {
+ typedef typename Map::const_local_iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
+ static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+ }
+}
+
+
+template <class Set, class ValueTp, class CPtrT>
+void testUnorderedSet() {
+ static_assert((std::is_same<typename Set::iterator,
+ typename Set::const_iterator>::value), "");
+ static_assert((std::is_same<typename Set::local_iterator,
+ typename Set::const_local_iterator>::value), "");
+ typedef typename Set::difference_type Diff;
+ {
+ typedef typename Set::iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
+ static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+
+ }
+ {
+ typedef typename Set::local_iterator It;
+ static_assert((std::is_same<typename It::value_type, ValueTp>::value), "");
+ static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
+ static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
+ static_assert((std::is_same<typename It::difference_type, Diff>::value), "");
+ }
+}
+
+int main() {
+ {
+ typedef std::unordered_map<int, int> Map;
+ typedef std::pair<const int, int> ValueTp;
+ testUnorderedMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, Alloc> Map;
+ testUnorderedMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, Alloc> Map;
+ testUnorderedMap<Map, ValueTp, min_pointer<ValueTp>, min_pointer<const ValueTp>>();
+ }
+#endif
+ {
+ typedef std::unordered_multimap<int, int> Map;
+ typedef std::pair<const int, int> ValueTp;
+ testUnorderedMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, Alloc> Map;
+ testUnorderedMap<Map, ValueTp, ValueTp*, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<const int, int> ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, Alloc> Map;
+ testUnorderedMap<Map, ValueTp, min_pointer<ValueTp>, min_pointer<const ValueTp>>();
+ }
+#endif
+ {
+ typedef int ValueTp;
+ typedef std::unordered_set<ValueTp> Set;
+ testUnorderedSet<Set, ValueTp, ValueTp const*>();
+ }
+ {
+ typedef int ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::unordered_set<ValueTp, std::hash<ValueTp>, std::equal_to<ValueTp>, Alloc> Set;
+ testUnorderedSet<Set, ValueTp, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef int ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::unordered_set<ValueTp, std::hash<ValueTp>, std::equal_to<ValueTp>, Alloc> Set;
+ testUnorderedSet<Set, ValueTp, min_pointer<const ValueTp>>();
+ }
+#endif
+ {
+ typedef int ValueTp;
+ typedef std::unordered_multiset<ValueTp> Set;
+ testUnorderedSet<Set, ValueTp, ValueTp const*>();
+ }
+ {
+ typedef int ValueTp;
+ typedef test_allocator<ValueTp> Alloc;
+ typedef std::unordered_multiset<ValueTp, std::hash<ValueTp>, std::equal_to<ValueTp>, Alloc> Set;
+ testUnorderedSet<Set, ValueTp, ValueTp const*>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef int ValueTp;
+ typedef min_allocator<ValueTp> Alloc;
+ typedef std::unordered_multiset<ValueTp, std::hash<ValueTp>, std::equal_to<ValueTp>, Alloc> Set;
+ testUnorderedSet<Set, ValueTp, min_pointer<const ValueTp>>();
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.map/bucket.pass.cpp b/test/std/containers/unord/unord.map/bucket.pass.cpp
index 6837294e35bc..1abb58070afd 100644
--- a/test/std/containers/unord/unord.map/bucket.pass.cpp
+++ b/test/std/containers/unord/unord.map/bucket.pass.cpp
@@ -45,7 +45,7 @@ int main()
for (size_t i = 0; i < 13; ++i)
assert(c.bucket(i) == i % bc);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/bucket_size.pass.cpp b/test/std/containers/unord/unord.map/bucket_size.pass.cpp
index f3ab8fff4e43..4344508b7334 100644
--- a/test/std/containers/unord/unord.map/bucket_size.pass.cpp
+++ b/test/std/containers/unord/unord.map/bucket_size.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(c.bucket_size(3) == 1);
assert(c.bucket_size(4) == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/count.pass.cpp b/test/std/containers/unord/unord.map/count.pass.cpp
index 50abb53464ec..68661b56de1c 100644
--- a/test/std/containers/unord/unord.map/count.pass.cpp
+++ b/test/std/containers/unord/unord.map/count.pass.cpp
@@ -41,7 +41,7 @@ int main()
assert(c.count(30) == 1);
assert(c.count(5) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/eq.pass.cpp b/test/std/containers/unord/unord.map/eq.pass.cpp
index 9258378eb09a..5dcea6a73f28 100644
--- a/test/std/containers/unord/unord.map/eq.pass.cpp
+++ b/test/std/containers/unord/unord.map/eq.pass.cpp
@@ -91,7 +91,7 @@ int main()
assert( (c1 == c2));
assert(!(c1 != c2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/equal_range_const.pass.cpp b/test/std/containers/unord/unord.map/equal_range_const.pass.cpp
index fe166c965b16..46e04fde2b32 100644
--- a/test/std/containers/unord/unord.map/equal_range_const.pass.cpp
+++ b/test/std/containers/unord/unord.map/equal_range_const.pass.cpp
@@ -46,7 +46,7 @@ int main()
r = c.equal_range(5);
assert(std::distance(r.first, r.second) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp b/test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp
index 9e8d1a9644c5..8d7f34a0b1f2 100644
--- a/test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp
+++ b/test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp
@@ -46,7 +46,7 @@ int main()
r = c.equal_range(5);
assert(std::distance(r.first, r.second) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/find_const.pass.cpp b/test/std/containers/unord/unord.map/find_const.pass.cpp
index 120efa3061b1..0f0ea68bd720 100644
--- a/test/std/containers/unord/unord.map/find_const.pass.cpp
+++ b/test/std/containers/unord/unord.map/find_const.pass.cpp
@@ -44,7 +44,7 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/find_non_const.pass.cpp b/test/std/containers/unord/unord.map/find_non_const.pass.cpp
index 7582a796dd7c..cbce62daba16 100644
--- a/test/std/containers/unord/unord.map/find_non_const.pass.cpp
+++ b/test/std/containers/unord/unord.map/find_non_const.pass.cpp
@@ -44,7 +44,7 @@ int main()
i = c.find(5);
assert(i == c.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/incomplete_type.pass.cpp b/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
new file mode 100644
index 000000000000..d51b1d8d181f
--- /dev/null
+++ b/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
@@ -0,0 +1,37 @@
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Check that std::unordered_map and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <unordered_map>
+
+template <class Tp>
+struct MyHash {
+ MyHash() {}
+ std::size_t operator()(Tp const&) const {return 42;}
+};
+
+struct A {
+ typedef std::unordered_map<A, A, MyHash<A> > Map;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+ Map::local_iterator lit;
+ Map::const_local_iterator clit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+
+int main() {
+ A a;
+}
diff --git a/test/std/containers/unord/unord.map/iterators.pass.cpp b/test/std/containers/unord/unord.map/iterators.pass.cpp
index 47b1d7386684..31f4254ea3f8 100644
--- a/test/std/containers/unord/unord.map/iterators.pass.cpp
+++ b/test/std/containers/unord/unord.map/iterators.pass.cpp
@@ -66,7 +66,7 @@ int main()
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
@@ -116,7 +116,7 @@ int main()
C::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
-
+
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
diff --git a/test/std/containers/unord/unord.map/local_iterators.pass.cpp b/test/std/containers/unord/unord.map/local_iterators.pass.cpp
index 770b1ace7a3e..33a428a4f654 100644
--- a/test/std/containers/unord/unord.map/local_iterators.pass.cpp
+++ b/test/std/containers/unord/unord.map/local_iterators.pass.cpp
@@ -220,7 +220,7 @@ int main()
assert(i->first == 4);
assert(i->second == "four");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/max_load_factor.pass.cpp b/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
index b19a6e6cfa08..d9e1d057af03 100644
--- a/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
+++ b/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
@@ -16,6 +16,11 @@
// float max_load_factor() const;
// void max_load_factor(float mlf);
+
+#ifdef _LIBCPP_DEBUG
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
#include <unordered_map>
#include <string>
#include <cassert>
diff --git a/test/std/containers/unord/unord.map/max_size.pass.cpp b/test/std/containers/unord/unord.map/max_size.pass.cpp
index 7d5ae3a8e46d..9c1ca18c3054 100644
--- a/test/std/containers/unord/unord.map/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.map/max_size.pass.cpp
@@ -26,7 +26,7 @@ int main()
std::unordered_map<int, int> u;
assert(u.max_size() > 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::unordered_map<int, int, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, int>>> u;
diff --git a/test/std/containers/unord/unord.map/rehash.pass.cpp b/test/std/containers/unord/unord.map/rehash.pass.cpp
index e1a882c69ffd..fce751593a5e 100644
--- a/test/std/containers/unord/unord.map/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.map/rehash.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(c.bucket_count() == 31);
test(c);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/reserve.pass.cpp b/test/std/containers/unord/unord.map/reserve.pass.cpp
index bef237f960af..5999801a3923 100644
--- a/test/std/containers/unord/unord.map/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.map/reserve.pass.cpp
@@ -74,7 +74,7 @@ int main()
assert(c.bucket_count() >= 16);
test(c);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/types.pass.cpp b/test/std/containers/unord/unord.map/types.pass.cpp
index b53ff8e1540a..ecdc53c542cd 100644
--- a/test/std/containers/unord/unord.map/types.pass.cpp
+++ b/test/std/containers/unord/unord.map/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<char, short, std::hash<char>, std::equal_to<char>,
min_allocator<std::pair<const char, short>>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
index 0fc76db0fb2f..3c3ec058ead7 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
@@ -72,7 +72,7 @@ int main()
typedef test_hash<std::hash<T>> HF;
typedef test_compare<std::equal_to<T>> Comp;
typedef std::unordered_map<T, T, HF, Comp, A> C;
-
+
A a(10);
C c(2, a);
assert(c.bucket_count() == 2);
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
index fa0105604f15..ee85750f5c36 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
@@ -135,7 +135,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<std::pair<const int, std::string> > A;
typedef std::unordered_map<int, std::string,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
index 3a854e106543..e4da30bb4efd 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<std::pair<const int, std::string> > A;
typedef std::unordered_map<int, std::string,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
index dd57c58214fa..fe3eaee4642b 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
@@ -165,7 +165,7 @@ int main()
assert(c.max_load_factor() == 1);
assert(c0.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<std::pair<const int, std::string> > A;
typedef std::unordered_map<int, std::string,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..417120b9eb0e
--- /dev/null
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// The test requires access control SFINAE.
+
+// <unordered_map>
+
+// Check that std::unordered_map fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <unordered_map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_map<int, int, std::hash<int>, Comp<int> > m;
+}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
index 447bcab12e6a..0590d12818b3 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
@@ -108,7 +108,7 @@ int main()
assert(c.max_load_factor() == 1);
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
index 7e9125381cab..cb60807cc0e7 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
@@ -67,7 +67,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
index a0825db1ecd2..537343a59f7c 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
index 30e0dc1705a3..939e0bcd4e69 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
#include "../../../test_hash.h"
@@ -30,6 +33,7 @@ struct some_comp
typedef T value_type;
some_comp();
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -42,15 +46,14 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
@@ -66,5 +69,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
index 7fb4200605cf..3585fe7b881a 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
@@ -11,19 +11,20 @@
// ~unordered_map() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_map>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -35,11 +36,8 @@ struct some_hash
~some_hash() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -63,5 +61,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..709b56de2453
--- /dev/null
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// The test requires access control SFINAE.
+
+// <unordered_map>
+
+// Check that std::unordered_map fails to instantiate if the hash function is
+// not copy-constructible. This is mentioned in LWG issue 2436
+
+#include <unordered_map>
+
+template <class T>
+struct Hash {
+ std::size_t operator () (const T& lhs) const { return 0; }
+
+ Hash () {}
+private:
+ Hash (const Hash &); // declared but not defined
+};
+
+
+int main() {
+ std::unordered_map<int, int, Hash<int> > m;
+}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
index dbc48f816c8b..e980b68b57c1 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
index b60fb2cad90c..07e77e33504f 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
@@ -62,7 +62,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
index f3c086f78876..01aca134a604 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
@@ -63,7 +63,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
index f71c48a70136..08efdbd3591f 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
@@ -65,7 +65,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
index c02831676715..02cf5e12eb01 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -66,7 +66,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
index 72a634f0a93d..ea204373890d 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
@@ -111,7 +111,7 @@ int main()
assert(c0.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<int, std::string> P;
typedef min_allocator<std::pair<const int, std::string>> A;
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp
index fc3fc6f05f8a..61c2969d9337 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_map>
#include <cassert>
@@ -28,6 +30,7 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -41,7 +44,6 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -65,5 +67,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
index f292011cd7b6..16dc3dc6d4fa 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_map>
#include <cassert>
@@ -26,6 +28,7 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -38,7 +41,6 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -62,5 +64,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
index c1784d63b293..d2a18fa45f11 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
@@ -63,7 +63,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp
index b63c47a57dfa..9af18ab61f41 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp
@@ -66,7 +66,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp
index 675949e9d9be..e23208dba991 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp
index d55359f7aa06..d296bab32741 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp
@@ -69,7 +69,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp
index 61f9f21ad25b..638efcfebb77 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -71,7 +71,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp
index 0a3ae3a117f1..d2551861ec89 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
index 708dc2362739..465dea21bce1 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
index 6c975ec72030..f70ad7a1e5bc 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
index 8b2bb317987e..184d77d69d5f 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
index bcf7b91503ad..56eb59ddba9b 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp b/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
index 04ce91f69917..5504d33f299b 100644
--- a/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
@@ -77,7 +77,7 @@ int main()
}
assert(c.size() == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp b/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
index c072248f866a..7bc59447a5e6 100644
--- a/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
@@ -14,13 +14,20 @@
// class unordered_map
// mapped_type& operator[](const key_type& k);
+// mapped_type& operator[](key_type&& k);
#include <unordered_map>
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "min_allocator.h"
+#include "count_new.hpp"
+
+#if TEST_STD_VER >= 11
+#include "container_test_types.h"
+#endif
int main()
{
@@ -44,7 +51,7 @@ int main()
assert(c.size() == 5);
assert(c.at(11) == "eleven");
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<MoveOnly, std::string> C;
typedef std::pair<int, std::string> P;
@@ -65,8 +72,6 @@ int main()
assert(c.size() == 5);
assert(c.at(11) == "eleven");
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
@@ -88,7 +93,7 @@ int main()
assert(c.size() == 5);
assert(c.at(11) == "eleven");
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
{
typedef std::unordered_map<MoveOnly, std::string, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
min_allocator<std::pair<const MoveOnly, std::string>>> C;
@@ -110,6 +115,50 @@ int main()
assert(c.size() == 5);
assert(c.at(11) == "eleven");
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ using Container = TCT::unordered_map<>;
+ using Key = Container::key_type;
+ using MappedType = Container::mapped_type;
+ using ValueTp = Container::value_type;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ Container c;
+ const Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
+ }
+ {
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
+ }
+ {
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key &&>&&, std::tuple<>&&>();
+ MappedType& mref = c[std::move(k)];
+ assert(!cc->unchecked());
+ {
+ Key k2(1);
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[std::move(k2)];
+ assert(&mref == &mref2);
+ }
+ }
+ }
#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp b/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp
index c319b5c30b2c..f2c694e86f74 100644
--- a/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
@@ -18,9 +20,6 @@
// http://llvm.org/bugs/show_bug.cgi?id=16542
#include <unordered_map>
-
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
#include <tuple>
using namespace std;
@@ -30,12 +29,8 @@ struct my_hash
size_t operator()(const tuple<int,int>&) const {return 0;}
};
-#endif
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_VARIADICS
unordered_map<tuple<int,int>, size_t, my_hash> m;
m[make_tuple(2,3)]=7;
-#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
index 9f320e949479..106423ebfbe9 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
c.clear();
assert(c.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp
index 5de74d2e6c92..26f716166464 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(r.first->first == 5);
assert(r.first->second == Emplaceable(6, 7));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, Emplaceable, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, Emplaceable>>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp
index 21a4689658ae..477f2cf02e76 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp
@@ -51,7 +51,7 @@ int main()
assert(r->first == 5);
assert(r->second == Emplaceable(6, 7));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, Emplaceable, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, Emplaceable>>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp
index f0664c3c3ffc..820b12a9bf8b 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp
@@ -58,7 +58,7 @@ int main()
assert(c.size() == 0);
assert(k == c.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
new file mode 100644
index 000000000000..00c47182c925
--- /dev/null
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// class unordered_map
+
+// insert(...);
+// emplace(...);
+
+// UNSUPPORTED: c++98, c++03
+
+
+#include <unordered_map>
+
+#include "container_test_types.h"
+#include "../../../map_allocator_requirement_test_templates.h"
+
+int main()
+{
+ testMapInsert<TCT::unordered_map<> >();
+ testMapInsertHint<TCT::unordered_map<> >();
+ testMapEmplace<TCT::unordered_map<> >();
+ testMapEmplaceHint<TCT::unordered_map<> >();
+}
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp
index a16f097b4c01..fe2b24707fb3 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp
@@ -18,69 +18,64 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-int main()
+
+template <class Container>
+void do_insert_cv_test()
{
- {
- typedef std::unordered_map<double, int> C;
- typedef std::pair<C::iterator, bool> R;
- typedef C::value_type P;
- C c;
- R r = c.insert(P(3.5, 3));
- assert(r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
+ typedef Container M;
+ typedef std::pair<typename M::iterator, bool> R;
+ typedef typename M::value_type VT;
+ M m;
- r = c.insert(P(3.5, 4));
- assert(!r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
+ const VT v1(2.5, 2);
+ R r = m.insert(v1);
+ assert(r.second);
+ assert(m.size() == 1);
+ assert(r.first->first == 2.5);
+ assert(r.first->second == 2);
- r = c.insert(P(4.5, 4));
- assert(r.second);
- assert(c.size() == 2);
- assert(r.first->first == 4.5);
- assert(r.first->second == 4);
+ r = m.insert(VT(2.5, 3)); // test rvalue insertion works in C++03
+ assert(!r.second);
+ assert(m.size() == 1);
+ assert(r.first->first == 2.5);
+ assert(r.first->second == 2);
- r = c.insert(P(5.5, 4));
- assert(r.second);
- assert(c.size() == 3);
- assert(r.first->first == 5.5);
- assert(r.first->second == 4);
- }
-#if __cplusplus >= 201103L
- {
- typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
- min_allocator<std::pair<const double, int>>> C;
- typedef std::pair<C::iterator, bool> R;
- typedef C::value_type P;
- C c;
- R r = c.insert(P(3.5, 3));
- assert(r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
+ const VT v2(1.5, 1);
+ r = m.insert(v2);
+ assert(r.second);
+ assert(m.size() == 2);
+ assert(r.first->first == 1.5);
+ assert(r.first->second == 1);
- r = c.insert(P(3.5, 4));
- assert(!r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
+ const VT v3(3.5, 3);
+ r = m.insert(v3);
+ assert(r.second);
+ assert(m.size() == 3);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
- r = c.insert(P(4.5, 4));
- assert(r.second);
- assert(c.size() == 2);
- assert(r.first->first == 4.5);
- assert(r.first->second == 4);
+ const VT v4(3.5, 4);
+ r = m.insert(v4);
+ assert(!r.second);
+ assert(m.size() == 3);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+}
- r = c.insert(P(5.5, 4));
- assert(r.second);
- assert(c.size() == 3);
- assert(r.first->first == 5.5);
- assert(r.first->second == 4);
+int main()
+{
+ {
+ typedef std::unordered_map<double, int> M;
+ do_insert_cv_test<M>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>> M;
+ do_insert_cv_test<M>();
}
#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp
index 981b8fb18a0a..d40a8a61a3d4 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
min_allocator<std::pair<const double, int>>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
index 1618c1019e1c..04d01eb466e7 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
@@ -55,7 +57,6 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
typedef C::iterator R;
@@ -82,8 +83,6 @@ int main()
assert(r->first == 5);
assert(r->second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
{
typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
min_allocator<std::pair<const double, int>>> C;
@@ -111,7 +110,6 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
@@ -139,7 +137,31 @@ int main()
assert(r->first == 5);
assert(r->second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_map<double, MoveOnly> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, {3.5, 3});
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(c.end(), {3.5, 4});
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(c.end(), {4.5, 4});
+ assert(c.size() == 2);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), {5.5, 4});
+ assert(c.size() == 3);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
#if _LIBCPP_DEBUG >= 1
{
typedef std::unordered_map<double, int> C;
@@ -152,5 +174,4 @@ int main()
assert(false);
}
#endif
-#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp
index 81e8a468d83f..a4d8b5d410b4 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.at(3) == "three");
assert(c.at(4) == "four");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp
index fc44e7828ffa..b722b4a5ba02 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.at(3) == "three");
assert(c.at(4) == "four");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
index f53dc6c7e97a..faf5b046b5d8 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
@@ -54,7 +56,6 @@ int main()
assert(r.first->first == 5.5);
assert(r.first->second == 4);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
typedef std::pair<C::iterator, bool> R;
@@ -84,8 +85,6 @@ int main()
assert(r.first->first == 5);
assert(r.first->second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
{
typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
min_allocator<std::pair<const double, int>>> C;
@@ -116,7 +115,6 @@ int main()
assert(r.first->first == 5.5);
assert(r.first->second == 4);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
@@ -147,6 +145,32 @@ int main()
assert(r.first->first == 5);
assert(r.first->second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#endif
+ {
+ typedef std::unordered_map<double, MoveOnly> C;
+ typedef std::pair<C::iterator, bool> R;
+ C c;
+ R r = c.insert({3.5, 3});
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert({3.5, 4});
+ assert(!r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert({4.5, 4});
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4.5);
+ assert(r.first->second == 4);
+
+ r = c.insert({5.5, 4});
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5.5);
+ assert(r.first->second == 4);
+ }
}
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp
index eabcf2e85db2..adc4d6944ecb 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp
@@ -22,7 +22,6 @@
// template <class... Args>
// iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
-#include <__config>
#include <unordered_map>
#include <cassert>
#include <tuple>
diff --git a/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
index 1056c231f0db..f8f17ffec57a 100644
--- a/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_map>
// void swap(unordered_map& c)
@@ -26,6 +28,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -33,20 +36,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -79,7 +82,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -91,7 +94,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -104,7 +107,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -116,7 +119,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> MapType;
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
@@ -195,5 +197,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-#endif
}
diff --git a/test/std/containers/unord/unord.multimap/bucket.pass.cpp b/test/std/containers/unord/unord.multimap/bucket.pass.cpp
index be5acc196308..415dce11c128 100644
--- a/test/std/containers/unord/unord.multimap/bucket.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/bucket.pass.cpp
@@ -45,7 +45,7 @@ int main()
for (size_t i = 0; i < 13; ++i)
assert(c.bucket(i) == i % bc);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp b/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
index a02f72efc6c2..3bc3f5876fe6 100644
--- a/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(c.bucket_size(5) == 0);
assert(c.bucket_size(6) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/count.pass.cpp b/test/std/containers/unord/unord.multimap/count.pass.cpp
index efaf02e3a572..c93a2237c480 100644
--- a/test/std/containers/unord/unord.multimap/count.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/count.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(c.count(50) == 3);
assert(c.count(5) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/db_iterators_7.pass.cpp b/test/std/containers/unord/unord.multimap/db_iterators_7.pass.cpp
index b6ba8d6194a4..8a23edd174b0 100644
--- a/test/std/containers/unord/unord.multimap/db_iterators_7.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/db_iterators_7.pass.cpp
@@ -36,7 +36,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/db_iterators_8.pass.cpp b/test/std/containers/unord/unord.multimap/db_iterators_8.pass.cpp
index f5ea5089349b..e5a9ce961530 100644
--- a/test/std/containers/unord/unord.multimap/db_iterators_8.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/db_iterators_8.pass.cpp
@@ -34,7 +34,7 @@ int main()
C::value_type j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp b/test/std/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp
index 93cbd5433f47..2bd161f75072 100644
--- a/test/std/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp
@@ -34,7 +34,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp b/test/std/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp
index 159ae4963532..78b40e14e7a1 100644
--- a/test/std/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp
@@ -33,7 +33,7 @@ int main()
C::value_type j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/eq.pass.cpp b/test/std/containers/unord/unord.multimap/eq.pass.cpp
index 3604e7792c13..f95bea3daef3 100644
--- a/test/std/containers/unord/unord.multimap/eq.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/eq.pass.cpp
@@ -100,7 +100,7 @@ int main()
assert( (c1 == c2));
assert(!(c1 != c2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp b/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
index 67613b094bfc..382ed7c9831d 100644
--- a/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
@@ -57,7 +57,7 @@ int main()
assert(r.first->first == 50);
assert(r.first->second == "fiftyB");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp b/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
index eb4c019af951..17eb14e44262 100644
--- a/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
@@ -57,7 +57,7 @@ int main()
assert(r.first->first == 50);
assert(r.first->second == "fiftyB");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/find_const.pass.cpp b/test/std/containers/unord/unord.multimap/find_const.pass.cpp
index bc2650d111f3..70c2b45efbd4 100644
--- a/test/std/containers/unord/unord.multimap/find_const.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/find_const.pass.cpp
@@ -44,7 +44,7 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/find_non_const.pass.cpp b/test/std/containers/unord/unord.multimap/find_non_const.pass.cpp
index 5a128c0f37e1..0510d14419d5 100644
--- a/test/std/containers/unord/unord.multimap/find_non_const.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/find_non_const.pass.cpp
@@ -44,7 +44,7 @@ int main()
i = c.find(5);
assert(i == c.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/incomplete.pass.cpp b/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
new file mode 100644
index 000000000000..7822224e7366
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
@@ -0,0 +1,37 @@
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Check that std::unordered_multimap and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <unordered_map>
+
+template <class Tp>
+struct MyHash {
+ MyHash() {}
+ std::size_t operator()(Tp const&) const {return 42;}
+};
+
+struct A {
+ typedef std::unordered_multimap<A, A, MyHash<A> > Map;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+ Map::local_iterator lit;
+ Map::const_local_iterator clit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+
+int main() {
+ A a;
+}
diff --git a/test/std/containers/unord/unord.multimap/iterators.pass.cpp b/test/std/containers/unord/unord.multimap/iterators.pass.cpp
index 1831cf1149b1..cc75bb10a811 100644
--- a/test/std/containers/unord/unord.multimap/iterators.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/iterators.pass.cpp
@@ -69,7 +69,7 @@ int main()
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/load_factor.pass.cpp b/test/std/containers/unord/unord.multimap/load_factor.pass.cpp
index 52b3f03d88a1..9c42435946ff 100644
--- a/test/std/containers/unord/unord.multimap/load_factor.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/load_factor.pass.cpp
@@ -48,7 +48,7 @@ int main()
const C c;
assert(c.load_factor() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp b/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
index 35e4c772fd33..504fe54de830 100644
--- a/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
@@ -284,7 +284,7 @@ int main()
j = c.cend(b);
assert(std::distance(i, j) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp b/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp
index 23b90579ec41..a2ab399d3469 100644
--- a/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp
@@ -30,7 +30,7 @@ int main()
const C c;
assert(c.max_bucket_count() > 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp b/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp
index 39b7feeba4e5..b0b2b664f098 100644
--- a/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp
@@ -42,7 +42,7 @@ int main()
c.max_load_factor(2.5);
assert(c.max_load_factor() == 2.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/max_size.pass.cpp b/test/std/containers/unord/unord.multimap/max_size.pass.cpp
index caba5932b23c..3bf1f1496f68 100644
--- a/test/std/containers/unord/unord.multimap/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/max_size.pass.cpp
@@ -26,7 +26,7 @@ int main()
std::unordered_multimap<int, int> u;
assert(u.max_size() > 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, int>>> u;
diff --git a/test/std/containers/unord/unord.multimap/rehash.pass.cpp b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
index 5ef21d3bc4ce..c099abe2ac05 100644
--- a/test/std/containers/unord/unord.multimap/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
@@ -97,7 +97,7 @@ int main()
assert(c.bucket_count() == 31);
test(c);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/reserve.pass.cpp b/test/std/containers/unord/unord.multimap/reserve.pass.cpp
index 388b1f67e450..3f76da11e3d9 100644
--- a/test/std/containers/unord/unord.multimap/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/reserve.pass.cpp
@@ -76,7 +76,7 @@ int main()
assert(c.bucket_count() >= 16);
test(c);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/swap_member.pass.cpp b/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
index 225eccd4793f..4653cc32ef36 100644
--- a/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
@@ -396,7 +396,7 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare;
diff --git a/test/std/containers/unord/unord.multimap/types.pass.cpp b/test/std/containers/unord/unord.multimap/types.pass.cpp
index 55ae749746c1..e141234904e4 100644
--- a/test/std/containers/unord/unord.multimap/types.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/types.pass.cpp
@@ -50,7 +50,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<char, short, std::hash<char>, std::equal_to<char>,
min_allocator<std::pair<const char, short>>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
index dc41fad29af8..6eb258db4960 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
@@ -72,7 +72,7 @@ int main()
typedef test_hash<std::hash<T>> HF;
typedef test_compare<std::equal_to<T>> Comp;
typedef std::unordered_multimap<T, T, HF, Comp, A> C;
-
+
A a(10);
C c(2, a);
assert(c.bucket_count() == 2);
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
index df566b396f99..5634a79eff33 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
@@ -163,7 +163,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<std::pair<const int, std::string> > A;
typedef std::unordered_multimap<int, std::string,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
index 2d3c1434d69f..0d3b4453dd44 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
@@ -84,7 +84,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<std::pair<const int, std::string> > A;
typedef std::unordered_multimap<int, std::string,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
index 0c43fa8f06ed..ed8d792e8178 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
@@ -223,7 +223,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<std::pair<const int, std::string> > A;
typedef std::unordered_multimap<int, std::string,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..d3e31484c8b7
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// The test requires access control SFINAE.
+
+// <unordered_map>
+
+// Check that std::unordered_multimap fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <unordered_map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_multimap<int, int, std::hash<int>, Comp<int> > m;
+}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
index 06adfd7cfe05..7b0adda182cb 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
@@ -136,7 +136,7 @@ int main()
assert(c.max_load_factor() == 1);
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
index 0fb508f1f124..e759267b45b1 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
@@ -81,7 +81,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
index 1884065ce0c8..f361b2c3dfdd 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
index fac3cec63d70..e404612a754e 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
#include "../../../test_hash.h"
@@ -30,6 +33,7 @@ struct some_comp
typedef T value_type;
some_comp();
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -42,15 +46,14 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
@@ -66,5 +69,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
index 220785196791..2797f8dcfb04 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
@@ -11,19 +11,20 @@
// ~unordered_multimap() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_map>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -35,11 +36,8 @@ struct some_hash
~some_hash() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -63,5 +61,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..4214f694a20f
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// The test requires access control SFINAE.
+
+// <unordered_map>
+
+// Check that std::unordered_multimap fails to instantiate if the hash function is
+// not copy-constructible. This is mentioned in LWG issue 2436
+
+#include <unordered_map>
+
+template <class T>
+struct Hash {
+ std::size_t operator () (const T& lhs) const { return 0; }
+
+ Hash () {}
+private:
+ Hash (const Hash &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_multimap<int, int, Hash<int> > m;
+}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
index cc5532adbe08..f6bc3a08cae9 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
@@ -81,7 +81,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
index 8f6710a93317..5dc4323493e4 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
@@ -84,7 +84,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
index 0962e9b29f83..8bcbd0bdc352 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
@@ -85,7 +85,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
index 324b0a7c1a5e..8dda376db3f9 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
@@ -87,7 +87,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
index 23ae7d19f9c2..6843613b0481 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -88,7 +88,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
index b61735eb0256..58d1424d8b1e 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
@@ -128,7 +128,7 @@ int main()
assert(c0.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
index 106c29cda8d0..a66e41e8e35c 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
@@ -159,7 +159,7 @@ int main()
assert(c0.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::pair<int, std::string> P;
typedef min_allocator<std::pair<const int, std::string>> A;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp
index 47e61ab70b83..eeda7b39e958 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_map>
#include <cassert>
@@ -28,6 +30,7 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -41,7 +44,6 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -65,5 +67,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
index 37f17876973a..965c46499a16 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_map>
#include <cassert>
@@ -26,6 +28,7 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -38,7 +41,6 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -62,5 +64,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
index bb700ec565dc..96ad70a56e0f 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
@@ -85,7 +85,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp
index ad33b13054c7..15b31b519b74 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp
@@ -88,7 +88,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp
index 98644c75e33b..f565f10c89b5 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp
@@ -90,7 +90,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp
index 9a79c3056358..8f86befbe37f 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp
@@ -91,7 +91,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp
index a5aafb96c7b0..e8040d88de2a 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -93,7 +93,7 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp
index 44cf84ff323c..38e6c60df52d 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
index bd56a41fd71f..8aad662610ab 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
index 33460612ce3f..2cc6c0176e5e 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
index c2420ce9e6f5..ebfce9fec564 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
index 33886670b3b4..56e3808984c5 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
index 4efcfaa6ce53..891d44911eb0 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
c.clear();
assert(c.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
index 4f2e8ef061fa..96678cf33fa5 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(r->first == 5);
assert(r->second == Emplaceable(6, 7));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, Emplaceable, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, Emplaceable>>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
index 4d141ad137c8..8bccd4013a29 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(r->first == 3);
assert(r->second == Emplaceable(5, 6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, Emplaceable, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, Emplaceable>>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
index b31a4e56b31e..9da1e71cba06 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
@@ -76,7 +76,7 @@ int main()
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
@@ -123,7 +123,7 @@ int main()
assert(std::distance(c.cbegin(), c.cend()) == c.size());
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
index 892f8a247502..f061d858e3f7 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
@@ -21,12 +21,12 @@
#include "min_allocator.h"
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
template <typename Unordered>
bool only_deletions ( const Unordered &whole, const Unordered &part ) {
typename Unordered::const_iterator w = whole.begin();
typename Unordered::const_iterator p = part.begin();
-
+
while ( w != whole.end () && p != part.end()) {
if ( *w == *p )
p++;
@@ -200,7 +200,7 @@ int main()
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
@@ -372,7 +372,7 @@ int main()
m2.insert(std::make_pair(i,j));
}
}
-
+
C::iterator i = m2.begin();
int ctr = 0;
while (i != m2.end()) {
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
index f60ec071ff70..110cc4542b42 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
@@ -98,7 +98,7 @@ int main()
assert(c.size() == 0);
assert(k == c.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp
new file mode 100644
index 000000000000..30f78936ff92
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// class unordered_multimap
+
+// insert(...)
+
+// UNSUPPORTED: c++98, c++03
+
+#include <unordered_map>
+
+#include "container_test_types.h"
+#include "../../../map_allocator_requirement_test_templates.h"
+
+int main()
+{
+ testMultimapInsert<TCT::unordered_multimap<> >();
+ testMultimapInsertHint<TCT::unordered_multimap<> >();
+}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
index e7e7cb03b6d0..320fbc8fe2ea 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
min_allocator<std::pair<const double, int>>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
index c7cb1f4c014b..c920ae93553f 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
min_allocator<std::pair<const double, int>>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
index 7116fa02b6f5..d6c0dbdbed07 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
@@ -55,7 +57,6 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
typedef C::iterator R;
@@ -82,8 +83,6 @@ int main()
assert(r->first == 5);
assert(r->second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
{
typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
min_allocator<std::pair<const double, int>>> C;
@@ -111,7 +110,6 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
@@ -139,7 +137,31 @@ int main()
assert(r->first == 5);
assert(r->second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_multimap<double, int> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, {3.5, 3});
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(r, {3.5, 4});
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), {4.5, 4});
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), {5.5, 4});
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
#if _LIBCPP_DEBUG >= 1
{
typedef std::unordered_multimap<double, int> C;
@@ -152,5 +174,4 @@ int main()
assert(false);
}
#endif
-#endif
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
index 23dbe84a3c51..851b36e51ca4 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
@@ -70,7 +70,7 @@ int main()
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
index 2820639b4ea0..967ad369da3f 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
@@ -70,7 +70,7 @@ int main()
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
index 5a98467e9d0f..6735b8af5a0a 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
@@ -50,7 +52,6 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
typedef C::iterator R;
@@ -76,8 +77,6 @@ int main()
assert(r->first == 5);
assert(r->second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
{
typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
min_allocator<std::pair<const double, int>>> C;
@@ -104,7 +103,6 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
@@ -131,6 +129,28 @@ int main()
assert(r->first == 5);
assert(r->second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#endif
+ {
+ typedef std::unordered_multimap<double, MoveOnly> C;
+ typedef C::iterator R;
+ C c;
+ R r = c.insert({3.5, 3});
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert({3.5, 4});
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert({4.5, 4});
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert({5.5, 4});
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
index 7c912e01d572..553131182315 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_map>
// void swap(unordered_multimap& c)
@@ -26,6 +28,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -33,20 +36,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -79,7 +82,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -91,7 +94,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -104,7 +107,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -115,7 +118,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
@@ -193,6 +195,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
index 0f579e091683..84911ba01ffb 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
@@ -395,7 +395,7 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare;
diff --git a/test/std/containers/unord/unord.multiset/bucket.pass.cpp b/test/std/containers/unord/unord.multiset/bucket.pass.cpp
index 0293133d494a..30858c79a048 100644
--- a/test/std/containers/unord/unord.multiset/bucket.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/bucket.pass.cpp
@@ -44,7 +44,7 @@ int main()
for (size_t i = 0; i < 13; ++i)
assert(c.bucket(i) == i % bc);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp b/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
index c7842e5c1977..adde647cb246 100644
--- a/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
@@ -47,7 +47,7 @@ int main()
const C c(std::begin(a), std::end(a));
assert(c.bucket_count() >= 11);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp b/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
index 639d7ac37965..7ca480556349 100644
--- a/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(c.bucket_size(5) == 0);
assert(c.bucket_size(6) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/clear.pass.cpp b/test/std/containers/unord/unord.multiset/clear.pass.cpp
index 61ca847e7c4a..57dbb8b1faaa 100644
--- a/test/std/containers/unord/unord.multiset/clear.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/clear.pass.cpp
@@ -38,7 +38,7 @@ int main()
c.clear();
assert(c.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/count.pass.cpp b/test/std/containers/unord/unord.multiset/count.pass.cpp
index e548324d9545..9f61845fa69c 100644
--- a/test/std/containers/unord/unord.multiset/count.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/count.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.count(50) == 3);
assert(c.count(5) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/db_iterators_7.pass.cpp b/test/std/containers/unord/unord.multiset/db_iterators_7.pass.cpp
index c8ef2fbca163..91f083b241d6 100644
--- a/test/std/containers/unord/unord.multiset/db_iterators_7.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/db_iterators_7.pass.cpp
@@ -35,7 +35,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::unordered_multiset<T, min_allocator<T>> C;
diff --git a/test/std/containers/unord/unord.multiset/db_iterators_8.pass.cpp b/test/std/containers/unord/unord.multiset/db_iterators_8.pass.cpp
index eef799787947..3d78ed4c022f 100644
--- a/test/std/containers/unord/unord.multiset/db_iterators_8.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/db_iterators_8.pass.cpp
@@ -33,7 +33,7 @@ int main()
T j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::unordered_multiset<T, min_allocator<T>> C;
diff --git a/test/std/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp b/test/std/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp
index c1de95cace71..cf8874803cb7 100644
--- a/test/std/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp
@@ -34,7 +34,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::unordered_multiset<T, min_allocator<T>> C;
diff --git a/test/std/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp b/test/std/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp
index 962b85298ae1..46e5ba7d5f84 100644
--- a/test/std/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp
@@ -33,7 +33,7 @@ int main()
T j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::unordered_multiset<T, min_allocator<T>> C;
diff --git a/test/std/containers/unord/unord.multiset/emplace.pass.cpp b/test/std/containers/unord/unord.multiset/emplace.pass.cpp
index 13787d9b4037..d8d9e9bc5695 100644
--- a/test/std/containers/unord/unord.multiset/emplace.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/emplace.pass.cpp
@@ -41,7 +41,7 @@ int main()
assert(c.size() == 3);
assert(*r == Emplaceable(5, 6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>,
std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
diff --git a/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp b/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp
index 8885cc03cf03..3756476dc8fc 100644
--- a/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(c.size() == 3);
assert(*r == Emplaceable(5, 6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>,
std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
diff --git a/test/std/containers/unord/unord.multiset/eq.pass.cpp b/test/std/containers/unord/unord.multiset/eq.pass.cpp
index bbedbc905a4b..9c59d0cf5e9f 100644
--- a/test/std/containers/unord/unord.multiset/eq.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/eq.pass.cpp
@@ -99,7 +99,7 @@ int main()
assert( (c1 == c2));
assert(!(c1 != c2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp b/test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp
index a0aaac2bd868..e89410e61633 100644
--- a/test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp
@@ -53,7 +53,7 @@ int main()
++r.first;
assert(*r.first == 50);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp b/test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
index 73d44f7a56b7..a9373cec6517 100644
--- a/test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
@@ -53,7 +53,7 @@ int main()
++r.first;
assert(*r.first == 50);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp b/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
index d3be2b6d6365..117e8e68efab 100644
--- a/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
@@ -76,7 +76,7 @@ int main()
assert(c.count(4) == 1);
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/unord/unord.multiset/erase_key.pass.cpp b/test/std/containers/unord/unord.multiset/erase_key.pass.cpp
index 7c243973f163..e8ff71d0316b 100644
--- a/test/std/containers/unord/unord.multiset/erase_key.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/erase_key.pass.cpp
@@ -21,12 +21,12 @@
#include "min_allocator.h"
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
template <typename Unordered>
bool only_deletions ( const Unordered &whole, const Unordered &part ) {
typename Unordered::const_iterator w = whole.begin();
typename Unordered::const_iterator p = part.begin();
-
+
while ( w != whole.end () && p != part.end()) {
if ( *w == *p )
p++;
@@ -95,7 +95,7 @@ int main()
assert(c.erase(3) == 0);
assert(c.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
@@ -160,7 +160,7 @@ int main()
m.insert(i); m.insert(i);
m2.insert(i); m2.insert(i);
}
-
+
C::iterator i = m2.begin();
int ctr = 0;
while (i != m2.end()) {
diff --git a/test/std/containers/unord/unord.multiset/erase_range.pass.cpp b/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
index baac08eddc1e..a4f703df8506 100644
--- a/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
@@ -55,7 +55,7 @@ int main()
assert(c.size() == 0);
assert(k == c.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/find_const.pass.cpp b/test/std/containers/unord/unord.multiset/find_const.pass.cpp
index 5caaf207aaf2..505266b1f022 100644
--- a/test/std/containers/unord/unord.multiset/find_const.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/find_const.pass.cpp
@@ -42,7 +42,7 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/find_non_const.pass.cpp b/test/std/containers/unord/unord.multiset/find_non_const.pass.cpp
index 030487863f98..32ee79aa7554 100644
--- a/test/std/containers/unord/unord.multiset/find_non_const.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/find_non_const.pass.cpp
@@ -42,7 +42,7 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/incomplete.pass.cpp b/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
new file mode 100644
index 000000000000..f6d8dc17c5a2
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
@@ -0,0 +1,38 @@
+
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Check that std::unordered_multiset and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <unordered_set>
+
+template <class Tp>
+struct MyHash {
+ MyHash() {}
+ std::size_t operator()(Tp const&) const {return 42;}
+};
+
+struct A {
+ typedef std::unordered_multiset<A, MyHash<A> > Map;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+ Map::local_iterator lit;
+ Map::const_local_iterator clit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+
+int main() {
+ A a;
+}
diff --git a/test/std/containers/unord/unord.multiset/insert_allocator_requirements.pass.cpp b/test/std/containers/unord/unord.multiset/insert_allocator_requirements.pass.cpp
new file mode 100644
index 000000000000..ad7bc043a5b3
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/insert_allocator_requirements.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// class unordered_multiset
+
+// insert(...)
+
+// UNSUPPORTED: c++98, c++03
+
+#include <unordered_set>
+#include "container_test_types.h"
+#include "../../set_allocator_requirement_test_templates.h"
+
+int main()
+{
+ testMultisetInsert<TCT::unordered_multiset<> >();
+}
diff --git a/test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
index 0051e497fd7a..946858ea53dc 100644
--- a/test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.size() == 4);
assert(*r == 5.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<double, std::hash<double>,
std::equal_to<double>, min_allocator<double>> C;
diff --git a/test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
index 25b4bc1aa04a..a6ab26659b55 100644
--- a/test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(c.size() == 4);
assert(*r == 5.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<double, std::hash<double>,
std::equal_to<double>, min_allocator<double>> C;
diff --git a/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
index 481ec80231c9..f5026e102c42 100644
--- a/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
@@ -73,7 +73,7 @@ int main()
assert(*r == 5);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<double, std::hash<double>,
std::equal_to<double>, min_allocator<double>> C;
diff --git a/test/std/containers/unord/unord.multiset/insert_init.pass.cpp b/test/std/containers/unord/unord.multiset/insert_init.pass.cpp
index 6941d86f6197..9010cac99caf 100644
--- a/test/std/containers/unord/unord.multiset/insert_init.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/insert_init.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/insert_range.pass.cpp b/test/std/containers/unord/unord.multiset/insert_range.pass.cpp
index 41c9d8136feb..3d36ff9d4ce1 100644
--- a/test/std/containers/unord/unord.multiset/insert_range.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/insert_range.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp
index 2718324b4d08..04f9e34164ab 100644
--- a/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp
@@ -67,7 +67,7 @@ int main()
assert(*r == 5);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<double, std::hash<double>,
std::equal_to<double>, min_allocator<double>> C;
diff --git a/test/std/containers/unord/unord.multiset/iterators.pass.cpp b/test/std/containers/unord/unord.multiset/iterators.pass.cpp
index be95b44517fe..bf42740c23fb 100644
--- a/test/std/containers/unord/unord.multiset/iterators.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/iterators.pass.cpp
@@ -65,7 +65,7 @@ int main()
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/load_factor.pass.cpp b/test/std/containers/unord/unord.multiset/load_factor.pass.cpp
index 2a5724b3d270..fad1c182e6b7 100644
--- a/test/std/containers/unord/unord.multiset/load_factor.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/load_factor.pass.cpp
@@ -47,7 +47,7 @@ int main()
const C c;
assert(c.load_factor() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/local_iterators.pass.cpp b/test/std/containers/unord/unord.multiset/local_iterators.pass.cpp
index 3471707e42a1..8ba9f0f9579d 100644
--- a/test/std/containers/unord/unord.multiset/local_iterators.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/local_iterators.pass.cpp
@@ -259,7 +259,7 @@ int main()
j = c.cend(b);
assert(std::distance(i, j) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp b/test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp
index 619a8cf1266f..510ba5fe4da0 100644
--- a/test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp
@@ -27,7 +27,7 @@ int main()
const C c;
assert(c.max_bucket_count() > 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp b/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp
index 08f52bb70840..00fe962327f8 100644
--- a/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp
@@ -41,7 +41,7 @@ int main()
c.max_load_factor(2.5);
assert(c.max_load_factor() == 2.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/max_size.pass.cpp b/test/std/containers/unord/unord.multiset/max_size.pass.cpp
index a5d0b5538bce..b26ad73fed2b 100644
--- a/test/std/containers/unord/unord.multiset/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/max_size.pass.cpp
@@ -26,7 +26,7 @@ int main()
std::unordered_multiset<int> u;
assert(u.max_size() > 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> u;
diff --git a/test/std/containers/unord/unord.multiset/rehash.pass.cpp b/test/std/containers/unord/unord.multiset/rehash.pass.cpp
index 5c7c6aa8aad3..3ad16a6bcbfe 100644
--- a/test/std/containers/unord/unord.multiset/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/rehash.pass.cpp
@@ -67,7 +67,7 @@ int main()
assert(c.bucket_count() == 31);
test(c);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/reserve.pass.cpp b/test/std/containers/unord/unord.multiset/reserve.pass.cpp
index 1d393a09cde2..52d51011fe36 100644
--- a/test/std/containers/unord/unord.multiset/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/reserve.pass.cpp
@@ -73,7 +73,7 @@ int main()
assert(c.bucket_count() >= 16);
test(c);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.multiset/swap_member.pass.cpp b/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
index 275ff4094e81..bc3314c867eb 100644
--- a/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
@@ -386,7 +386,7 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare;
diff --git a/test/std/containers/unord/unord.multiset/types.pass.cpp b/test/std/containers/unord/unord.multiset/types.pass.cpp
index 5222222d8197..ee5c2c38ac0c 100644
--- a/test/std/containers/unord/unord.multiset/types.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/types.pass.cpp
@@ -48,7 +48,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<short, std::hash<short>,
std::equal_to<short>, min_allocator<short>> C;
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
index ccd21a58b22c..8d020a52ac04 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
index 2042f69fd772..f219073cffcb 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
@@ -151,7 +151,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<int> A;
typedef std::unordered_multiset<int,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
index 4eaf2c5779f3..2835cd444c30 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<int> A;
typedef std::unordered_multiset<int,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
index 4b0e52c5930c..52d08f3e2293 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
@@ -170,7 +170,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_allocator<int> A;
typedef std::unordered_multiset<int,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..b38316c37689
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Check that std::unordered_set fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <unordered_set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_multiset<int, std::hash<int>, Comp<int> > m;
+}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
index a91ee1dae071..e6042b0d9123 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
@@ -121,7 +121,7 @@ int main()
assert(c.max_load_factor() == 1);
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
index 32c876d32878..5e24f7257252 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
@@ -73,7 +73,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
index 737ae2dae793..e741f3208dac 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp
index 391609fd144a..fba024aed00e 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
#include "../../../test_hash.h"
@@ -30,6 +33,7 @@ struct some_comp
typedef T value_type;
some_comp();
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -42,15 +46,14 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_multiset<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
@@ -66,5 +69,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
index a549288afc14..733484510ef1 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
@@ -11,19 +11,20 @@
// ~unordered_multiset() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_set>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -35,11 +36,8 @@ struct some_hash
~some_hash() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_multiset<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -63,5 +61,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..a43f94ca2af3
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Check that std::unordered_multiset fails to instantiate if the hash function is
+// not copy-constructible. This is mentioned in LWG issue 2436
+
+#include <unordered_set>
+
+template <class T>
+struct Hash {
+ std::size_t operator () (const T& lhs) const { return 0; }
+
+ Hash () {}
+private:
+ Hash (const Hash &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_multiset<int, Hash<int> > m;
+}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
index 416c28cf83db..53a9003b0173 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
@@ -57,7 +57,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
index ad42d76db9ee..e5934acc8e7c 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
@@ -60,7 +60,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
index 7cc50fa30067..86253214af9c 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
@@ -62,7 +62,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
index 18d3c8288cd2..47469c0c5b9b 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
@@ -63,7 +63,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
index 92d9d86040bb..d72ee6f33f50 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -64,7 +64,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
index 687f2654f86c..defd90f408b0 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
@@ -103,7 +103,7 @@ int main()
assert(c0.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
index c03c605f40ce..45b4c8b4f5d5 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
@@ -118,7 +118,7 @@ int main()
assert(c0.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int P;
typedef min_allocator<int> A;
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp
index 2f86f018d9fe..fbd6df14c052 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_set>
#include <cassert>
@@ -28,6 +30,7 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -41,7 +44,6 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_multiset<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -65,5 +67,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
index 8a4c3c945364..e84ffb7b2fde 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_set>
#include <cassert>
@@ -26,6 +28,7 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -38,7 +41,6 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_multiset<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -62,5 +64,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
index cd2bb1e7bbcd..12679ef3e13e 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
@@ -60,7 +60,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp
index f2d0db932bd7..c9454cf630db 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp
@@ -63,7 +63,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp
index dc40b361d1f3..5ff61575d994 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp
@@ -65,7 +65,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp
index c316b7809d53..ecf3176e90a4 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp
@@ -66,7 +66,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp
index ab76248c326c..18a092c83f6a 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp
index e55db7ca2aaf..215b31fef65f 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
index 35bfbe331b41..38211f958c43 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
index 0171ea64ebb1..baeabd1b2d08 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
index 785cdf246368..380f36df7bf2 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
index 50dd3c95ee52..149d045e07a9 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
index 63642fcd7cca..df9f18b147e3 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_set>
// void swap(unordered_multiset& c)
@@ -26,6 +28,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -33,20 +36,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -60,6 +63,7 @@ struct some_hash
typedef T value_type;
some_hash() {}
some_hash(const some_hash&);
+ std::size_t operator()(const T&) const { return 0; }
};
template <class T>
@@ -68,6 +72,7 @@ struct some_hash2
typedef T value_type;
some_hash2() {}
some_hash2(const some_hash2&);
+ std::size_t operator()(const T&) const { return 0; }
};
#if TEST_STD_VER >= 14
@@ -79,7 +84,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -91,7 +96,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -104,7 +109,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -115,7 +120,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_multiset<MoveOnly> C;
C c1, c2;
@@ -193,6 +197,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
index 624b81c5eb3e..4b1c129508e1 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
@@ -386,7 +386,7 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare;
diff --git a/test/std/containers/unord/unord.set/bucket.pass.cpp b/test/std/containers/unord/unord.set/bucket.pass.cpp
index 0dae664e0b23..9b704ccee0c0 100644
--- a/test/std/containers/unord/unord.set/bucket.pass.cpp
+++ b/test/std/containers/unord/unord.set/bucket.pass.cpp
@@ -44,7 +44,7 @@ int main()
for (size_t i = 0; i < 13; ++i)
assert(c.bucket(i) == i % bc);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
diff --git a/test/std/containers/unord/unord.set/bucket_count.pass.cpp b/test/std/containers/unord/unord.set/bucket_count.pass.cpp
index caaa5a6011a9..e35e43615dd3 100644
--- a/test/std/containers/unord/unord.set/bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.set/bucket_count.pass.cpp
@@ -47,7 +47,7 @@ int main()
const C c(std::begin(a), std::end(a));
assert(c.bucket_count() >= 11);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef C::const_iterator I;
diff --git a/test/std/containers/unord/unord.set/bucket_size.pass.cpp b/test/std/containers/unord/unord.set/bucket_size.pass.cpp
index 628d55737a82..2ae618c85e5b 100644
--- a/test/std/containers/unord/unord.set/bucket_size.pass.cpp
+++ b/test/std/containers/unord/unord.set/bucket_size.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(c.bucket_size(3) == 1);
assert(c.bucket_size(4) == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
diff --git a/test/std/containers/unord/unord.set/clear.pass.cpp b/test/std/containers/unord/unord.set/clear.pass.cpp
index 6da15308508c..8ebf748eb8da 100644
--- a/test/std/containers/unord/unord.set/clear.pass.cpp
+++ b/test/std/containers/unord/unord.set/clear.pass.cpp
@@ -38,7 +38,7 @@ int main()
c.clear();
assert(c.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
diff --git a/test/std/containers/unord/unord.set/count.pass.cpp b/test/std/containers/unord/unord.set/count.pass.cpp
index 83bb8aaa2be0..18cac7cf9b0d 100644
--- a/test/std/containers/unord/unord.set/count.pass.cpp
+++ b/test/std/containers/unord/unord.set/count.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.count(50) == 1);
assert(c.count(5) == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
diff --git a/test/std/containers/unord/unord.set/db_iterators_7.pass.cpp b/test/std/containers/unord/unord.set/db_iterators_7.pass.cpp
index 80b1a49c5758..647e30b8089c 100644
--- a/test/std/containers/unord/unord.set/db_iterators_7.pass.cpp
+++ b/test/std/containers/unord/unord.set/db_iterators_7.pass.cpp
@@ -35,7 +35,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::unordered_set<T, min_allocator<T>> C;
diff --git a/test/std/containers/unord/unord.set/db_iterators_8.pass.cpp b/test/std/containers/unord/unord.set/db_iterators_8.pass.cpp
index 8b266bbf664f..4c303194c20e 100644
--- a/test/std/containers/unord/unord.set/db_iterators_8.pass.cpp
+++ b/test/std/containers/unord/unord.set/db_iterators_8.pass.cpp
@@ -33,7 +33,7 @@ int main()
T j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::unordered_set<T, min_allocator<T>> C;
diff --git a/test/std/containers/unord/unord.set/db_local_iterators_7.pass.cpp b/test/std/containers/unord/unord.set/db_local_iterators_7.pass.cpp
index b9fcb8c4ae0c..9dbd43d2f7a8 100644
--- a/test/std/containers/unord/unord.set/db_local_iterators_7.pass.cpp
+++ b/test/std/containers/unord/unord.set/db_local_iterators_7.pass.cpp
@@ -34,7 +34,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::unordered_set<T, min_allocator<T>> C;
diff --git a/test/std/containers/unord/unord.set/db_local_iterators_8.pass.cpp b/test/std/containers/unord/unord.set/db_local_iterators_8.pass.cpp
index 74d131b19abe..1212321fe1d1 100644
--- a/test/std/containers/unord/unord.set/db_local_iterators_8.pass.cpp
+++ b/test/std/containers/unord/unord.set/db_local_iterators_8.pass.cpp
@@ -33,7 +33,7 @@ int main()
T j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::unordered_set<T, min_allocator<T>> C;
diff --git a/test/std/containers/unord/unord.set/emplace.pass.cpp b/test/std/containers/unord/unord.set/emplace.pass.cpp
index d105e7ac0f4e..19af8065819c 100644
--- a/test/std/containers/unord/unord.set/emplace.pass.cpp
+++ b/test/std/containers/unord/unord.set/emplace.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(*r.first == Emplaceable(5, 6));
assert(!r.second);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<Emplaceable, std::hash<Emplaceable>,
std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
diff --git a/test/std/containers/unord/unord.set/emplace_hint.pass.cpp b/test/std/containers/unord/unord.set/emplace_hint.pass.cpp
index 50b0035165d2..97f3591d012b 100644
--- a/test/std/containers/unord/unord.set/emplace_hint.pass.cpp
+++ b/test/std/containers/unord/unord.set/emplace_hint.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(c.size() == 2);
assert(*r == Emplaceable(5, 6));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<Emplaceable, std::hash<Emplaceable>,
std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
diff --git a/test/std/containers/unord/unord.set/eq.pass.cpp b/test/std/containers/unord/unord.set/eq.pass.cpp
index 54a9c2eced34..8ff4ac5df37f 100644
--- a/test/std/containers/unord/unord.set/eq.pass.cpp
+++ b/test/std/containers/unord/unord.set/eq.pass.cpp
@@ -90,7 +90,7 @@ int main()
assert( (c1 == c2));
assert(!(c1 != c2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
diff --git a/test/std/containers/unord/unord.set/equal_range_const.pass.cpp b/test/std/containers/unord/unord.set/equal_range_const.pass.cpp
index 4168903e0200..9fa4129c330a 100644
--- a/test/std/containers/unord/unord.set/equal_range_const.pass.cpp
+++ b/test/std/containers/unord/unord.set/equal_range_const.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(std::distance(r.first, r.second) == 1);
assert(*r.first == 50);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef C::const_iterator I;
diff --git a/test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp b/test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp
index 5a55083ba8ab..c6a42aceaaf2 100644
--- a/test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp
+++ b/test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(std::distance(r.first, r.second) == 1);
assert(*r.first == 50);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef C::iterator I;
diff --git a/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp b/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
index 4110953badb6..c78eb138fd90 100644
--- a/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
+++ b/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
@@ -51,7 +51,7 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
@@ -73,7 +73,7 @@ int main()
assert(c.count(4) == 1);
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/unord/unord.set/erase_key.pass.cpp b/test/std/containers/unord/unord.set/erase_key.pass.cpp
index ca165083b023..ea0323ba2dac 100644
--- a/test/std/containers/unord/unord.set/erase_key.pass.cpp
+++ b/test/std/containers/unord/unord.set/erase_key.pass.cpp
@@ -21,12 +21,12 @@
#include "min_allocator.h"
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
template <typename Unordered>
bool only_deletions ( const Unordered &whole, const Unordered &part ) {
typename Unordered::const_iterator w = whole.begin();
typename Unordered::const_iterator p = part.begin();
-
+
while ( w != whole.end () && p != part.end()) {
if ( *w == *p )
p++;
@@ -95,7 +95,7 @@ int main()
assert(c.erase(3) == 0);
assert(c.size() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
@@ -159,7 +159,7 @@ int main()
m.insert(i);
m2.insert(i);
}
-
+
C::iterator i = m2.begin();
int ctr = 0;
while (i != m2.end()) {
diff --git a/test/std/containers/unord/unord.set/erase_range.pass.cpp b/test/std/containers/unord/unord.set/erase_range.pass.cpp
index a8a900551c7b..4e49a86ef836 100644
--- a/test/std/containers/unord/unord.set/erase_range.pass.cpp
+++ b/test/std/containers/unord/unord.set/erase_range.pass.cpp
@@ -55,7 +55,7 @@ int main()
assert(c.size() == 0);
assert(k == c.end());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
diff --git a/test/std/containers/unord/unord.set/find_const.pass.cpp b/test/std/containers/unord/unord.set/find_const.pass.cpp
index e2238e5665f9..bd4542c876bf 100644
--- a/test/std/containers/unord/unord.set/find_const.pass.cpp
+++ b/test/std/containers/unord/unord.set/find_const.pass.cpp
@@ -42,7 +42,7 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
diff --git a/test/std/containers/unord/unord.set/find_non_const.pass.cpp b/test/std/containers/unord/unord.set/find_non_const.pass.cpp
index 8afe32abd72f..4c81fc60a393 100644
--- a/test/std/containers/unord/unord.set/find_non_const.pass.cpp
+++ b/test/std/containers/unord/unord.set/find_non_const.pass.cpp
@@ -42,7 +42,7 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
typedef int P;
diff --git a/test/std/containers/unord/unord.set/incomplete.pass.cpp b/test/std/containers/unord/unord.set/incomplete.pass.cpp
new file mode 100644
index 000000000000..c970c1de5531
--- /dev/null
+++ b/test/std/containers/unord/unord.set/incomplete.pass.cpp
@@ -0,0 +1,38 @@
+
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Check that std::unordered_set and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <unordered_set>
+
+template <class Tp>
+struct MyHash {
+ MyHash() {}
+ std::size_t operator()(Tp const&) const {return 42;}
+};
+
+struct A {
+ typedef std::unordered_set<A, MyHash<A> > Map;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+ Map::local_iterator lit;
+ Map::const_local_iterator clit;
+};
+
+inline bool operator==(A const& L, A const& R) { return &L == &R; }
+
+int main() {
+ A a;
+}
diff --git a/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp b/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp
new file mode 100644
index 000000000000..e85e94538e74
--- /dev/null
+++ b/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// class unordered_set
+
+// insert(...)
+// emplace(...)
+
+// UNSUPPORTED: c++98, c++03
+
+#include <unordered_set>
+
+#include "container_test_types.h"
+#include "../../set_allocator_requirement_test_templates.h"
+
+
+int main()
+{
+ testSetInsert<TCT::unordered_set<> >();
+ testSetEmplace<TCT::unordered_set<> >();
+}
diff --git a/test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp
index 321e9054af6c..fe45b98a33a6 100644
--- a/test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(*r.first == 5.5);
assert(r.second);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<double, std::hash<double>,
std::equal_to<double>, min_allocator<double>> C;
diff --git a/test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
index 1393f5420111..d3bbecc95ad7 100644
--- a/test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(c.size() == 3);
assert(*r == 5.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<double, std::hash<double>,
std::equal_to<double>, min_allocator<double>> C;
diff --git a/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
index 3f04dbb89984..da94bc55382f 100644
--- a/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
@@ -73,7 +73,7 @@ int main()
assert(*r == 5);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<double, std::hash<double>,
std::equal_to<double>, min_allocator<double>> C;
diff --git a/test/std/containers/unord/unord.set/insert_init.pass.cpp b/test/std/containers/unord/unord.set/insert_init.pass.cpp
index 2d8eafba4891..27b7290eb341 100644
--- a/test/std/containers/unord/unord.set/insert_init.pass.cpp
+++ b/test/std/containers/unord/unord.set/insert_init.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.set/insert_range.pass.cpp b/test/std/containers/unord/unord.set/insert_range.pass.cpp
index 72a83abf74e9..41b2c0e1431b 100644
--- a/test/std/containers/unord/unord.set/insert_range.pass.cpp
+++ b/test/std/containers/unord/unord.set/insert_range.pass.cpp
@@ -44,7 +44,7 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp
index e043579bf971..5d12f225cc6a 100644
--- a/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp
@@ -75,7 +75,7 @@ int main()
assert(r.second);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<double, std::hash<double>,
std::equal_to<double>, min_allocator<double>> C;
diff --git a/test/std/containers/unord/unord.set/iterators.pass.cpp b/test/std/containers/unord/unord.set/iterators.pass.cpp
index d3a45801f162..494411854977 100644
--- a/test/std/containers/unord/unord.set/iterators.pass.cpp
+++ b/test/std/containers/unord/unord.set/iterators.pass.cpp
@@ -65,7 +65,7 @@ int main()
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.set/load_factor.pass.cpp b/test/std/containers/unord/unord.set/load_factor.pass.cpp
index 3e56442d384c..a342d472a3d5 100644
--- a/test/std/containers/unord/unord.set/load_factor.pass.cpp
+++ b/test/std/containers/unord/unord.set/load_factor.pass.cpp
@@ -47,7 +47,7 @@ int main()
const C c;
assert(c.load_factor() == 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.set/local_iterators.pass.cpp b/test/std/containers/unord/unord.set/local_iterators.pass.cpp
index 2ffd93f30d19..55c80e4cb185 100644
--- a/test/std/containers/unord/unord.set/local_iterators.pass.cpp
+++ b/test/std/containers/unord/unord.set/local_iterators.pass.cpp
@@ -203,7 +203,7 @@ int main()
assert(std::distance(i, j) == 1);
assert(*i == 4);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.set/max_bucket_count.pass.cpp b/test/std/containers/unord/unord.set/max_bucket_count.pass.cpp
index 8b5e265de3f2..dab13ea5ae5f 100644
--- a/test/std/containers/unord/unord.set/max_bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.set/max_bucket_count.pass.cpp
@@ -27,7 +27,7 @@ int main()
const C c;
assert(c.max_bucket_count() > 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.set/max_load_factor.pass.cpp b/test/std/containers/unord/unord.set/max_load_factor.pass.cpp
index d326f4a2d7e2..542788cca967 100644
--- a/test/std/containers/unord/unord.set/max_load_factor.pass.cpp
+++ b/test/std/containers/unord/unord.set/max_load_factor.pass.cpp
@@ -41,7 +41,7 @@ int main()
c.max_load_factor(2.5);
assert(c.max_load_factor() == 2.5);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.set/max_size.pass.cpp b/test/std/containers/unord/unord.set/max_size.pass.cpp
index 1c6e74125c7d..3135ad994737 100644
--- a/test/std/containers/unord/unord.set/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.set/max_size.pass.cpp
@@ -26,7 +26,7 @@ int main()
std::unordered_set<int> u;
assert(u.max_size() > 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> u;
diff --git a/test/std/containers/unord/unord.set/rehash.pass.cpp b/test/std/containers/unord/unord.set/rehash.pass.cpp
index e28c25dc8197..a4d4d3fbf02c 100644
--- a/test/std/containers/unord/unord.set/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.set/rehash.pass.cpp
@@ -67,7 +67,7 @@ int main()
assert(c.bucket_count() == 31);
test(c);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.set/reserve.pass.cpp b/test/std/containers/unord/unord.set/reserve.pass.cpp
index 078b886b267e..4bd5332f0796 100644
--- a/test/std/containers/unord/unord.set/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.set/reserve.pass.cpp
@@ -73,7 +73,7 @@ int main()
assert(c.bucket_count() >= 16);
test(c);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int, std::hash<int>,
std::equal_to<int>, min_allocator<int>> C;
diff --git a/test/std/containers/unord/unord.set/swap_member.pass.cpp b/test/std/containers/unord/unord.set/swap_member.pass.cpp
index 89ec986d08f3..5ddb2d00daef 100644
--- a/test/std/containers/unord/unord.set/swap_member.pass.cpp
+++ b/test/std/containers/unord/unord.set/swap_member.pass.cpp
@@ -386,7 +386,7 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare;
diff --git a/test/std/containers/unord/unord.set/types.pass.cpp b/test/std/containers/unord/unord.set/types.pass.cpp
index 7e752a434ece..fdda2b8072e3 100644
--- a/test/std/containers/unord/unord.set/types.pass.cpp
+++ b/test/std/containers/unord/unord.set/types.pass.cpp
@@ -48,7 +48,7 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<short, std::hash<short>,
std::equal_to<short>, min_allocator<short>> C;
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
index 30905aeb9fe2..d0b03b2cd0b8 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
index 6925e3045412..05cb0525eb79 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
@@ -134,7 +134,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<int> A;
typedef std::unordered_set<int,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
index 69d19a4dac2e..a99e74af5943 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
@@ -59,7 +59,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<int> A;
typedef std::unordered_set<int,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
index e8712b7431c4..d8732268b85f 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
@@ -162,7 +162,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<int> A;
typedef std::unordered_set<int,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..6b675f00f16b
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Check that std::unordered_set fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <unordered_set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_set<int, std::hash<int>, Comp<int> > m;
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
index e1a9b27619b7..07278be79e57 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
@@ -105,7 +105,7 @@ int main()
assert(c.max_load_factor() == 1);
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
index b31875befa38..59f4bfabd582 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
@@ -65,7 +65,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
index 6efa9ed8d1de..e53f381f2d6d 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp
index f419c31c4796..3dcc3247902e 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp
@@ -17,9 +17,12 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
#include "../../../test_hash.h"
@@ -30,6 +33,7 @@ struct some_comp
typedef T value_type;
some_comp();
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -42,15 +46,14 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_set<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
@@ -66,5 +69,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
index 1e196b2e119e..b6837ccaec8d 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
@@ -11,19 +11,20 @@
// ~unordered_set() // implied noexcept;
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_set>
#include <cassert>
#include "MoveOnly.h"
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_comp
{
typedef T value_type;
~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -35,11 +36,8 @@ struct some_hash
~some_hash() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_set<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -63,5 +61,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..066f160a2586
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Check that std::unordered_set fails to instantiate if the hash function is
+// not copy-constructible. This is mentioned in LWG issue 2436
+
+#include <unordered_set>
+
+template <class T>
+struct Hash {
+ std::size_t operator () (const T& lhs) const { return 0; }
+
+ Hash () {}
+private:
+ Hash (const Hash &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_set<int, Hash<int> > m;
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
index 2c31d575b635..3fd0c3926c0b 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
@@ -57,7 +57,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
index 340fc410109a..b7eed1e5b253 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
@@ -60,7 +60,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
index fa6f0bd2ad5f..735babd522b3 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
@@ -62,7 +62,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
index dc3a6652ec25..643a57fa99ca 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
@@ -63,7 +63,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
index 1b006dbbc91c..72b9ed2a1de0 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -64,7 +64,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
index f2a2a68d4036..e865986337c4 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
@@ -103,7 +103,7 @@ int main()
assert(c0.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
index 92eb36d513b6..2342bbc130be 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
@@ -110,7 +110,7 @@ int main()
assert(c0.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int P;
typedef min_allocator<int> A;
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp
index 02af34d8f885..45f18dbbcb5c 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp
@@ -17,6 +17,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_set>
#include <cassert>
@@ -28,6 +30,7 @@ struct some_comp
{
typedef T value_type;
some_comp& operator=(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -41,7 +44,6 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_set<MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -65,5 +67,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
index b2d89ba5c33b..b4046148bc79 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
@@ -15,6 +15,8 @@
// This tests a conforming extension
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_set>
#include <cassert>
@@ -26,6 +28,7 @@ struct some_comp
{
typedef T value_type;
some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
@@ -38,7 +41,6 @@ struct some_hash
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_set<MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -62,5 +64,4 @@ int main()
some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
index 40f3f4f4d7f9..c978d8d5d8a4 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
@@ -60,7 +60,7 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
index ff50c712ab5d..b87d5615e00e 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
@@ -63,7 +63,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
index bcdcc5510c3c..7234d8a80aec 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
@@ -65,7 +65,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
index 632265ac861d..bcf3058aa835 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
@@ -66,7 +66,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
index ebe54fd4cbc6..ad9b414d7f13 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
index 8f6228ad8ec4..88e499773bf3 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
@@ -43,7 +43,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
index 4c2c18edd1ce..eb98dcc7b7e4 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
@@ -45,7 +45,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
index e9368782ad9a..4ae012038ae5 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
@@ -46,7 +46,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
index 96233e187af5..b2ddbe94e741 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
@@ -47,7 +47,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<NotConstructible,
test_hash<std::hash<NotConstructible> >,
diff --git a/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
index 5d746407a80c..d35d79b31266 100644
--- a/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_set>
// void swap(unordered_set& c)
@@ -26,6 +28,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -33,20 +36,20 @@ template <class T>
struct some_comp
{
typedef T value_type;
-
+
some_comp() {}
some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
struct some_comp2
{
typedef T value_type;
-
+
some_comp2() {}
some_comp2(const some_comp2&) {}
- void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -60,6 +63,7 @@ struct some_hash
typedef T value_type;
some_hash() {}
some_hash(const some_hash&);
+ std::size_t operator()(const T&) const { return 0; }
};
template <class T>
@@ -68,6 +72,7 @@ struct some_hash2
typedef T value_type;
some_hash2() {}
some_hash2(const some_hash2&);
+ std::size_t operator()(const T&) const { return 0; }
};
#if TEST_STD_VER >= 14
@@ -79,7 +84,7 @@ template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -91,7 +96,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -104,7 +109,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -115,7 +120,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::unordered_set<MoveOnly> C;
C c1, c2;
@@ -193,6 +197,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
index 7415e2977716..2755b5285027 100644
--- a/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
@@ -386,7 +386,7 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare;
diff --git a/test/std/depr/depr.c.headers/fenv_h.pass.cpp b/test/std/depr/depr.c.headers/fenv_h.pass.cpp
index f2fcf4914cfd..0da4c9d86b2d 100644
--- a/test/std/depr/depr.c.headers/fenv_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/fenv_h.pass.cpp
@@ -60,7 +60,7 @@
int main()
{
- fenv_t fenv = {0};
+ fenv_t fenv = {};
fexcept_t fex = 0;
static_assert((std::is_same<decltype(feclearexcept(0)), int>::value), "");
static_assert((std::is_same<decltype(fegetexceptflag(&fex, 0)), int>::value), "");
diff --git a/test/std/depr/depr.c.headers/inttypes_h.pass.cpp b/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
index 637cf72287b8..ff045a913fdb 100644
--- a/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
@@ -917,7 +917,7 @@ int main()
uintmax_t i4 = 0;
}
{
- imaxdiv_t i1 = {0};
+ imaxdiv_t i1 = {};
}
intmax_t i = 0;
static_assert((std::is_same<decltype(imaxabs(i)), intmax_t>::value), "");
diff --git a/test/std/depr/depr.c.headers/math_h.pass.cpp b/test/std/depr/depr.c.headers/math_h.pass.cpp
index ed12fcf73a8c..7e1b2d110642 100644
--- a/test/std/depr/depr.c.headers/math_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/math_h.pass.cpp
@@ -9,9 +9,6 @@
// <math.h>
-// NOTE: isinf and isnan are tested separately because they are expected to fail
-// on linux. We don't want their expected failure to hide other failures in this file.
-
#include <math.h>
#include <type_traits>
#include <cassert>
@@ -631,6 +628,29 @@ void test_isgreaterequal()
assert(isgreaterequal(-1.0, 0.F) == false);
}
+void test_isinf()
+{
+#ifdef isinf
+#error isinf defined
+#endif
+ static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");
+
+ typedef decltype(isinf((double)0)) DoubleRetType;
+#ifndef __linux__
+ static_assert((std::is_same<DoubleRetType, bool>::value), "");
+#else
+ // GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in
+ // all C++ dialects. The test should tolerate this.
+ // See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
+ static_assert((std::is_same<DoubleRetType, bool>::value
+ || std::is_same<DoubleRetType, int>::value), "");
+#endif
+
+ static_assert((std::is_same<decltype(isinf(0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");
+ assert(isinf(-1.0) == false);
+}
+
void test_isless()
{
#ifdef isless
@@ -688,6 +708,29 @@ void test_islessgreater()
assert(islessgreater(-1.0, 0.F) == true);
}
+void test_isnan()
+{
+#ifdef isnan
+#error isnan defined
+#endif
+ static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");
+
+ typedef decltype(isnan((double)0)) DoubleRetType;
+#ifndef __linux__
+ static_assert((std::is_same<DoubleRetType, bool>::value), "");
+#else
+ // GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in
+ // all C++ dialects. The test should tolerate this.
+ // See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
+ static_assert((std::is_same<DoubleRetType, bool>::value
+ || std::is_same<DoubleRetType, int>::value), "");
+#endif
+
+ static_assert((std::is_same<decltype(isnan(0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");
+ assert(isnan(-1.0) == false);
+}
+
void test_isunordered()
{
#ifdef isunordered
@@ -1443,9 +1486,11 @@ int main()
test_isnormal();
test_isgreater();
test_isgreaterequal();
+ test_isinf();
test_isless();
test_islessequal();
test_islessgreater();
+ test_isnan();
test_isunordered();
test_acosh();
test_asinh();
diff --git a/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp b/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp
deleted file mode 100644
index cc7eaac7de62..000000000000
--- a/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <math.h>
-
-// isinf
-
-// XFAIL: linux
-
-#include <math.h>
-#include <type_traits>
-#include <cassert>
-
-int main()
-{
-#ifdef isinf
-#error isinf defined
-#endif
- static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");
- static_assert((std::is_same<decltype(isinf((double)0)), bool>::value), "");
- static_assert((std::is_same<decltype(isinf(0)), bool>::value), "");
- static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");
- assert(isinf(-1.0) == false);
-}
diff --git a/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp b/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp
deleted file mode 100644
index 118f96bdd434..000000000000
--- a/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <math.h>
-
-// isnan
-
-// XFAIL: linux
-
-#include <math.h>
-#include <type_traits>
-#include <cassert>
-
-int main()
-{
-#ifdef isnan
-#error isnan defined
-#endif
- static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");
- static_assert((std::is_same<decltype(isnan((double)0)), bool>::value), "");
- static_assert((std::is_same<decltype(isnan(0)), bool>::value), "");
- static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");
- assert(isnan(-1.0) == false);
-}
diff --git a/test/std/depr/depr.c.headers/setjmp_h.pass.cpp b/test/std/depr/depr.c.headers/setjmp_h.pass.cpp
index 9bc35b747493..9663d8892ac5 100644
--- a/test/std/depr/depr.c.headers/setjmp_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/setjmp_h.pass.cpp
@@ -19,6 +19,7 @@
int main()
{
jmp_buf jb;
+ ((void)jb); // Prevent unused warning
static_assert((std::is_same<decltype(longjmp(jb, 0)), void>::value),
"std::is_same<decltype(longjmp(jb, 0)), void>::value");
}
diff --git a/test/std/depr/depr.c.headers/stdarg_h.pass.cpp b/test/std/depr/depr.c.headers/stdarg_h.pass.cpp
index f7d12b1ad551..e3c38801e4a8 100644
--- a/test/std/depr/depr.c.headers/stdarg_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stdarg_h.pass.cpp
@@ -11,11 +11,13 @@
#include <stdarg.h>
+#include "test_macros.h"
+
#ifndef va_arg
#error va_arg not defined
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
# ifndef va_copy
# error va_copy is not defined when c++ >= 11
# endif
diff --git a/test/std/depr/depr.c.headers/stdint_h.pass.cpp b/test/std/depr/depr.c.headers/stdint_h.pass.cpp
index 92bb04e558bb..3d49111fd82b 100644
--- a/test/std/depr/depr.c.headers/stdint_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stdint_h.pass.cpp
@@ -171,8 +171,8 @@ int main()
// INTN_MIN
static_assert(INT8_MIN == -128, "INT8_MIN == -128");
static_assert(INT16_MIN == -32768, "INT16_MIN == -32768");
- static_assert(INT32_MIN == -2147483648U, "INT32_MIN == -2147483648");
- static_assert(INT64_MIN == -9223372036854775808ULL, "INT64_MIN == -9223372036854775808LL");
+ static_assert(INT32_MIN == -2147483647 - 1, "INT32_MIN == -2147483648");
+ static_assert(INT64_MIN == -9223372036854775807LL - 1, "INT64_MIN == -9223372036854775808LL");
// INTN_MAX
static_assert(INT8_MAX == 127, "INT8_MAX == 127");
@@ -189,8 +189,8 @@ int main()
// INT_FASTN_MIN
static_assert(INT_FAST8_MIN <= -128, "INT_FAST8_MIN <= -128");
static_assert(INT_FAST16_MIN <= -32768, "INT_FAST16_MIN <= -32768");
- static_assert(INT_FAST32_MIN <= -2147483648U, "INT_FAST32_MIN <= -2147483648");
- static_assert(INT_FAST64_MIN <= -9223372036854775808ULL, "INT_FAST64_MIN <= -9223372036854775808LL");
+ static_assert(INT_FAST32_MIN <= -2147483647 - 1, "INT_FAST32_MIN <= -2147483648");
+ static_assert(INT_FAST64_MIN <= -9223372036854775807LL - 1, "INT_FAST64_MIN <= -9223372036854775808LL");
// INT_FASTN_MAX
static_assert(INT_FAST8_MAX >= 127, "INT_FAST8_MAX >= 127");
diff --git a/test/std/depr/depr.c.headers/stdio_h.pass.cpp b/test/std/depr/depr.c.headers/stdio_h.pass.cpp
index 3c5dd0ebf0e0..85f9d2986284 100644
--- a/test/std/depr/depr.c.headers/stdio_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stdio_h.pass.cpp
@@ -99,17 +99,25 @@
#include <cstdarg>
+#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wformat-zero-length"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // for tmpnam
+#endif
int main()
{
FILE* fp = 0;
- fpos_t fpos = {0};
- size_t s = 0; ((void)s);
+ fpos_t fpos = {};
+ size_t s = 0;
char* cp = 0;
char arr[] = {'a', 'b'};
va_list va;
+ ((void)fp); // Prevent unused warning
+ ((void)fpos); // Prevent unused warning
+ ((void)s); // Prevent unused warning
+ ((void)cp); // Prevent unused warning
+ ((void)arr); // Prevent unused warning
+ ((void)va); // Prevent unused warning
static_assert((std::is_same<decltype(remove("")), int>::value), "");
static_assert((std::is_same<decltype(rename("","")), int>::value), "");
static_assert((std::is_same<decltype(tmpfile()), FILE*>::value), "");
diff --git a/test/std/depr/depr.c.headers/string_h.pass.cpp b/test/std/depr/depr.c.headers/string_h.pass.cpp
index afc784f74b89..db0308b7ef82 100644
--- a/test/std/depr/depr.c.headers/string_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/string_h.pass.cpp
@@ -47,4 +47,15 @@ int main()
static_assert((std::is_same<decltype(memset(vp, 0, s)), void*>::value), "");
static_assert((std::is_same<decltype(strerror(0)), char*>::value), "");
static_assert((std::is_same<decltype(strlen(cpc)), size_t>::value), "");
+
+ // These tests fail on systems whose C library doesn't provide a correct overload
+ // set for strchr, strpbrk, strrchr, strstr, and memchr, unless the compiler is
+ // a suitably recent version of Clang.
+#if !defined(__APPLE__) || defined(_LIBCPP_PREFERRED_OVERLOAD)
+ static_assert((std::is_same<decltype(strchr(cpc, 0)), const char*>::value), "");
+ static_assert((std::is_same<decltype(strpbrk(cpc, cpc)), const char*>::value), "");
+ static_assert((std::is_same<decltype(strrchr(cpc, 0)), const char*>::value), "");
+ static_assert((std::is_same<decltype(strstr(cpc, cpc)), const char*>::value), "");
+ static_assert((std::is_same<decltype(memchr(vpc, 0, s)), const void*>::value), "");
+#endif
}
diff --git a/test/std/depr/depr.c.headers/time_h.pass.cpp b/test/std/depr/depr.c.headers/time_h.pass.cpp
index 0d229af409bd..a2639383cda7 100644
--- a/test/std/depr/depr.c.headers/time_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/time_h.pass.cpp
@@ -25,7 +25,7 @@ int main()
clock_t c = 0; ((void)c);
size_t s = 0;
time_t t = 0;
- tm tmv = {0};
+ tm tmv = {};
static_assert((std::is_same<decltype(clock()), clock_t>::value), "");
static_assert((std::is_same<decltype(difftime(t,t)), double>::value), "");
static_assert((std::is_same<decltype(mktime(&tmv)), time_t>::value), "");
diff --git a/test/std/depr/depr.c.headers/wchar_h.pass.cpp b/test/std/depr/depr.c.headers/wchar_h.pass.cpp
index e561b3e5a724..f2e42a328588 100644
--- a/test/std/depr/depr.c.headers/wchar_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/wchar_h.pass.cpp
@@ -9,8 +9,8 @@
// <wchar.h>
-
#include <wchar.h>
+#include <stdarg.h>
#include <type_traits>
#ifndef NULL
@@ -32,25 +32,25 @@
int main()
{
// mbstate_t comes from the underlying C library; it is defined (in C99) as:
-// a complete object type other than an array type that can hold the conversion
-// state information necessary to convert between sequences of multibyte
+// a complete object type other than an array type that can hold the conversion
+// state information necessary to convert between sequences of multibyte
// characters and wide characters
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wmissing-braces"
- mbstate_t mb = {0};
-#pragma clang diagnostic pop
-
+ mbstate_t mb = {};
size_t s = 0;
tm *tm = 0;
wint_t w = 0;
::FILE* fp = 0;
-#ifdef __APPLE__
- __darwin_va_list va;
-#else
- __builtin_va_list va;
-#endif
+ ::va_list va;
char* ns = 0;
wchar_t* ws = 0;
+ ((void)mb); // Prevent unused warning
+ ((void)s); // Prevent unused warning
+ ((void)tm); // Prevent unused warning
+ ((void)w); // Prevent unused warning
+ ((void)fp); // Prevent unused warning
+ ((void)va); // Prevent unused warning
+ ((void)ns); // Prevent unused warning
+ ((void)ws); // Prevent unused warning
static_assert((std::is_same<decltype(fwprintf(fp, L"")), int>::value), "");
static_assert((std::is_same<decltype(fwscanf(fp, L"")), int>::value), "");
static_assert((std::is_same<decltype(swprintf(ws, s, L"")), int>::value), "");
@@ -82,19 +82,14 @@ int main()
static_assert((std::is_same<decltype(wcscoll(L"", L"")), int>::value), "");
static_assert((std::is_same<decltype(wcsncmp(L"", L"", s)), int>::value), "");
static_assert((std::is_same<decltype(wcsxfrm(ws, L"", s)), size_t>::value), "");
- // const wchar_t* wcschr((const wchar_t*)0, L' ') - See below
static_assert((std::is_same<decltype(wcschr((wchar_t*)0, L' ')), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcscspn(L"", L"")), size_t>::value), "");
static_assert((std::is_same<decltype(wcslen(L"")), size_t>::value), "");
- // const wchar_t* wcspbrk((const wchar_t*)0, L"") - See below
static_assert((std::is_same<decltype(wcspbrk((wchar_t*)0, L"")), wchar_t*>::value), "");
- // const wchar_t* wcsrchr((const wchar_t*)0, L' ') - See below
static_assert((std::is_same<decltype(wcsrchr((wchar_t*)0, L' ')), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcsspn(L"", L"")), size_t>::value), "");
- // const wchar_t* wcsstr((const wchar_t*)0, L"") - See below
static_assert((std::is_same<decltype(wcsstr((wchar_t*)0, L"")), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcstok(ws, L"", (wchar_t**)0)), wchar_t*>::value), "");
- // const wchar_t* wmemchr((const wchar_t*)0, L' ', s) - See below
static_assert((std::is_same<decltype(wmemchr((wchar_t*)0, L' ', s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wmemcmp(L"", L"", s)), int>::value), "");
static_assert((std::is_same<decltype(wmemcpy(ws, L"", s)), wchar_t*>::value), "");
@@ -110,10 +105,10 @@ int main()
static_assert((std::is_same<decltype(mbsrtowcs(ws, (const char**)0, s, &mb)), size_t>::value), "");
static_assert((std::is_same<decltype(wcsrtombs(ns, (const wchar_t**)0, s, &mb)), size_t>::value), "");
-// This test fails on systems whose C library doesn't provide a correct overload
-// set for wcschr, wcspbrk, wcsrchr, wcsstr, and wmemchr. There's no way for
-// libc++ to fix that on the C library's behalf.
-#ifndef __APPLE__
+ // These tests fail on systems whose C library doesn't provide a correct overload
+ // set for wcschr, wcspbrk, wcsrchr, wcsstr, and wmemchr, unless the compiler is
+ // a suitably recent version of Clang.
+#if !defined(__APPLE__) || defined(_LIBCPP_PREFERRED_OVERLOAD)
static_assert((std::is_same<decltype(wcschr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcspbrk((const wchar_t*)0, L"")), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcsrchr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
diff --git a/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp.pass.cpp b/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp.pass.cpp
index 9911df715078..078d8911d8a6 100644
--- a/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp.pass.cpp
@@ -15,6 +15,7 @@
#include <strstream>
#include <cassert>
+#include <string>
int main()
{
diff --git a/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp_size.pass.cpp b/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp_size.pass.cpp
index a80095099401..8b4ae722f224 100644
--- a/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp_size.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/ccp_size.pass.cpp
@@ -15,6 +15,7 @@
#include <strstream>
#include <cassert>
+#include <string>
int main()
{
diff --git a/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp.pass.cpp b/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp.pass.cpp
index edd6c1f6286c..23068f5fd332 100644
--- a/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp.pass.cpp
@@ -15,6 +15,7 @@
#include <strstream>
#include <cassert>
+#include <string>
int main()
{
diff --git a/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp_size.pass.cpp b/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp_size.pass.cpp
index 5d01715ba1b7..ff797e092947 100644
--- a/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp_size.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.istrstream/depr.istrstream.cons/cp_size.pass.cpp
@@ -15,6 +15,7 @@
#include <strstream>
#include <cassert>
+#include <string>
int main()
{
diff --git a/test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/cp_size_mode.pass.cpp b/test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/cp_size_mode.pass.cpp
index 1ad0bfa8e269..b6519de8eddd 100644
--- a/test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/cp_size_mode.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/cp_size_mode.pass.cpp
@@ -15,6 +15,7 @@
#include <strstream>
#include <cassert>
+#include <string>
int main()
{
diff --git a/test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp b/test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
index 5ea4988ffa6f..29debf187c7e 100644
--- a/test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
@@ -15,6 +15,7 @@
#include <strstream>
#include <cassert>
+#include <string>
int main()
{
diff --git a/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/cp_size_mode.pass.cpp b/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/cp_size_mode.pass.cpp
index 2a4c0ec5aa20..1dc03b8aa806 100644
--- a/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/cp_size_mode.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/cp_size_mode.pass.cpp
@@ -15,6 +15,7 @@
#include <strstream>
#include <cassert>
+#include <string>
int main()
{
diff --git a/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp b/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
index 2ec5e7f748e1..6298fcac30a9 100644
--- a/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
@@ -15,6 +15,7 @@
#include <strstream>
#include <cassert>
+#include <string>
int main()
{
diff --git a/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp
index 12a1fb874c30..e466d50c64f6 100644
--- a/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp
@@ -18,7 +18,7 @@
int called = 0;
-void* my_alloc(std::size_t n)
+void* my_alloc(std::size_t)
{
static char buf[10000];
++called;
diff --git a/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp
new file mode 100644
index 000000000000..dda19a9517fb
--- /dev/null
+++ b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <strstream>
+
+// class strstreambuf
+
+// int overflow(int c);
+
+#include <iostream>
+#include <string>
+#include <strstream>
+
+int main() {
+ std::ostrstream oss;
+ std::string s;
+
+ for (int i = 0; i < 4096; ++i)
+ s.push_back((i % 16) + 'a');
+
+ oss << s << std::ends;
+ std::cout << oss.str();
+ oss.freeze(false);
+
+ return 0;
+}
diff --git a/test/std/depr/exception.unexpected/set.unexpected/get_unexpected.pass.cpp b/test/std/depr/exception.unexpected/set.unexpected/get_unexpected.pass.cpp
index 8b0a0b979de0..02f9a81aa6dd 100644
--- a/test/std/depr/exception.unexpected/set.unexpected/get_unexpected.pass.cpp
+++ b/test/std/depr/exception.unexpected/set.unexpected/get_unexpected.pass.cpp
@@ -23,7 +23,7 @@ void f3()
int main()
{
-
+
std::unexpected_handler old = std::get_unexpected();
// verify there is a previous unexpected handler
assert(old);
diff --git a/test/std/diagnostics/assertions/cassert.pass.cpp b/test/std/diagnostics/assertions/cassert.pass.cpp
index bed7a394ee4a..3f886e7b91fd 100644
--- a/test/std/diagnostics/assertions/cassert.pass.cpp
+++ b/test/std/diagnostics/assertions/cassert.pass.cpp
@@ -15,10 +15,6 @@
#error assert not defined
#endif
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
int main()
{
}
diff --git a/test/std/diagnostics/errno/cerrno.pass.cpp b/test/std/diagnostics/errno/cerrno.pass.cpp
index c6743fb79e7f..72c9371d16c4 100644
--- a/test/std/diagnostics/errno/cerrno.pass.cpp
+++ b/test/std/diagnostics/errno/cerrno.pass.cpp
@@ -12,10 +12,6 @@
#include <cerrno>
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
#ifndef E2BIG
#error E2BIG not defined
#endif
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp
index 0573ef862efd..f6a97ef92d84 100644
--- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <system_error>
// class error_category
@@ -18,23 +19,17 @@
#include <string>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
class test1
: public std::error_category
{
public:
constexpr test1() = default; // won't compile if error_category() is not constexpr
virtual const char* name() const noexcept {return nullptr;}
- virtual std::string message(int ev) const {return std::string();}
+ virtual std::string message(int) const {return std::string();}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
static_assert(std::is_nothrow_default_constructible<test1>::value,
"error_category() must exist and be noexcept");
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
index 972299936ddf..65ecc4921212 100644
--- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -16,10 +16,24 @@
#include <system_error>
#include <cassert>
#include <string>
+#include <cerrno>
+
+#include "test_macros.h"
+
+void test_message_for_bad_value() {
+ errno = E2BIG; // something that message will never generate
+ const std::error_category& e_cat1 = std::generic_category();
+ const std::string msg = e_cat1.message(-1);
+ LIBCPP_ASSERT(msg == "Unknown error -1");
+ assert(errno == E2BIG);
+}
int main()
{
const std::error_category& e_cat1 = std::generic_category();
std::string m1 = e_cat1.name();
assert(m1 == "generic");
+ {
+ test_message_for_bad_value();
+ }
}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
index b5cb18ad7653..d1a94883f925 100644
--- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -16,6 +16,17 @@
#include <system_error>
#include <cassert>
#include <string>
+#include <cerrno>
+
+#include "test_macros.h"
+
+void test_message_for_bad_value() {
+ errno = E2BIG; // something that message will never generate
+ const std::error_category& e_cat1 = std::system_category();
+ const std::string msg = e_cat1.message(-1);
+ LIBCPP_ASSERT(msg == "Unknown error -1");
+ assert(errno == E2BIG);
+}
int main()
{
@@ -26,4 +37,7 @@ int main()
e_cond = e_cat1.default_error_condition(5000);
assert(e_cond.value() == 5000);
assert(e_cond.category() == std::system_category());
+ {
+ test_message_for_bad_value();
+ }
}
diff --git a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
index b812e364bbc5..c8b3d98103c4 100644
--- a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
+++ b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
@@ -16,12 +16,12 @@
// size_t operator()(T val) const;
// };
-// Not very portable
-
#include <system_error>
#include <cassert>
#include <type_traits>
+#include "test_macros.h"
+
void
test(int i)
{
@@ -31,7 +31,9 @@ test(int i)
static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
H h;
T ec(i, std::system_category());
- assert(h(ec) == i);
+ const std::size_t result = h(ec);
+ LIBCPP_ASSERT(result == i);
+ ((void)result); // Prevent unused warning
}
int main()
diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
index 0f0784d6ee90..1a9f9b099b20 100644
--- a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
+++ b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
@@ -64,12 +64,12 @@ void test() {
end = std::experimental::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
SampleIterator(oa), os, g);
- assert(&*end - oa == std::min(os, is));
+ assert(end.base() - oa == std::min(os, is));
assert(std::equal(oa, oa + os, oa1));
end = std::experimental::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
SampleIterator(oa), os, g);
- assert(&*end - oa == std::min(os, is));
+ assert(end.base() - oa == std::min(os, is));
assert(std::equal(oa, oa + os, oa2));
}
@@ -85,7 +85,7 @@ void test_empty_population() {
SampleIterator end =
std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia),
SampleIterator(oa), os, g);
- assert(&*end == oa);
+ assert(end.base() == oa);
}
template <template<class> class PopulationIteratorType, class PopulationItem,
@@ -100,7 +100,7 @@ void test_empty_sample() {
SampleIterator end =
std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is),
SampleIterator(oa), 0, g);
- assert(&*end == oa);
+ assert(end.base() == oa);
}
template <template<class> class PopulationIteratorType, class PopulationItem,
@@ -119,8 +119,8 @@ void test_small_population() {
end = std::experimental::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
SampleIterator(oa), os, g);
- assert(&*end - oa == std::min(os, is));
- assert(std::equal(oa, &*end, oa1));
+ assert(end.base() - oa == std::min(os, is));
+ assert(std::equal(oa, end.base(), oa1));
}
int main() {
diff --git a/test/std/experimental/algorithms/alg.search/search.pass.cpp b/test/std/experimental/algorithms/alg.search/search.pass.cpp
index 60a44e4c26a2..81d220ba1aed 100644
--- a/test/std/experimental/algorithms/alg.search/search.pass.cpp
+++ b/test/std/experimental/algorithms/alg.search/search.pass.cpp
@@ -15,7 +15,7 @@
// ForwardIterator search(ForwardIterator first, ForwardIterator last,
// const Searcher& searcher);
//
-// returns searcher.operator(first, last)
+// returns searcher.operator(first, last).first
//
#include <experimental/algorithm>
@@ -27,10 +27,11 @@ int searcher_called = 0;
struct MySearcher {
template <typename Iterator>
- Iterator operator() ( Iterator b, Iterator /*e*/) const
+ std::pair<Iterator, Iterator>
+ operator() (Iterator b, Iterator e) const
{
++searcher_called;
- return b;
+ return std::make_pair(b, e);
}
};
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/bad_symlink b/test/std/experimental/filesystem/Inputs/static_test_env/bad_symlink
new file mode 120000
index 000000000000..76646beed5ed
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/bad_symlink
@@ -0,0 +1 @@
+dne \ No newline at end of file
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/afile3 b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/afile3
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/afile3
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/dir3/file5 b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/dir3/file5
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/dir3/file5
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/file4 b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/file4
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/file4
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/symlink_to_dir3 b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/symlink_to_dir3
new file mode 120000
index 000000000000..397913952621
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/symlink_to_dir3
@@ -0,0 +1 @@
+dir3 \ No newline at end of file
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/file1 b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/file1
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/file1
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/file2 b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/file2
new file mode 100644
index 000000000000..44834e586734
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/dir1/file2
@@ -0,0 +1 @@
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ No newline at end of file
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/empty_file b/test/std/experimental/filesystem/Inputs/static_test_env/empty_file
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/empty_file
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/non_empty_file b/test/std/experimental/filesystem/Inputs/static_test_env/non_empty_file
new file mode 100644
index 000000000000..44834e586734
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/non_empty_file
@@ -0,0 +1 @@
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ No newline at end of file
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_dir b/test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_dir
new file mode 120000
index 000000000000..df490f837a85
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_dir
@@ -0,0 +1 @@
+dir1 \ No newline at end of file
diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_empty_file b/test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_empty_file
new file mode 120000
index 000000000000..b79b689fc85a
--- /dev/null
+++ b/test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_empty_file
@@ -0,0 +1 @@
+empty_file \ No newline at end of file
diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp
new file mode 100644
index 000000000000..9a92f0698ba7
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_entry
+
+// directory_entry() noexcept = default;
+// directory_entry(const directory_entry&) = default;
+// directory_entry(directory_entry&&) noexcept = default;
+// explicit directory_entry(const path);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+namespace fs = std::experimental::filesystem;
+
+void test_default_ctor()
+{
+ using namespace fs;
+ // Default
+ {
+ static_assert(std::is_nothrow_default_constructible<directory_entry>::value,
+ "directory_entry must have a nothrow default constructor");
+ directory_entry e;
+ assert(e.path() == path());
+ }
+}
+
+
+void test_copy_ctor()
+{
+ using namespace fs;
+ // Copy
+ {
+ static_assert(std::is_copy_constructible<directory_entry>::value,
+ "directory_entry must be copy constructible");
+ static_assert(!std::is_nothrow_copy_constructible<directory_entry>::value,
+ "directory_entry's copy constructor cannot be noexcept");
+ const path p("foo/bar/baz");
+ const directory_entry e(p);
+ assert(e.path() == p);
+ directory_entry e2(e);
+ assert(e.path() == p);
+ assert(e2.path() == p);
+ }
+
+}
+
+void test_move_ctor()
+{
+ using namespace fs;
+ // Move
+ {
+ static_assert(std::is_nothrow_move_constructible<directory_entry>::value,
+ "directory_entry must be nothrow move constructible");
+ const path p("foo/bar/baz");
+ directory_entry e(p);
+ assert(e.path() == p);
+ directory_entry e2(std::move(e));
+ assert(e2.path() == p);
+ assert(e.path() != p); // Testing moved from state.
+ }
+}
+
+void test_path_ctor() {
+ using namespace fs;
+ {
+ static_assert(std::is_constructible<directory_entry, const path&>::value,
+ "directory_entry must be constructible from path");
+ static_assert(!std::is_nothrow_constructible<directory_entry, const path&>::value,
+ "directory_entry constructor should not be noexcept");
+ static_assert(!std::is_convertible<path const&, directory_entry>::value,
+ "directory_entry constructor should be explicit");
+ }
+ {
+ const path p("foo/bar/baz");
+ const directory_entry e(p);
+ assert(p == e.path());
+ }
+}
+
+int main() {
+ test_default_ctor();
+ test_copy_ctor();
+ test_move_ctor();
+ test_path_ctor();
+}
diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp
new file mode 100644
index 000000000000..97ecbefac42a
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods.pass.cpp
@@ -0,0 +1,113 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_entry
+
+// directory_entry& operator=(directory_entry const&) = default;
+// directory_entry& operator=(directory_entry&&) noexcept = default;
+// void assign(path const&);
+// void replace_filename(path const&);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+namespace fs = std::experimental::filesystem;
+
+void test_copy_assign_operator()
+{
+ using namespace fs;
+ // Copy
+ {
+ static_assert(std::is_copy_assignable<directory_entry>::value,
+ "directory_entry must be copy assignable");
+ static_assert(!std::is_nothrow_copy_assignable<directory_entry>::value,
+ "directory_entry's copy assignment cannot be noexcept");
+ const path p("foo/bar/baz");
+ const path p2("abc");
+ const directory_entry e(p);
+ directory_entry e2;
+ assert(e.path() == p && e2.path() == path());
+ e2 = e;
+ assert(e.path() == p && e2.path() == p);
+ directory_entry e3(p2);
+ e2 = e3;
+ assert(e2.path() == p2 && e3.path() == p2);
+ }
+}
+
+
+void test_move_assign_operator()
+{
+ using namespace fs;
+ // Copy
+ {
+ static_assert(std::is_nothrow_move_assignable<directory_entry>::value,
+ "directory_entry is noexcept move assignable");
+ const path p("foo/bar/baz");
+ const path p2("abc");
+ directory_entry e(p);
+ directory_entry e2(p2);
+ assert(e.path() == p && e2.path() == p2);
+ e2 = std::move(e);
+ assert(e2.path() == p);
+ assert(e.path() != p); // testing moved from state
+ }
+}
+
+void test_path_assign_method()
+{
+ using namespace fs;
+ const path p("foo/bar/baz");
+ const path p2("abc");
+ directory_entry e(p);
+ {
+ static_assert(std::is_same<decltype(e.assign(p)), void>::value,
+ "return type should be void");
+ static_assert(noexcept(e.assign(p)) == false, "operation must not be noexcept");
+ }
+ {
+ assert(e.path() == p);
+ e.assign(p2);
+ assert(e.path() == p2 && e.path() != p);
+ e.assign(p);
+ assert(e.path() == p && e.path() != p2);
+ }
+}
+
+void test_replace_filename_method()
+{
+ using namespace fs;
+ const path p("/path/to/foo.exe");
+ const path replace("bar.out");
+ const path expect("/path/to/bar.out");
+ directory_entry e(p);
+ {
+ static_assert(noexcept(e.replace_filename(replace)) == false,
+ "operation cannot be noexcept");
+ static_assert(std::is_same<decltype(e.replace_filename(replace)), void>::value,
+ "operation must return void");
+ }
+ {
+ assert(e.path() == p);
+ e.replace_filename(replace);
+ assert(e.path() == expect);
+ }
+}
+
+int main() {
+ test_copy_assign_operator();
+ test_move_assign_operator();
+ test_path_assign_method();
+ test_replace_filename_method();
+}
diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp
new file mode 100644
index 000000000000..96e509300229
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_entry
+
+// bool operator==(directory_entry const&) const noexcept;
+// bool operator!=(directory_entry const&) const noexcept;
+// bool operator< (directory_entry const&) const noexcept;
+// bool operator<=(directory_entry const&) const noexcept;
+// bool operator> (directory_entry const&) const noexcept;
+// bool operator>=(directory_entry const&) const noexcept;
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+namespace fs = std::experimental::filesystem;
+
+#define CHECK_OP(Op) \
+ static_assert(std::is_same<decltype(ce. operator Op (ce)), bool>::value, ""); \
+ static_assert(noexcept(ce.operator Op (ce)), "Operation must be noexcept" )
+
+void test_comparison_signatures() {
+ using namespace fs;
+ path const p("foo/bar/baz");
+ // Check that the operators are member functions with the correct signatures.
+ {
+ directory_entry const ce(p);
+ CHECK_OP(==);
+ CHECK_OP(!=);
+ CHECK_OP(< );
+ CHECK_OP(<=);
+ CHECK_OP(> );
+ CHECK_OP(>=);
+ }
+}
+#undef CHECK_OP
+
+// The actual semantics of the comparisons are testing via paths operators.
+void test_comparisons_simple() {
+ using namespace fs;
+ typedef std::pair<path, path> TestType;
+ TestType TestCases[] =
+ {
+ {"", ""},
+ {"", "a"},
+ {"a", "a"},
+ {"a", "b"},
+ {"foo/bar/baz", "foo/bar/baz/"}
+ };
+ auto TestFn = [](path const& LHS, const directory_entry& LHSE,
+ path const& RHS, const directory_entry& RHSE) {
+ assert((LHS == RHS) == (LHSE == RHSE));
+ assert((LHS != RHS) == (LHSE != RHSE));
+ assert((LHS < RHS) == (LHSE < RHSE));
+ assert((LHS <= RHS) == (LHSE <= RHSE));
+ assert((LHS > RHS) == (LHSE > RHSE));
+ assert((LHS >= RHS) == (LHSE >= RHSE));
+ };
+ for (auto const& TC : TestCases) {
+ const directory_entry L(TC.first);
+ const directory_entry R(TC.second);
+ TestFn(TC.first, L, TC.second, R);
+ TestFn(TC.second, R, TC.first, L);
+ }
+}
+
+int main() {
+ test_comparison_signatures();
+ test_comparisons_simple();
+}
diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp
new file mode 100644
index 000000000000..d228a3d92641
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_entry
+
+// const path& path() const noexcept;
+// operator const path&() const noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+namespace fs = std::experimental::filesystem;
+
+void test_path_method() {
+ using namespace fs;
+ const path p("foo/bar/baz.exe");
+ const path p2("abc");
+ {
+ directory_entry nce;
+ const directory_entry e("");
+ static_assert(std::is_same<decltype(e.path()), const path&>::value, "");
+ static_assert(std::is_same<decltype(nce.path()), const path&>::value, "");
+ static_assert(noexcept(e.path()) && noexcept(nce.path()), "");
+ }
+ {
+ directory_entry e(p);
+ path const& pref = e.path();
+ assert(pref == p);
+ assert(&pref == &e.path());
+ e.assign(p2);
+ assert(pref == p2);
+ assert(&pref == &e.path());
+ }
+}
+
+void test_path_conversion() {
+ using namespace fs;
+ const path p("foo/bar/baz.exe");
+ const path p2("abc");
+ {
+ directory_entry nce;
+ const directory_entry e("");
+ // Check conversions exist
+ static_assert(std::is_convertible<directory_entry&, path const&>::value, "");
+ static_assert(std::is_convertible<directory_entry const&, path const&>::value, "");
+ static_assert(std::is_convertible<directory_entry &&, path const&>::value, "");
+ static_assert(std::is_convertible<directory_entry const&&, path const&>::value, "");
+ // Not convertible to non-const
+ static_assert(!std::is_convertible<directory_entry&, path&>::value, "");
+ static_assert(!std::is_convertible<directory_entry const&, path&>::value, "");
+ static_assert(!std::is_convertible<directory_entry &&, path&>::value, "");
+ static_assert(!std::is_convertible<directory_entry const&&, path&>::value, "");
+ // conversions are noexcept
+ static_assert(noexcept(e.operator fs::path const&()) &&
+ noexcept(e.operator fs::path const&()), "");
+ }
+ // const
+ {
+ directory_entry const e(p);
+ path const& pref = e;
+ assert(&pref == &e.path());
+ }
+ // non-const
+ {
+ directory_entry e(p);
+ path const& pref = e;
+ assert(&pref == &e.path());
+
+ e.assign(p2);
+ assert(pref == p2);
+ assert(&pref == &e.path());
+ }
+}
+
+int main() {
+ test_path_method();
+ test_path_conversion();
+}
diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp
new file mode 100644
index 000000000000..54c5172ebce4
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_entry
+
+// file_status status() const;
+// file_status status(error_code const&) const noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "filesystem_test_helper.hpp"
+
+int main()
+{
+ using namespace fs;
+ {
+ const directory_entry e("foo");
+ std::error_code ec;
+ static_assert(std::is_same<decltype(e.status()), file_status>::value, "");
+ static_assert(std::is_same<decltype(e.status(ec)), file_status>::value, "");
+ static_assert(noexcept(e.status()) == false, "");
+ static_assert(noexcept(e.status(ec)) == true, "");
+ }
+ auto TestFn = [](path const& p) {
+ const directory_entry e(p);
+ std::error_code pec, eec;
+ file_status ps = fs::status(p, pec);
+ file_status es = e.status(eec);
+ assert(ps.type() == es.type());
+ assert(ps.permissions() == es.permissions());
+ assert(pec == eec);
+ };
+ {
+ TestFn(StaticEnv::File);
+ TestFn(StaticEnv::Dir);
+ TestFn(StaticEnv::SymlinkToFile);
+ TestFn(StaticEnv::DNE);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp
new file mode 100644
index 000000000000..3a99eb671b44
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_entry
+
+// file_status symlink_status() const;
+// file_status symlink_status(error_code&) const noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "filesystem_test_helper.hpp"
+
+int main() {
+ using namespace fs;
+ {
+ const directory_entry e("foo");
+ std::error_code ec;
+ static_assert(std::is_same<decltype(e.symlink_status()), file_status>::value, "");
+ static_assert(std::is_same<decltype(e.symlink_status(ec)), file_status>::value, "");
+ static_assert(noexcept(e.symlink_status()) == false, "");
+ static_assert(noexcept(e.symlink_status(ec)) == true, "");
+ }
+ auto TestFn = [](path const& p) {
+ const directory_entry e(p);
+ std::error_code pec, eec;
+ file_status ps = fs::symlink_status(p, pec);
+ file_status es = e.symlink_status(eec);
+ assert(ps.type() == es.type());
+ assert(ps.permissions() == es.permissions());
+ assert(pec == eec);
+ };
+ {
+ TestFn(StaticEnv::File);
+ TestFn(StaticEnv::Dir);
+ TestFn(StaticEnv::SymlinkToFile);
+ TestFn(StaticEnv::DNE);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp
new file mode 100644
index 000000000000..5c4583391e74
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+// directory_iterator(directory_iterator const&);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(directory_iterator_copy_construct_tests)
+
+TEST_CASE(test_constructor_signature)
+{
+ using D = directory_iterator;
+ static_assert(std::is_copy_constructible<D>::value, "");
+}
+
+TEST_CASE(test_copy_end_iterator)
+{
+ const directory_iterator endIt;
+ directory_iterator it(endIt);
+ TEST_CHECK(it == endIt);
+}
+
+TEST_CASE(test_copy_valid_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+ const directory_iterator endIt{};
+
+ const directory_iterator it(testDir);
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+
+ const directory_iterator it2(it);
+ TEST_REQUIRE(it2 == it);
+ TEST_CHECK(*it2 == entry);
+ TEST_CHECK(*it == entry);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp
new file mode 100644
index 000000000000..0d5ebf3ebe96
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+// directory_iterator& operator=(directory_iterator const&);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(directory_iterator_copy_assign_tests)
+
+TEST_CASE(test_assignment_signature)
+{
+ using D = directory_iterator;
+ static_assert(std::is_copy_assignable<D>::value, "");
+}
+
+TEST_CASE(test_copy_to_end_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+
+ const directory_iterator from(testDir);
+ TEST_REQUIRE(from != directory_iterator{});
+ const path entry = *from;
+
+ directory_iterator to{};
+ to = from;
+ TEST_REQUIRE(to == from);
+ TEST_CHECK(*to == entry);
+ TEST_CHECK(*from == entry);
+}
+
+
+TEST_CASE(test_copy_from_end_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+
+ const directory_iterator from{};
+
+ directory_iterator to(testDir);
+ TEST_REQUIRE(to != directory_iterator{});
+
+ to = from;
+ TEST_REQUIRE(to == from);
+ TEST_CHECK(to == directory_iterator{});
+}
+
+TEST_CASE(test_copy_valid_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+ const directory_iterator endIt{};
+
+ directory_iterator it_obj(testDir);
+ const directory_iterator& it = it_obj;
+ TEST_REQUIRE(it != endIt);
+ ++it_obj;
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+
+ directory_iterator it2(testDir);
+ TEST_REQUIRE(it2 != it);
+ const path entry2 = *it2;
+ TEST_CHECK(entry2 != entry);
+
+ it2 = it;
+ TEST_REQUIRE(it2 == it);
+ TEST_CHECK(*it2 == entry);
+}
+
+TEST_CASE(test_returns_reference_to_self)
+{
+ const directory_iterator it;
+ directory_iterator it2;
+ directory_iterator& ref = (it2 = it);
+ TEST_CHECK(&ref == &it2);
+}
+
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
new file mode 100644
index 000000000000..a6becb1bafaa
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
@@ -0,0 +1,246 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+// explicit directory_iterator(const path& p);
+// directory_iterator(const path& p, directory_options options);
+// directory_iterator(const path& p, error_code& ec) noexcept;
+// directory_iterator(const path& p, directory_options options, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(directory_iterator_constructor_tests)
+
+TEST_CASE(test_constructor_signatures)
+{
+ using D = directory_iterator;
+
+ // explicit directory_iterator(path const&);
+ static_assert(!std::is_convertible<path, D>::value, "");
+ static_assert(std::is_constructible<D, path>::value, "");
+ static_assert(!std::is_nothrow_constructible<D, path>::value, "");
+
+ // directory_iterator(path const&, error_code&) noexcept
+ static_assert(std::is_nothrow_constructible<D, path, std::error_code&>::value, "");
+
+ // directory_iterator(path const&, directory_options);
+ static_assert(std::is_constructible<D, path, directory_options>::value, "");
+ static_assert(!std::is_nothrow_constructible<D, path, directory_options>::value, "");
+
+ // directory_iterator(path const&, directory_options, error_code&) noexcept
+ static_assert(std::is_nothrow_constructible<D, path, directory_options, std::error_code&>::value, "");
+}
+
+TEST_CASE(test_construction_from_bad_path)
+{
+ std::error_code ec;
+ directory_options opts = directory_options::none;
+ const directory_iterator endIt;
+
+ const path testPaths[] = { StaticEnv::DNE, StaticEnv::BadSymlink };
+ for (path const& testPath : testPaths)
+ {
+ {
+ directory_iterator it(testPath, ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(it == endIt);
+ }
+ {
+ directory_iterator it(testPath, opts, ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(it == endIt);
+ }
+ {
+ TEST_CHECK_THROW(filesystem_error, directory_iterator(testPath));
+ TEST_CHECK_THROW(filesystem_error, directory_iterator(testPath, opts));
+ }
+ }
+}
+
+TEST_CASE(access_denied_test_case)
+{
+ using namespace std::experimental::filesystem;
+ scoped_test_env env;
+ path const testDir = env.make_env_path("dir1");
+ path const testFile = testDir / "testFile";
+ env.create_dir(testDir);
+ env.create_file(testFile, 42);
+
+ // Test that we can iterator over the directory before changing the perms
+ directory_iterator it(testDir);
+ TEST_REQUIRE(it != directory_iterator{});
+
+ // Change the permissions so we can no longer iterate
+ permissions(testDir, perms::none);
+
+ // Check that the construction fails when skip_permissions_denied is
+ // not given.
+ {
+ std::error_code ec;
+ directory_iterator it(testDir, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(it == directory_iterator{});
+ }
+ // Check that construction does not report an error when
+ // 'skip_permissions_denied' is given.
+ {
+ std::error_code ec;
+ directory_iterator it(testDir, directory_options::skip_permission_denied, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(it == directory_iterator{});
+ }
+}
+
+
+TEST_CASE(access_denied_to_file_test_case)
+{
+ using namespace std::experimental::filesystem;
+ scoped_test_env env;
+ path const testFile = env.make_env_path("file1");
+ env.create_file(testFile, 42);
+
+ // Change the permissions so we can no longer iterate
+ permissions(testFile, perms::none);
+
+ // Check that the construction fails when skip_permissions_denied is
+ // not given.
+ {
+ std::error_code ec;
+ directory_iterator it(testFile, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(it == directory_iterator{});
+ }
+ // Check that construction still fails when 'skip_permissions_denied' is given
+ // because we tried to open a file and not a directory.
+ {
+ std::error_code ec;
+ directory_iterator it(testFile, directory_options::skip_permission_denied, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(it == directory_iterator{});
+ }
+}
+
+TEST_CASE(test_open_on_empty_directory_equals_end)
+{
+ scoped_test_env env;
+ const path testDir = env.make_env_path("dir1");
+ env.create_dir(testDir);
+
+ const directory_iterator endIt;
+ {
+ std::error_code ec;
+ directory_iterator it(testDir, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(it == endIt);
+ }
+ {
+ directory_iterator it(testDir);
+ TEST_CHECK(it == endIt);
+ }
+}
+
+TEST_CASE(test_open_on_directory_succeeds)
+{
+ const path testDir = StaticEnv::Dir;
+ std::set<path> dir_contents(std::begin(StaticEnv::DirIterationList),
+ std::end( StaticEnv::DirIterationList));
+ const directory_iterator endIt{};
+
+ {
+ std::error_code ec;
+ directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(it != endIt);
+ TEST_CHECK(dir_contents.count(*it));
+ }
+ {
+ directory_iterator it(testDir);
+ TEST_CHECK(it != endIt);
+ TEST_CHECK(dir_contents.count(*it));
+ }
+}
+
+TEST_CASE(test_open_on_file_fails)
+{
+ const path testFile = StaticEnv::File;
+ const directory_iterator endIt{};
+ {
+ std::error_code ec;
+ directory_iterator it(testFile, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(it == endIt);
+ }
+ {
+ TEST_CHECK_THROW(filesystem_error, directory_iterator(testFile));
+ }
+}
+
+TEST_CASE(test_open_on_empty_string)
+{
+ const path testPath = "";
+ const directory_iterator endIt{};
+
+ std::error_code ec;
+ directory_iterator it(testPath, ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(it == endIt);
+}
+
+TEST_CASE(test_open_on_dot_dir)
+{
+ const path testPath = ".";
+
+ std::error_code ec;
+ directory_iterator it(testPath, ec);
+ TEST_CHECK(!ec);
+}
+
+TEST_CASE(test_open_on_symlink)
+{
+ const path symlinkToDir = StaticEnv::SymlinkToDir;
+ std::set<path> dir_contents;
+ for (path const& p : StaticEnv::DirIterationList) {
+ dir_contents.insert(p.filename());
+ }
+ const directory_iterator endIt{};
+
+ {
+ std::error_code ec;
+ directory_iterator it(symlinkToDir, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(it != endIt);
+ path const& entry = *it;
+ TEST_CHECK(dir_contents.count(entry.filename()));
+ }
+ {
+ std::error_code ec;
+ directory_iterator it(symlinkToDir,
+ directory_options::follow_directory_symlink, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(it != endIt);
+ path const& entry = *it;
+ TEST_CHECK(dir_contents.count(entry.filename()));
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp
new file mode 100644
index 000000000000..94ace185a6aa
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+// directory_iterator::directory_iterator() noexcept
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ {
+ static_assert(std::is_nothrow_default_constructible<fs::directory_iterator>::value, "");
+ }
+ {
+ fs::directory_iterator d1;
+ const fs::directory_iterator d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp
new file mode 100644
index 000000000000..589b4eca7efa
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp
@@ -0,0 +1,117 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+// directory_iterator& operator++();
+// directory_iterator& increment(error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+#include <iostream>
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(directory_iterator_increment_tests)
+
+TEST_CASE(test_increment_signatures)
+{
+ using D = directory_iterator;
+ directory_iterator d; ((void)d);
+ std::error_code ec; ((void)ec);
+
+ ASSERT_SAME_TYPE(decltype(++d), directory_iterator&);
+ ASSERT_NOT_NOEXCEPT(++d);
+
+ ASSERT_SAME_TYPE(decltype(d.increment(ec)), directory_iterator&);
+ ASSERT_NOEXCEPT(d.increment(ec));
+}
+
+TEST_CASE(test_prefix_increment)
+{
+ const path testDir = StaticEnv::Dir;
+ const std::set<path> dir_contents(std::begin(StaticEnv::DirIterationList),
+ std::end( StaticEnv::DirIterationList));
+ const directory_iterator endIt{};
+
+ std::error_code ec;
+ directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+
+ std::set<path> unseen_entries = dir_contents;
+ while (!unseen_entries.empty()) {
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+ TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+ directory_iterator& it_ref = ++it;
+ TEST_CHECK(&it_ref == &it);
+ }
+
+ TEST_CHECK(it == endIt);
+}
+
+TEST_CASE(test_postfix_increment)
+{
+ const path testDir = StaticEnv::Dir;
+ const std::set<path> dir_contents(std::begin(StaticEnv::DirIterationList),
+ std::end( StaticEnv::DirIterationList));
+ const directory_iterator endIt{};
+
+ std::error_code ec;
+ directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+
+ std::set<path> unseen_entries = dir_contents;
+ while (!unseen_entries.empty()) {
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+ TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+ const path entry2 = *it++;
+ TEST_CHECK(entry2 == entry);
+ }
+
+ TEST_CHECK(it == endIt);
+}
+
+
+TEST_CASE(test_increment_method)
+{
+ const path testDir = StaticEnv::Dir;
+ const std::set<path> dir_contents(std::begin(StaticEnv::DirIterationList),
+ std::end( StaticEnv::DirIterationList));
+ const directory_iterator endIt{};
+
+ std::error_code ec;
+ directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+
+ std::set<path> unseen_entries = dir_contents;
+ while (!unseen_entries.empty()) {
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+ TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+ directory_iterator& it_ref = it.increment(ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(&it_ref == &it);
+ }
+
+ TEST_CHECK(it == endIt);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp
new file mode 100644
index 000000000000..f6c94e18eb0e
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+// directory_iterator(directory_iterator&&) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(directory_iterator_move_construct_tests)
+
+TEST_CASE(test_constructor_signature)
+{
+ using D = directory_iterator;
+ static_assert(std::is_nothrow_move_constructible<D>::value, "");
+}
+
+TEST_CASE(test_move_end_iterator)
+{
+ const directory_iterator endIt;
+ directory_iterator endIt2{};
+
+ directory_iterator it(std::move(endIt2));
+ TEST_CHECK(it == endIt);
+ TEST_CHECK(endIt2 == endIt);
+}
+
+TEST_CASE(test_move_valid_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+ const directory_iterator endIt{};
+
+ directory_iterator it(testDir);
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+
+ const directory_iterator it2(std::move(it));
+ TEST_CHECK(*it2 == entry);
+
+ TEST_CHECK(it == it2 || it == endIt);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
new file mode 100644
index 000000000000..445f05a3c3e1
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+// directory_iterator& operator=(directory_iterator const&);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+// The filesystem specification explicitly allows for self-move on
+// the directory iterators. Turn off this warning so we can test it.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wself-move"
+#endif
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(directory_iterator_move_assign_tests)
+
+TEST_CASE(test_assignment_signature)
+{
+ using D = directory_iterator;
+ static_assert(std::is_nothrow_move_assignable<D>::value, "");
+}
+
+TEST_CASE(test_move_to_end_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+
+ directory_iterator from(testDir);
+ TEST_REQUIRE(from != directory_iterator{});
+ const path entry = *from;
+
+ directory_iterator to{};
+ to = std::move(from);
+ TEST_REQUIRE(to != directory_iterator{});
+ TEST_CHECK(*to == entry);
+}
+
+
+TEST_CASE(test_move_from_end_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+
+ directory_iterator from{};
+
+ directory_iterator to(testDir);
+ TEST_REQUIRE(to != from);
+
+ to = std::move(from);
+ TEST_REQUIRE(to == directory_iterator{});
+ TEST_REQUIRE(from == directory_iterator{});
+}
+
+TEST_CASE(test_move_valid_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+ const directory_iterator endIt{};
+
+ directory_iterator it(testDir);
+ TEST_REQUIRE(it != endIt);
+ ++it;
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+
+ directory_iterator it2(testDir);
+ TEST_REQUIRE(it2 != it);
+ const path entry2 = *it2;
+ TEST_CHECK(entry2 != entry);
+
+ it2 = std::move(it);
+ TEST_REQUIRE(it2 != directory_iterator{});
+ TEST_CHECK(*it2 == entry);
+}
+
+TEST_CASE(test_returns_reference_to_self)
+{
+ directory_iterator it;
+ directory_iterator it2;
+ directory_iterator& ref = (it2 = it);
+ TEST_CHECK(&ref == &it2);
+}
+
+
+TEST_CASE(test_self_move)
+{
+ // Create two non-equal iterators that have exactly the same state.
+ directory_iterator it(StaticEnv::Dir);
+ directory_iterator it2(StaticEnv::Dir);
+ ++it; ++it2;
+ TEST_CHECK(it != it2);
+ TEST_CHECK(*it2 == *it);
+
+ it = std::move(it);
+ TEST_CHECK(*it2 == *it);
+}
+
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
new file mode 100644
index 000000000000..f93a18452189
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+// directory_iterator begin(directory_iterator iter) noexcept;
+// directory_iterator end(directory_iterator iter) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+#include <iostream>
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(directory_iterator_begin_end_tests)
+
+TEST_CASE(test_function_signatures)
+{
+ using D = directory_iterator;
+ directory_iterator d; ((void)d);
+
+ ASSERT_SAME_TYPE(decltype(begin(d)), directory_iterator);
+ ASSERT_NOEXCEPT(begin(std::move(d)));
+
+ ASSERT_SAME_TYPE(decltype(end(d)), directory_iterator);
+ ASSERT_NOEXCEPT(end(std::move(d)));
+}
+
+TEST_CASE(test_ranged_for_loop)
+{
+ const path testDir = StaticEnv::Dir;
+ std::set<path> dir_contents(std::begin(StaticEnv::DirIterationList),
+ std::end( StaticEnv::DirIterationList));
+
+ std::error_code ec;
+ directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+
+ for (auto& elem : it) {
+ TEST_CHECK(dir_contents.erase(elem) == 1);
+ }
+ TEST_CHECK(dir_contents.empty());
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp
new file mode 100644
index 000000000000..dad278f43d79
--- /dev/null
+++ b/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+// typedef ... value_type;
+// typedef ... difference_type;
+// typedef ... pointer;
+// typedef ... reference;
+// typedef ... iterator_category
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ using D = directory_iterator;
+ ASSERT_SAME_TYPE(D::value_type, directory_entry);
+ ASSERT_SAME_TYPE(D::difference_type, std::ptrdiff_t);
+ ASSERT_SAME_TYPE(D::pointer, const directory_entry*);
+ ASSERT_SAME_TYPE(D::reference, const directory_entry&);
+ ASSERT_SAME_TYPE(D::iterator_category, std::input_iterator_tag);
+}
diff --git a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp
new file mode 100644
index 000000000000..585b0bb1dd5e
--- /dev/null
+++ b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class file_status
+
+// explicit file_status() noexcept;
+// explicit file_status(file_type, perms prms = perms::unknown) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_convertible.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ // Default ctor
+ {
+ static_assert(std::is_nothrow_default_constructible<file_status>::value,
+ "The default constructor must be noexcept");
+ static_assert(!test_convertible<file_status>(),
+ "The default constructor must be explicit");
+ const file_status f;
+ assert(f.type() == file_type::none);
+ assert(f.permissions() == perms::unknown);
+ }
+
+ // Unary ctor
+ {
+ static_assert(std::is_nothrow_constructible<file_status, file_type>::value,
+ "This constructor must be noexcept");
+ static_assert(!test_convertible<file_status, file_type>(),
+ "This constructor must be explicit");
+
+ const file_status f(file_type::not_found);
+ assert(f.type() == file_type::not_found);
+ assert(f.permissions() == perms::unknown);
+ }
+ // Binary ctor
+ {
+ static_assert(std::is_nothrow_constructible<file_status, file_type, perms>::value,
+ "This constructor must be noexcept");
+ static_assert(!test_convertible<file_status, file_type, perms>(),
+ "This constructor must b explicit");
+ const file_status f(file_type::regular, perms::owner_read);
+ assert(f.type() == file_type::regular);
+ assert(f.permissions() == perms::owner_read);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp
new file mode 100644
index 000000000000..8681b2dc50d6
--- /dev/null
+++ b/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class file_status
+
+// void type(file_type) noexcept;
+// void permissions(perms) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+
+ file_status st;
+
+ // type test
+ {
+ static_assert(noexcept(st.type(file_type::regular)),
+ "operation must be noexcept");
+ static_assert(std::is_same<decltype(st.type(file_type::regular)), void>::value,
+ "operation must return void");
+ assert(st.type() != file_type::regular);
+ st.type(file_type::regular);
+ assert(st.type() == file_type::regular);
+ }
+ // permissions test
+ {
+ static_assert(noexcept(st.permissions(perms::owner_read)),
+ "operation must be noexcept");
+ static_assert(std::is_same<decltype(st.permissions(perms::owner_read)), void>::value,
+ "operation must return void");
+ assert(st.permissions() != perms::owner_read);
+ st.permissions(perms::owner_read);
+ assert(st.permissions() == perms::owner_read);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp
new file mode 100644
index 000000000000..4113dee453dc
--- /dev/null
+++ b/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class file_status
+
+// file_type type() const noexcept;
+// perms permissions(p) const noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+
+ const file_status st(file_type::regular, perms::owner_read);
+
+ // type test
+ {
+ static_assert(noexcept(st.type()),
+ "operation must be noexcept");
+ static_assert(std::is_same<decltype(st.type()), file_type>::value,
+ "operation must return file_type");
+ assert(st.type() == file_type::regular);
+ }
+ // permissions test
+ {
+ static_assert(noexcept(st.permissions()),
+ "operation must be noexcept");
+ static_assert(std::is_same<decltype(st.permissions()), perms>::value,
+ "operation must return perms");
+ assert(st.permissions() == perms::owner_read);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp b/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp
new file mode 100644
index 000000000000..68b67ed72803
--- /dev/null
+++ b/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp
@@ -0,0 +1,103 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class filesystem_error
+
+// filesystem_error(const string& what_arg, error_code ec);
+// filesystem_error(const string& what_arg, const path& p1, error_code ec);
+// filesystem_error(const string& what_arg, const path& p1, const path& p2, error_code ec);
+// const std::error_code& code() const;
+// const char* what() const noexcept;
+// const path& path1() const noexcept;
+// const path& path2() const noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace fs = std::experimental::filesystem;
+
+void test_constructors() {
+ using namespace fs;
+
+ // The string returned by "filesystem_error::what() must contain runtime_error::what()
+ const std::string what_arg = "Hello World";
+ const std::string what_contains = std::runtime_error(what_arg).what();
+ assert(what_contains.find(what_arg) != std::string::npos);
+ auto CheckWhat = [what_contains](filesystem_error const& e) {
+ std::string s = e.what();
+ assert(s.find(what_contains) != std::string::npos);
+ };
+
+ std::error_code ec = std::make_error_code(std::errc::file_exists);
+ const path p1("foo");
+ const path p2("bar");
+
+ // filesystem_error(const string& what_arg, error_code ec);
+ {
+ ASSERT_NOT_NOEXCEPT(filesystem_error(what_arg, ec));
+ filesystem_error e(what_arg, ec);
+ CheckWhat(e);
+ assert(e.code() == ec);
+ assert(e.path1().empty() && e.path2().empty());
+ }
+ // filesystem_error(const string& what_arg, const path&, error_code ec);
+ {
+ ASSERT_NOT_NOEXCEPT(filesystem_error(what_arg, p1, ec));
+ filesystem_error e(what_arg, p1, ec);
+ CheckWhat(e);
+ assert(e.code() == ec);
+ assert(e.path1() == p1);
+ assert(e.path2().empty());
+ }
+ // filesystem_error(const string& what_arg, const path&, const path&, error_code ec);
+ {
+ ASSERT_NOT_NOEXCEPT(filesystem_error(what_arg, p1, p2, ec));
+ filesystem_error e(what_arg, p1, p2, ec);
+ CheckWhat(e);
+ assert(e.code() == ec);
+ assert(e.path1() == p1);
+ assert(e.path2() == p2);
+ }
+}
+
+void test_signatures()
+{
+ using namespace fs;
+ const path p;
+ std::error_code ec;
+ const filesystem_error e("lala", ec);
+ // const path& path1() const noexcept;
+ {
+ ASSERT_SAME_TYPE(path const&, decltype(e.path1()));
+ ASSERT_NOEXCEPT(e.path1());
+ }
+ // const path& path2() const noexcept
+ {
+ ASSERT_SAME_TYPE(path const&, decltype(e.path2()));
+ ASSERT_NOEXCEPT(e.path2());
+ }
+ // const char* what() const noexcept
+ {
+ ASSERT_SAME_TYPE(const char*, decltype(e.what()));
+ ASSERT_NOEXCEPT(e.what());
+ }
+}
+
+int main() {
+ static_assert(std::is_base_of<std::system_error, fs::filesystem_error>::value, "");
+ test_constructors();
+ test_signatures();
+}
diff --git a/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp b/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
new file mode 100644
index 000000000000..12330ebb5ca8
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// template <class Source>
+// path(const Source& source);
+// template <class InputIterator>
+// path(InputIterator first, InputIterator last);
+
+
+#include <experimental/filesystem>
+#include <iterator>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+
+template <class It>
+std::reverse_iterator<It> mkRev(It it) {
+ return std::reverse_iterator<It>(it);
+}
+
+void checkIteratorConcepts() {
+ using namespace fs;
+ using It = path::iterator;
+ using Traits = std::iterator_traits<It>;
+ ASSERT_SAME_TYPE(Traits::iterator_category, std::bidirectional_iterator_tag);
+ ASSERT_SAME_TYPE(Traits::value_type, path);
+ ASSERT_SAME_TYPE(Traits::pointer, path const*);
+ ASSERT_SAME_TYPE(Traits::reference, path const&);
+ {
+ It it;
+ ASSERT_SAME_TYPE(It&, decltype(++it));
+ ASSERT_SAME_TYPE(It, decltype(it++));
+ ASSERT_SAME_TYPE(It&, decltype(--it));
+ ASSERT_SAME_TYPE(It, decltype(it--));
+ ASSERT_SAME_TYPE(Traits::reference, decltype(*it));
+ ASSERT_SAME_TYPE(Traits::pointer, decltype(it.operator->()));
+ ASSERT_SAME_TYPE(std::string const&, decltype(it->native()));
+ ASSERT_SAME_TYPE(bool, decltype(it == it));
+ ASSERT_SAME_TYPE(bool, decltype(it != it));
+ }
+ {
+ path const p;
+ ASSERT_SAME_TYPE(It, decltype(p.begin()));
+ ASSERT_SAME_TYPE(It, decltype(p.end()));
+ assert(p.begin() == p.end());
+ }
+}
+
+void checkBeginEndBasic() {
+ using namespace fs;
+ using It = path::iterator;
+ {
+ path const p;
+ ASSERT_SAME_TYPE(It, decltype(p.begin()));
+ ASSERT_SAME_TYPE(It, decltype(p.end()));
+ assert(p.begin() == p.end());
+ }
+ {
+ path const p("foo");
+ It default_constructed;
+ default_constructed = p.begin();
+ assert(default_constructed == p.begin());
+ assert(default_constructed != p.end());
+ default_constructed = p.end();
+ assert(default_constructed == p.end());
+ assert(default_constructed != p.begin());
+ }
+ {
+ path p("//root_name//first_dir////second_dir");
+ const path expect[] = {"//root_name", "/", "first_dir", "second_dir"};
+ assert(checkCollectionsEqual(p.begin(), p.end(), std::begin(expect), std::end(expect)));
+ assert(checkCollectionsEqualBackwards(p.begin(), p.end(), std::begin(expect), std::end(expect)));
+
+ }
+ {
+ path p("////foo/bar/baz///");
+ const path expect[] = {"/", "foo", "bar", "baz", "."};
+ assert(checkCollectionsEqual(p.begin(), p.end(), std::begin(expect), std::end(expect)));
+ assert(checkCollectionsEqualBackwards(p.begin(), p.end(), std::begin(expect), std::end(expect)));
+
+ }
+
+}
+
+int main() {
+ using namespace fs;
+ checkIteratorConcepts();
+ checkBeginEndBasic(); // See path.decompose.pass.cpp for more tests.
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp
new file mode 100644
index 000000000000..1118497e06a8
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp
@@ -0,0 +1,241 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path& operator/=(path const&)
+// template <class Source>
+// path& operator/=(Source const&);
+// template <class Source>
+// path& append(Source const&);
+// template <class InputIterator>
+// path& append(InputIterator first, InputIterator last);
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+struct AppendOperatorTestcase {
+ MultiStringType lhs;
+ MultiStringType rhs;
+ MultiStringType expect;
+};
+
+#define S(Str) MKSTR(Str)
+const AppendOperatorTestcase Cases[] =
+ {
+ {S(""), S(""), S("")}
+ , {S("p1"), S("p2"), S("p1/p2")}
+ , {S("p1/"), S("p2"), S("p1/p2")}
+ , {S("p1"), S("/p2"), S("p1/p2")}
+ , {S("p1/"), S("/p2"), S("p1//p2")}
+ , {S("p1"), S("\\p2"), S("p1/\\p2")}
+ , {S("p1\\"), S("p2"), S("p1\\/p2")}
+ , {S("p1\\"), S("\\p2"), S("p1\\/\\p2")}
+ , {S("p1"), S(""), S("p1")}
+ , {S(""), S("p2"), S("p2")}
+ };
+
+
+const AppendOperatorTestcase LongLHSCases[] =
+ {
+ {S("p1"), S("p2"), S("p1/p2")}
+ , {S("p1/"), S("p2"), S("p1/p2")}
+ , {S("p1"), S("/p2"), S("p1/p2")}
+ };
+#undef S
+
+
+// The append operator may need to allocate a temporary buffer before a code_cvt
+// conversion. Test if this allocation occurs by:
+// 1. Create a path, `LHS`, and reserve enough space to append `RHS`.
+// This prevents `LHS` from allocating during the actual appending.
+// 2. Create a `Source` object `RHS`, which represents a "large" string.
+// (The string must not trigger the SSO)
+// 3. Append `RHS` to `LHS` and check for the expected allocation behavior.
+template <class CharT>
+void doAppendSourceAllocTest(AppendOperatorTestcase const& TC)
+{
+ using namespace fs;
+ using Ptr = CharT const*;
+ using Str = std::basic_string<CharT>;
+ using InputIter = input_iterator<Ptr>;
+
+ const Ptr L = TC.lhs;
+ Str RShort = (Ptr)TC.rhs;
+ Str EShort = (Ptr)TC.expect;
+ assert(RShort.size() >= 2);
+ CharT c = RShort.back();
+ RShort.append(100, c);
+ EShort.append(100, c);
+ const Ptr R = RShort.data();
+ const Str& E = EShort;
+ std::size_t ReserveSize = E.size() + 3;
+ // basic_string
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ Str RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS /= RHS;
+ }
+ assert(LHS == E);
+ }
+ // CharT*
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ Ptr RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS /= RHS;
+ }
+ assert(LHS == E);
+ }
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ Ptr RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS.append(RHS, StrEnd(RHS));
+ }
+ assert(LHS == E);
+ }
+ // input iterator - For non-native char types, appends needs to copy the
+ // iterator range into a contigious block of memory before it can perform the
+ // code_cvt conversions.
+ // For "char" no allocations will be performed because no conversion is
+ // required.
+ bool DisableAllocations = std::is_same<CharT, char>::value;
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ InputIter RHS(R);
+ {
+ RequireAllocationGuard g; // requires 1 or more allocations occur by default
+ if (DisableAllocations) g.requireExactly(0);
+ LHS /= RHS;
+ }
+ assert(LHS == E);
+ }
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ InputIter RHS(R);
+ InputIter REnd(StrEnd(R));
+ {
+ RequireAllocationGuard g;
+ if (DisableAllocations) g.requireExactly(0);
+ LHS.append(RHS, REnd);
+ }
+ assert(LHS == E);
+ }
+}
+
+template <class CharT>
+void doAppendSourceTest(AppendOperatorTestcase const& TC)
+{
+ using namespace fs;
+ using Ptr = CharT const*;
+ using Str = std::basic_string<CharT>;
+ using InputIter = input_iterator<Ptr>;
+ const Ptr L = TC.lhs;
+ const Ptr R = TC.rhs;
+ const Ptr E = TC.expect;
+ // basic_string
+ {
+ path LHS(L);
+ Str RHS(R);
+ path& Ref = (LHS /= RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ Str RHS(R);
+ path& Ref = LHS.append(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ // Char*
+ {
+ path LHS(L);
+ Str RHS(R);
+ path& Ref = (LHS /= RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ Ptr RHS(R);
+ path& Ref = LHS.append(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ Ptr RHS(R);
+ path& Ref = LHS.append(RHS, StrEnd(RHS));
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ // iterators
+ {
+ path LHS(L);
+ InputIter RHS(R);
+ path& Ref = (LHS /= RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L); InputIter RHS(R);
+ path& Ref = LHS.append(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ InputIter RHS(R);
+ InputIter REnd(StrEnd(R));
+ path& Ref = LHS.append(RHS, REnd);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+}
+
+int main()
+{
+ using namespace fs;
+ for (auto const & TC : Cases) {
+ {
+ path LHS((const char*)TC.lhs);
+ path RHS((const char*)TC.rhs);
+ path& Ref = (LHS /= RHS);
+ assert(LHS == (const char*)TC.expect);
+ assert(&Ref == &LHS);
+ }
+ doAppendSourceTest<char> (TC);
+ doAppendSourceTest<wchar_t> (TC);
+ doAppendSourceTest<char16_t>(TC);
+ doAppendSourceTest<char32_t>(TC);
+ }
+ for (auto const & TC : LongLHSCases) {
+ doAppendSourceAllocTest<char>(TC);
+ doAppendSourceAllocTest<wchar_t>(TC);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp
new file mode 100644
index 000000000000..5c26f8464c12
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path& operator=(path const&);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ static_assert(std::is_copy_assignable<path>::value, "");
+ static_assert(!std::is_nothrow_copy_assignable<path>::value, "should not be noexcept");
+ const std::string s("foo");
+ const path p(s);
+ path p2;
+ path& pref = (p2 = p);
+ assert(p.native() == s);
+ assert(p2.native() == s);
+ assert(&pref == &p2);
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp
new file mode 100644
index 000000000000..7263424ad252
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path& operator=(path&&) noexcept
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "count_new.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ static_assert(std::is_nothrow_move_assignable<path>::value, "");
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ const std::string s("we really really really really really really really "
+ "really really long string so that we allocate");
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ path p(s);
+ {
+ DisableAllocationGuard g;
+ path p2;
+ path& pref = (p2 = std::move(p));
+ assert(p2.native() == s);
+ assert(p.native() != s); // Testing moved from state
+ assert(&pref == &p2);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp
new file mode 100644
index 000000000000..4c2d5112d10b
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp
@@ -0,0 +1,153 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// template <class Source>
+// path& operator=(Source const&);
+// template <class Source>
+// path& assign(Source const&);
+// template <class InputIterator>
+// path& assign(InputIterator first, InputIterator last);
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+#include <iostream>
+
+namespace fs = std::experimental::filesystem;
+
+template <class CharT>
+void RunTestCase(MultiStringType const& MS) {
+ using namespace fs;
+ const char* Expect = MS;
+ const CharT* TestPath = MS;
+ const CharT* TestPathEnd = StrEnd(TestPath);
+ const std::size_t Size = TestPathEnd - TestPath;
+ const std::size_t SSize = StrEnd(Expect) - Expect;
+ assert(Size == SSize);
+ //////////////////////////////////////////////////////////////////////////////
+ // basic_string<Char, Traits, Alloc>
+ {
+ const std::basic_string<CharT> S(TestPath);
+ path p; PathReserve(p, S.length() + 1);
+ {
+ // string provides a contigious iterator. No allocation needed.
+ DisableAllocationGuard g;
+ path& pref = (p = S);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ assert(p.string<CharT>() == S);
+ }
+ {
+ const std::basic_string<CharT> S(TestPath);
+ path p; PathReserve(p, S.length() + 1);
+ {
+ DisableAllocationGuard g;
+ path& pref = p.assign(S);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ assert(p.string<CharT>() == S);
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ // Char* pointers
+ {
+ path p; PathReserve(p, Size + 1);
+ {
+ // char* pointers are contigious and can be used with code_cvt directly.
+ // no allocations needed.
+ DisableAllocationGuard g;
+ path& pref = (p = TestPath);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+ {
+ path p; PathReserve(p, Size + 1);
+ {
+ DisableAllocationGuard g;
+ path& pref = p.assign(TestPath);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+ {
+ path p; PathReserve(p, Size + 1);
+ {
+ DisableAllocationGuard g;
+ path& pref = p.assign(TestPath, TestPathEnd);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ // Iterators
+ {
+ using It = input_iterator<const CharT*>;
+ path p; PathReserve(p, Size + 1);
+ It it(TestPath);
+ {
+ // Iterators cannot be used with code_cvt directly. This assignment
+ // may allocate if it's larger than a "short-string".
+ path& pref = (p = it);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+ {
+ using It = input_iterator<const CharT*>;
+ path p; PathReserve(p, Size + 1);
+ It it(TestPath);
+ {
+ path& pref = p.assign(it);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+ {
+ using It = input_iterator<const CharT*>;
+ path p; PathReserve(p, Size + 1);
+ It it(TestPath);
+ It e(TestPathEnd);
+ {
+ path& pref = p.assign(it, e);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+}
+
+int main() {
+ for (auto const& MS : PathList) {
+ RunTestCase<char>(MS);
+ RunTestCase<wchar_t>(MS);
+ RunTestCase<char16_t>(MS);
+ RunTestCase<char32_t>(MS);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
new file mode 100644
index 000000000000..557c1b24d88f
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
@@ -0,0 +1,126 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// int compare(path const&) const noexcept;
+// int compare(string_type const&) const;
+// int compare(value_type const*) const;
+//
+// bool operator==(path const&, path const&) noexcept;
+// bool operator!=(path const&, path const&) noexcept;
+// bool operator< (path const&, path const&) noexcept;
+// bool operator<=(path const&, path const&) noexcept;
+// bool operator> (path const&, path const&) noexcept;
+// bool operator>=(path const&, path const&) noexcept;
+//
+// size_t hash_value(path const&) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+struct PathCompareTest {
+ const char* LHS;
+ const char* RHS;
+ int expect;
+};
+
+#define LONGA "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+#define LONGB "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
+#define LONGC "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"
+#define LONGD "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"
+const PathCompareTest CompareTestCases[] =
+{
+ {"", "", 0},
+ {"a", "", 1},
+ {"", "a", -1},
+ {"a/b/c", "a/b/c", 0},
+ {"b/a/c", "a/b/c", 1},
+ {"a/b/c", "b/a/c", -1},
+ {"a/b", "a/b/c", -1},
+ {"a/b/c", "a/b", 1},
+ {"a/b/", "a/b/.", 0},
+ {"a/b//////", "a/b/////.", 0},
+ {"a/.././b", "a///..//.////b", 0},
+ {"//foo//bar///baz////", "//foo/bar/baz/", 0}, // duplicate separators
+ {"///foo/bar", "/foo/bar", 0}, // "///" is not a root directory
+ {"/foo/bar/", "/foo/bar", 1}, // trailing separator
+ {"//" LONGA "////" LONGB "/" LONGC "///" LONGD, "//" LONGA "/" LONGB "/" LONGC "/" LONGD, 0},
+ { LONGA "/" LONGB "/" LONGC, LONGA "/" LONGB "/" LONGB, 1}
+
+};
+#undef LONGA
+#undef LONGB
+#undef LONGC
+#undef LONGD
+
+int main()
+{
+ using namespace fs;
+ for (auto const & TC : CompareTestCases) {
+ const path p1(TC.LHS);
+ const path p2(TC.RHS);
+ const std::string R(TC.RHS);
+ const int E = TC.expect;
+ { // compare(...) functions
+ DisableAllocationGuard g; // none of these operations should allocate
+
+ // check runtime results
+ int ret1 = p1.compare(p2);
+ int ret2 = p1.compare(R);
+ int ret3 = p1.compare(TC.RHS);
+ assert(ret1 == ret2 && ret1 == ret3);
+ int normalized_ret = ret1 < 0 ? -1 : (ret1 > 0 ? 1 : 0);
+ assert(normalized_ret == E);
+
+ // check signatures
+ ASSERT_NOEXCEPT(p1.compare(p2));
+ }
+ { // comparison operators
+ DisableAllocationGuard g; // none of these operations should allocate
+
+ // Check runtime result
+ assert((p1 == p2) == (E == 0));
+ assert((p1 != p2) == (E != 0));
+ assert((p1 < p2) == (E < 0));
+ assert((p1 <= p2) == (E <= 0));
+ assert((p1 > p2) == (E > 0));
+ assert((p1 >= p2) == (E >= 0));
+
+ // Check signatures
+ ASSERT_NOEXCEPT(p1 == p2);
+ ASSERT_NOEXCEPT(p1 != p2);
+ ASSERT_NOEXCEPT(p1 < p2);
+ ASSERT_NOEXCEPT(p1 <= p2);
+ ASSERT_NOEXCEPT(p1 > p2);
+ ASSERT_NOEXCEPT(p1 >= p2);
+ }
+ { // check hash values
+ auto h1 = hash_value(p1);
+ auto h2 = hash_value(p2);
+ assert((h1 == h2) == (p1 == p2));
+ // check signature
+ ASSERT_SAME_TYPE(size_t, decltype(hash_value(p1)));
+ ASSERT_NOEXCEPT(hash_value(p1));
+ }
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp
new file mode 100644
index 000000000000..6e00afe0b49c
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp
@@ -0,0 +1,277 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path& operator+=(const path& x);
+// path& operator+=(const string_type& x); // Implemented as Source template
+// path& operator+=(const value_type* x); // Implemented as Source template
+// path& operator+=(value_type x);
+// template <class Source>
+// path& operator+=(const Source& x);
+// template <class EcharT>
+// path& operator+=(EcharT x);
+// template <class Source>
+// path& concat(const Source& x);
+// template <class InputIterator>
+// path& concat(InputIterator first, InputIterator last);
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+struct ConcatOperatorTestcase {
+ MultiStringType lhs;
+ MultiStringType rhs;
+ MultiStringType expect;
+};
+
+#define LONGSTR "LONGSTR_LONGSTR_LONGSTR_LONGSTR_LONGSTR_LONGSTR_LONGSTR_LONGSTR_LONGSTR_LONGSTR_LONGSTR_LONGSTR"
+#define S(Str) MKSTR(Str)
+const ConcatOperatorTestcase Cases[] =
+ {
+ {S(""), S(""), S("")}
+ , {S("p1"), S("p2"), S("p1p2")}
+ , {S("p1/"), S("/p2"), S("p1//p2")}
+ , {S(""), S("\\foo/bar/baz"), S("\\foo/bar/baz")}
+ , {S("c:\\foo"), S(""), S("c:\\foo")}
+ , {S(LONGSTR), S("foo"), S(LONGSTR "foo")}
+ , {S("abcdefghijklmnopqrstuvwxyz/\\"), S("/\\123456789"), S("abcdefghijklmnopqrstuvwxyz/\\/\\123456789")}
+ };
+const ConcatOperatorTestcase LongLHSCases[] =
+ {
+ {S(""), S(LONGSTR), S(LONGSTR)}
+ , {S("p1/"), S(LONGSTR), S("p1/" LONGSTR)}
+ };
+const ConcatOperatorTestcase CharTestCases[] =
+ {
+ {S(""), S("P"), S("P")}
+ , {S("/fooba"), S("r"), S("/foobar")}
+ };
+#undef S
+#undef LONGSTR
+
+// The concat operator may need to allocate a temporary buffer before a code_cvt
+// conversion. Test if this allocation occurs by:
+// 1. Create a path, `LHS`, and reserve enough space to append `RHS`.
+// This prevents `LHS` from allocating during the actual appending.
+// 2. Create a `Source` object `RHS`, which represents a "large" string.
+// (The string must not trigger the SSO)
+// 3. Concat `RHS` to `LHS` and check for the expected allocation behavior.
+template <class CharT>
+void doConcatSourceAllocTest(ConcatOperatorTestcase const& TC)
+{
+ using namespace fs;
+ using Ptr = CharT const*;
+ using Str = std::basic_string<CharT>;
+ using InputIter = input_iterator<Ptr>;
+
+ const Ptr L = TC.lhs;
+ const Ptr R = TC.rhs;
+ const Ptr E = TC.expect;
+ std::size_t ReserveSize = StrLen(E) + 1;
+ // basic_string
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ Str RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS += RHS;
+ }
+ assert(LHS == E);
+ }
+ // CharT*
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ Ptr RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS += RHS;
+ }
+ assert(LHS == E);
+ }
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ Ptr RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS.concat(RHS, StrEnd(RHS));
+ }
+ assert(LHS == E);
+ }
+ // input iterator - For non-native char types, appends needs to copy the
+ // iterator range into a contigious block of memory before it can perform the
+ // code_cvt conversions.
+ // For "char" no allocations will be performed because no conversion is
+ // required.
+ bool DisableAllocations = std::is_same<CharT, char>::value;
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ InputIter RHS(R);
+ {
+ RequireAllocationGuard g; // requires 1 or more allocations occur by default
+ if (DisableAllocations) g.requireExactly(0);
+ LHS += RHS;
+ }
+ assert(LHS == E);
+ }
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ InputIter RHS(R);
+ InputIter REnd(StrEnd(R));
+ {
+ RequireAllocationGuard g;
+ if (DisableAllocations) g.requireExactly(0);
+ LHS.concat(RHS, REnd);
+ }
+ assert(LHS == E);
+ }
+}
+
+template <class CharT>
+void doConcatSourceTest(ConcatOperatorTestcase const& TC)
+{
+ using namespace fs;
+ using Ptr = CharT const*;
+ using Str = std::basic_string<CharT>;
+ using InputIter = input_iterator<Ptr>;
+ const Ptr L = TC.lhs;
+ const Ptr R = TC.rhs;
+ const Ptr E = TC.expect;
+ // basic_string
+ {
+ path LHS(L);
+ Str RHS(R);
+ path& Ref = (LHS += RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ Str RHS(R);
+ path& Ref = LHS.concat(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ // Char*
+ {
+ path LHS(L);
+ Str RHS(R);
+ path& Ref = (LHS += RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ Ptr RHS(R);
+ path& Ref = LHS.concat(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ Ptr RHS(R);
+ path& Ref = LHS.concat(RHS, StrEnd(RHS));
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ // iterators
+ {
+ path LHS(L);
+ InputIter RHS(R);
+ path& Ref = (LHS += RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L); InputIter RHS(R);
+ path& Ref = LHS.concat(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ InputIter RHS(R);
+ InputIter REnd(StrEnd(R));
+ path& Ref = LHS.concat(RHS, REnd);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+}
+
+template <class CharT>
+void doConcatECharTest(ConcatOperatorTestcase const& TC)
+{
+ using namespace fs;
+ using Ptr = CharT const*;
+ const Ptr RStr = TC.rhs;
+ assert(StrLen(RStr) == 1);
+ const Ptr L = TC.lhs;
+ const CharT R = RStr[0];
+ const Ptr E = TC.expect;
+ {
+ path LHS(L);
+ path& Ref = (LHS += R);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+}
+
+int main()
+{
+ using namespace fs;
+ for (auto const & TC : Cases) {
+ {
+ path LHS((const char*)TC.lhs);
+ path RHS((const char*)TC.rhs);
+ path& Ref = (LHS += RHS);
+ assert(LHS == (const char*)TC.expect);
+ assert(&Ref == &LHS);
+ }
+ doConcatSourceTest<char> (TC);
+ doConcatSourceTest<wchar_t> (TC);
+ doConcatSourceTest<char16_t>(TC);
+ doConcatSourceTest<char32_t>(TC);
+ }
+ for (auto const & TC : LongLHSCases) {
+ // Do path test
+ {
+ path LHS((const char*)TC.lhs);
+ path RHS((const char*)TC.rhs);
+ const char* E = TC.expect;
+ PathReserve(LHS, StrLen(E) + 5);
+ {
+ DisableAllocationGuard g;
+ path& Ref = (LHS += RHS);
+ assert(&Ref == &LHS);
+ }
+ assert(LHS == E);
+ }
+ doConcatSourceAllocTest<char>(TC);
+ doConcatSourceAllocTest<wchar_t>(TC);
+ }
+ for (auto const& TC : CharTestCases) {
+ doConcatECharTest<char>(TC);
+ doConcatECharTest<wchar_t>(TC);
+ doConcatECharTest<char16_t>(TC);
+ doConcatECharTest<char32_t>(TC);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp
new file mode 100644
index 000000000000..67b8a04049ec
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path(path const&)
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ static_assert(std::is_copy_constructible<path>::value, "");
+ static_assert(!std::is_nothrow_copy_constructible<path>::value, "should not be noexcept");
+ const std::string s("foo");
+ const path p(s);
+ path p2(p);
+ assert(p.native() == s);
+ assert(p2.native() == s);
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp
new file mode 100644
index 000000000000..f26504616d50
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path() noexcept
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ static_assert(std::is_nothrow_default_constructible<path>::value, "");
+ const path p;
+ assert(p.empty());
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp
new file mode 100644
index 000000000000..b8ac4b307005
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path(path&&) noexcept
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "count_new.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ static_assert(std::is_nothrow_move_constructible<path>::value, "");
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ const std::string s("we really really really really really really really "
+ "really really long string so that we allocate");
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ path p(s);
+ {
+ DisableAllocationGuard g;
+ path p2(std::move(p));
+ assert(p2.native() == s);
+ assert(p.native() != s); // Testing moved from state
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp
new file mode 100644
index 000000000000..d89e7c815efb
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// template <class Source>
+// path(const Source& source);
+// template <class InputIterator>
+// path(InputIterator first, InputIterator last);
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "min_allocator.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+template <class CharT>
+void RunTestCase(MultiStringType const& MS) {
+ using namespace fs;
+ const char* Expect = MS;
+ const CharT* TestPath = MS;
+ const CharT* TestPathEnd = StrEnd(TestPath);
+ const std::size_t Size = TestPathEnd - TestPath;
+ const std::size_t SSize = StrEnd(Expect) - Expect;
+ assert(Size == SSize);
+ // StringTypes
+ {
+ const std::basic_string<CharT> S(TestPath);
+ path p(S);
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ assert(p.string<CharT>() == S);
+ }
+ // Char* pointers
+ {
+ path p(TestPath);
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+ {
+ path p(TestPath, TestPathEnd);
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+ // Iterators
+ {
+ using It = input_iterator<const CharT*>;
+ path p(It{TestPath});
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+ {
+ using It = input_iterator<const CharT*>;
+ path p(It{TestPath}, It{TestPathEnd});
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ }
+}
+
+int main() {
+ for (auto const& MS : PathList) {
+ RunTestCase<char>(MS);
+ RunTestCase<wchar_t>(MS);
+ RunTestCase<char16_t>(MS);
+ RunTestCase<char32_t>(MS);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp
new file mode 100644
index 000000000000..4c83481aaf2d
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp
@@ -0,0 +1,198 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// 8.4.9 path decomposition [path.decompose]
+//------------------------------------------
+// path root_name() const;
+// path root_directory() const;
+// path root_path() const;
+// path relative_path() const;
+// path parent_path() const;
+// path filename() const;
+// path stem() const;
+// path extension() const;
+//-------------------------------
+// 8.4.10 path query [path.query]
+//-------------------------------
+// bool empty() const noexcept;
+// bool has_root_path() const;
+// bool has_root_name() const;
+// bool has_root_directory() const;
+// bool has_relative_path() const;
+// bool has_parent_path() const;
+// bool has_filename() const;
+// bool has_stem() const;
+// bool has_extension() const;
+// bool is_absolute() const;
+// bool is_relative() const;
+//-------------------------------
+// 8.5 path iterators [path.itr]
+//-------------------------------
+// iterator begin() const;
+// iterator end() const;
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+template <class It>
+std::reverse_iterator<It> mkRev(It it) {
+ return std::reverse_iterator<It>(it);
+}
+
+
+namespace fs = std::experimental::filesystem;
+struct PathDecomposeTestcase
+{
+ std::string raw;
+ std::vector<std::string> elements;
+ std::string root_path;
+ std::string root_name;
+ std::string root_directory;
+ std::string relative_path;
+ std::string parent_path;
+ std::string filename;
+};
+
+const PathDecomposeTestcase PathTestCases[] =
+ {
+ {"", {}, "", "", "", "", "", ""}
+ , {".", {"."}, "", "", "", ".", "", "."}
+ , {"..", {".."}, "", "", "", "..", "", ".."}
+ , {"foo", {"foo"}, "", "", "", "foo", "", "foo"}
+ , {"/", {"/"}, "/", "", "/", "", "", "/"}
+ , {"/foo", {"/", "foo"}, "/", "", "/", "foo", "/", "foo"}
+ , {"foo/", {"foo", "."}, "", "", "", "foo/", "foo", "."}
+ , {"/foo/", {"/", "foo", "."}, "/", "", "/", "foo/", "/foo", "."}
+ , {"foo/bar", {"foo","bar"}, "", "", "", "foo/bar", "foo", "bar"}
+ , {"/foo//bar", {"/","foo","bar"}, "/", "", "/", "foo/bar", "/foo", "bar"}
+ , {"//net", {"//net"}, "//net", "//net", "", "", "", "//net"}
+ , {"//net/foo", {"//net", "/", "foo"}, "//net/", "//net", "/", "foo", "//net/", "foo"}
+ , {"///foo///", {"/", "foo", "."}, "/", "", "/", "foo///", "///foo", "."}
+ , {"///foo///bar", {"/", "foo", "bar"}, "/", "", "/", "foo///bar", "///foo", "bar"}
+ , {"/.", {"/", "."}, "/", "", "/", ".", "/", "."}
+ , {"./", {".", "."}, "", "", "", "./", ".", "."}
+ , {"/..", {"/", ".."}, "/", "", "/", "..", "/", ".."}
+ , {"../", {"..", "."}, "", "", "", "../", "..", "."}
+ , {"foo/.", {"foo", "."}, "", "", "", "foo/.", "foo", "."}
+ , {"foo/..", {"foo", ".."}, "", "", "", "foo/..", "foo", ".."}
+ , {"foo/./", {"foo", ".", "."}, "", "", "", "foo/./", "foo/.", "."}
+ , {"foo/./bar", {"foo", ".", "bar"}, "", "", "", "foo/./bar", "foo/.", "bar"}
+ , {"foo/../", {"foo", "..", "."}, "", "", "", "foo/../", "foo/..", "."}
+ , {"foo/../bar", {"foo", "..", "bar"}, "", "", "", "foo/../bar", "foo/..", "bar"}
+ , {"c:", {"c:"}, "", "", "", "c:", "", "c:"}
+ , {"c:/", {"c:", "."}, "", "", "", "c:/", "c:", "."}
+ , {"c:foo", {"c:foo"}, "", "", "", "c:foo", "", "c:foo"}
+ , {"c:/foo", {"c:", "foo"}, "", "", "", "c:/foo", "c:", "foo"}
+ , {"c:foo/", {"c:foo", "."}, "", "", "", "c:foo/", "c:foo", "."}
+ , {"c:/foo/", {"c:", "foo", "."}, "", "", "", "c:/foo/", "c:/foo", "."}
+ , {"c:/foo/bar", {"c:", "foo", "bar"}, "", "", "", "c:/foo/bar", "c:/foo", "bar"}
+ , {"prn:", {"prn:"}, "", "", "", "prn:", "", "prn:"}
+ , {"c:\\", {"c:\\"}, "", "", "", "c:\\", "", "c:\\"}
+ , {"c:\\foo", {"c:\\foo"}, "", "", "", "c:\\foo", "", "c:\\foo"}
+ , {"c:foo\\", {"c:foo\\"}, "", "", "", "c:foo\\", "", "c:foo\\"}
+ , {"c:\\foo\\", {"c:\\foo\\"}, "", "", "", "c:\\foo\\", "", "c:\\foo\\"}
+ , {"c:\\foo/", {"c:\\foo", "."}, "", "", "", "c:\\foo/", "c:\\foo", "."}
+ , {"c:/foo\\bar", {"c:", "foo\\bar"}, "", "", "", "c:/foo\\bar", "c:", "foo\\bar"}
+ , {"//", {"//"}, "//", "//", "", "", "", "//"}
+ };
+
+void decompPathTest()
+{
+ using namespace fs;
+ for (auto const & TC : PathTestCases) {
+ path p(TC.raw);
+ assert(p == TC.raw);
+
+ assert(p.root_path() == TC.root_path);
+ assert(p.has_root_path() != TC.root_path.empty());
+
+ assert(p.root_name() == TC.root_name);
+ assert(p.has_root_name() != TC.root_name.empty());
+
+ assert(p.root_directory() == TC.root_directory);
+ assert(p.has_root_directory() != TC.root_directory.empty());
+
+ assert(p.relative_path() == TC.relative_path);
+ assert(p.has_relative_path() != TC.relative_path.empty());
+
+ assert(p.parent_path() == TC.parent_path);
+ assert(p.has_parent_path() != TC.parent_path.empty());
+
+ assert(p.filename() == TC.filename);
+ assert(p.has_filename() != TC.filename.empty());
+
+ assert(p.is_absolute() == p.has_root_directory());
+ assert(p.is_relative() != p.is_absolute());
+
+ assert(checkCollectionsEqual(p.begin(), p.end(),
+ TC.elements.begin(), TC.elements.end()));
+ // check backwards
+ assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()),
+ TC.elements.rbegin(), TC.elements.rend()));
+ }
+}
+
+
+struct FilenameDecompTestcase
+{
+ std::string raw;
+ std::string filename;
+ std::string stem;
+ std::string extension;
+};
+
+const FilenameDecompTestcase FilenameTestCases[] =
+{
+ {"", "", "", ""}
+ , {".", ".", ".", ""}
+ , {"..", "..", "..", ""}
+ , {"/", "/", "/", ""}
+ , {"foo", "foo", "foo", ""}
+ , {"/foo/bar.txt", "bar.txt", "bar", ".txt"}
+ , {"foo..txt", "foo..txt", "foo.", ".txt"}
+};
+
+
+void decompFilenameTest()
+{
+ using namespace fs;
+ for (auto const & TC : FilenameTestCases) {
+ path p(TC.raw);
+ assert(p == TC.raw);
+
+ assert(p.filename() == TC.filename);
+ assert(p.has_filename() != TC.filename.empty());
+
+ assert(p.stem() == TC.stem);
+ assert(p.has_stem() != TC.stem.empty());
+
+ assert(p.extension() == TC.extension);
+ assert(p.has_extension() != TC.extension.empty());
+ }
+}
+
+int main()
+{
+ decompPathTest();
+ decompFilenameTest();
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp
new file mode 100644
index 000000000000..47e94c9a213f
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// template <class ECharT, class Traits = char_traits<ECharT>,
+// class Allocator = allocator<ECharT>>
+// basic_string<ECharT, Traits, Allocator>
+// generic_string(const Allocator& a = Allocator()) const;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "min_allocator.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
+
+
+// generic_string<C, T, A> forwards to string<C, T, A>. Tests for
+// string<C, T, A>() are in "path.native.op/string_alloc.pass.cpp".
+// generic_string is minimally tested here.
+int main()
+{
+ using namespace fs;
+ using CharT = wchar_t;
+ using Traits = std::char_traits<CharT>;
+ using Alloc = malloc_allocator<CharT>;
+ using Str = std::basic_string<CharT, Traits, Alloc>;
+ const wchar_t* expect = longString;
+ const path p((const char*)longString);
+ {
+ DisableAllocationGuard g;
+ Alloc a;
+ Alloc::disable_default_constructor = true;
+ Str s = p.generic_string<wchar_t, Traits, Alloc>(a);
+ assert(s == expect);
+ assert(Alloc::alloc_count > 0);
+ assert(Alloc::outstanding_alloc() == 1);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp
new file mode 100644
index 000000000000..81d06843640d
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// std::string generic_string() const;
+// std::wstring generic_wstring() const;
+// std::u8string generic_u8string() const;
+// std::u16string generic_u16string() const;
+// std::u32string generic_u32string() const;
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "min_allocator.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
+
+int main()
+{
+ using namespace fs;
+ auto const& MS = longString;
+ const char* value = longString;
+ const path p(value);
+ {
+ std::string s = p.generic_string();
+ assert(s == value);
+ }
+ {
+ std::string s = p.generic_u8string();
+ assert(s == (const char*)MS);
+ }
+ {
+ std::wstring s = p.generic_wstring();
+ assert(s == (const wchar_t*)MS);
+ }
+ {
+ std::u16string s = p.generic_u16string();
+ assert(s == (const char16_t*)MS);
+ }
+ {
+ std::u32string s = p.generic_u32string();
+ assert(s == (const char32_t*)MS);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
new file mode 100644
index 000000000000..5be934968c46
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// void clear() noexcept
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ const path p("/foo/bar/baz");
+ {
+ path p;
+ ASSERT_NOEXCEPT(p.clear());
+ ASSERT_SAME_TYPE(void, decltype(p.clear()));
+ p.clear();
+ assert(p.empty());
+ }
+ {
+ path p2(p);
+ assert(p == p2);
+ p2.clear();
+ assert(p2.empty());
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp
new file mode 100644
index 000000000000..559538cf0ec4
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path& make_preferred()
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+struct MakePreferredTestcase {
+ const char* value;
+};
+
+const MakePreferredTestcase TestCases[] =
+ {
+ {""}
+ , {"hello_world"}
+ , {"/"}
+ , {"/foo/bar/baz/"}
+ , {"\\"}
+ , {"\\foo\\bar\\baz\\"}
+ , {"\\foo\\/bar\\/baz\\"}
+ };
+
+int main()
+{
+ // This operation is an identity operation on linux.
+ using namespace fs;
+ for (auto const & TC : TestCases) {
+ path p(TC.value);
+ assert(p == TC.value);
+ path& Ref = (p.make_preferred());
+ assert(p.native() == TC.value);
+ assert(&Ref == &p);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
new file mode 100644
index 000000000000..4ad9084dbf81
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path& remove_filename()
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+struct RemoveFilenameTestcase {
+ const char* value;
+ const char* expect;
+};
+
+const RemoveFilenameTestcase TestCases[] =
+ {
+ {"", ""}
+ , {"/", ""}
+ , {"\\", ""}
+ , {".", ""}
+ , {"..", ""}
+ , {"/foo", "/"}
+ , {"/foo/", "/foo"}
+ , {"/foo/.", "/foo"}
+ , {"/foo/..", "/foo"}
+ , {"/foo/////", "/foo"}
+ , {"/foo\\\\", "/"}
+ , {"/foo//\\/", "/foo//\\"}
+ , {"file.txt", ""}
+ , {"bar/../baz/./file.txt", "bar/../baz/."}
+ };
+
+int main()
+{
+ using namespace fs;
+ for (auto const & TC : TestCases) {
+ path const p_orig(TC.value);
+ path p(p_orig);
+ assert(p == TC.value);
+ path& Ref = (p.remove_filename());
+ assert(p == TC.expect);
+ assert(&Ref == &p);
+ {
+ const path parentp = p_orig.parent_path();
+ if (parentp == p_orig.root_name()) {
+
+ assert(p.empty());
+ } else {
+ assert(p == parentp);
+ }
+ }
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp
new file mode 100644
index 000000000000..98f6e9b88ab8
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path& replace_extension(path const& p = path())
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+struct ReplaceExtensionTestcase {
+ const char* value;
+ const char* expect;
+ const char* extension;
+};
+
+const ReplaceExtensionTestcase TestCases[] =
+ {
+ {"", "", ""}
+ , {"foo.cpp", "foo", ""}
+ , {"foo.cpp", "foo.", "."}
+ , {"foo..cpp", "foo..txt", "txt"}
+ , {"", ".txt", "txt"}
+ , {"", ".txt", ".txt"}
+ , {"/foo", "/foo.txt", ".txt"}
+ , {"/foo", "/foo.txt", "txt"}
+ , {"/foo.cpp", "/foo.txt", ".txt"}
+ , {"/foo.cpp", "/foo.txt", "txt"}
+ };
+const ReplaceExtensionTestcase NoArgCases[] =
+ {
+ {"", "", ""}
+ , {"foo", "foo", ""}
+ , {"foo.cpp", "foo", ""}
+ , {"foo..cpp", "foo.", ""}
+};
+
+int main()
+{
+ using namespace fs;
+ for (auto const & TC : TestCases) {
+ path p(TC.value);
+ assert(p == TC.value);
+ path& Ref = (p.replace_extension(TC.extension));
+ assert(p == TC.expect);
+ assert(&Ref == &p);
+ }
+ for (auto const& TC : NoArgCases) {
+ path p(TC.value);
+ assert(p == TC.value);
+ path& Ref = (p.replace_extension());
+ assert(p == TC.expect);
+ assert(&Ref == &p);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp
new file mode 100644
index 000000000000..66c97218c833
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path& replace_filename()
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+struct ReplaceFilenameTestcase {
+ const char* value;
+ const char* expect;
+ const char* filename;
+};
+
+const ReplaceFilenameTestcase TestCases[] =
+ {
+ {"/foo", "/bar", "bar"}
+ , {"/foo", "/", ""}
+ , {"foo", "bar", "bar"}
+ , {"/", "bar", "bar"}
+ , {"\\", "bar", "bar"}
+ , {"///", "bar", "bar"}
+ , {"\\\\", "bar", "bar"}
+ , {"\\/\\", "\\/bar", "bar"}
+ , {".", "bar", "bar"}
+ , {"..", "bar", "bar"}
+ , {"/foo\\baz/bong/", "/foo\\baz/bong/bar", "bar"}
+ , {"/foo\\baz/bong", "/foo\\baz/bar", "bar"}
+ };
+
+int main()
+{
+ using namespace fs;
+ for (auto const & TC : TestCases) {
+ path p(TC.value);
+ assert(p == TC.value);
+ path& Ref = (p.replace_filename(TC.filename));
+ assert(p == TC.expect);
+ assert(&Ref == &p);
+ // Tests Effects "as-if": remove_filename() append(filename)
+ {
+ path p2(TC.value);
+ path replace(TC.filename);
+ p2.remove_filename();
+ p2 /= replace;
+ assert(p2 == p);
+ }
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp
new file mode 100644
index 000000000000..04bbe3751a59
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// void swap(path& rhs) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+struct SwapTestcase {
+ const char* value1;
+ const char* value2;
+};
+
+#define LONG_STR1 "_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG"
+#define LONG_STR2 "_THIS_IS_LONG2_THIS_IS_LONG2_THIS_IS_LONG2_THIS_IS_LONG2_THIS_IS_LONG2_THIS_IS_LONG2_THIS_IS_LONG2"
+const SwapTestcase TestCases[] =
+ {
+ {"", ""}
+ , {"shortstr", LONG_STR1}
+ , {LONG_STR1, "shortstr"}
+ , {LONG_STR1, LONG_STR2}
+ };
+#undef LONG_STR1
+#undef LONG_STR2
+
+int main()
+{
+ using namespace fs;
+ {
+ path p;
+ ASSERT_NOEXCEPT(p.swap(p));
+ ASSERT_SAME_TYPE(void, decltype(p.swap(p)));
+ }
+ for (auto const & TC : TestCases) {
+ path p1(TC.value1);
+ path p2(TC.value2);
+ {
+ DisableAllocationGuard g;
+ p1.swap(p2);
+ }
+ assert(p1 == TC.value2);
+ assert(p2 == TC.value1);
+ {
+ DisableAllocationGuard g;
+ p1.swap(p2);
+ }
+ assert(p1 == TC.value1);
+ assert(p2 == TC.value2);
+ }
+ // self-swap
+ {
+ const char* Val = "aoeuaoeuaoeuaoeuaoeuaoeuaoeuaoeuaoeu";
+ path p1(Val);
+ assert(p1 == Val);
+ {
+ DisableAllocationGuard g;
+ p1.swap(p1);
+ }
+ assert(p1 == Val);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
new file mode 100644
index 000000000000..7cf3564bb9b1
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
@@ -0,0 +1,43 @@
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// const value_type* c_str() const noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main()
+{
+ using namespace fs;
+ const char* const value = "hello world";
+ const std::string str_value = value;
+ path p(value);
+ { // Check signature
+ ASSERT_SAME_TYPE(path::value_type const*, decltype(p.c_str()));
+ ASSERT_NOEXCEPT(p.c_str());
+ }
+ {
+ path p(value);
+ assert(p.c_str() == str_value);
+ assert(p.native().c_str() == p.c_str());
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp
new file mode 100644
index 000000000000..2a83fef9f9e6
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// std::string string() const;
+// std::wstring wstring() const;
+// std::u8string u8string() const;
+// std::u16string u16string() const;
+// std::u32string u32string() const;
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "min_allocator.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
+
+int main()
+{
+ using namespace fs;
+ auto const& MS = longString;
+ const char* value = longString;
+ const path p(value);
+ {
+ std::string s = p.string();
+ assert(s == value);
+ }
+ {
+ std::string s = p.u8string();
+ assert(s == (const char*)MS);
+ }
+ {
+ std::wstring s = p.wstring();
+ assert(s == (const wchar_t*)MS);
+ }
+ {
+ std::u16string s = p.u16string();
+ assert(s == (const char16_t*)MS);
+ }
+ {
+ std::u32string s = p.u32string();
+ assert(s == (const char32_t*)MS);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
new file mode 100644
index 000000000000..7f8df27faf0a
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// const string_type& native() const noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main()
+{
+ using namespace fs;
+ const char* const value = "hello world";
+ path p(value);
+ { // Check signature
+ ASSERT_SAME_TYPE(path::string_type const&, decltype(p.native()));
+ ASSERT_NOEXCEPT(p.native());
+ }
+ { // native() is tested elsewhere
+ path p(value);
+ assert(p.native() == value);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
new file mode 100644
index 000000000000..9ef83f989aa5
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
@@ -0,0 +1,47 @@
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// operator string_type() const;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main()
+{
+ using namespace fs;
+ using string_type = path::string_type;
+ const char* const value = "hello world";
+ path p(value);
+ { // Check signature
+ static_assert(std::is_convertible<path, string_type>::value, "");
+ static_assert(std::is_constructible<string_type, path>::value, "");
+ ASSERT_SAME_TYPE(string_type, decltype(p.operator string_type()));
+ ASSERT_NOT_NOEXCEPT(p.operator string_type());
+ }
+ {
+ path p(value);
+ assert(p.native() == value);
+ string_type s = p;
+ assert(s == value);
+ assert(p == value);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
new file mode 100644
index 000000000000..e98329735000
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
@@ -0,0 +1,138 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// template <class ECharT, class Traits = char_traits<ECharT>,
+// class Allocator = allocator<ECharT>>
+// basic_string<ECharT, Traits, Allocator>
+// string(const Allocator& a = Allocator()) const;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "min_allocator.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+// the SSO is always triggered for strings of size 2.
+MultiStringType shortString = MKSTR("a");
+MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
+
+template <class CharT>
+void doShortStringTest(MultiStringType const& MS) {
+ using namespace fs;
+ using Ptr = CharT const*;
+ using Str = std::basic_string<CharT>;
+ using Alloc = std::allocator<CharT>;
+ Ptr value = MS;
+ const path p((const char*)MS);
+ {
+ DisableAllocationGuard g;
+ Str s = p.string<CharT>();
+ assert(s == value);
+ Str s2 = p.string<CharT>(Alloc{});
+ assert(s2 == value);
+ }
+ using MAlloc = malloc_allocator<CharT>;
+ MAlloc::reset();
+ {
+ using Traits = std::char_traits<CharT>;
+ using AStr = std::basic_string<CharT, Traits, MAlloc>;
+ DisableAllocationGuard g;
+ AStr s = p.string<CharT, Traits, MAlloc>();
+ assert(s == value);
+ assert(MAlloc::alloc_count == 0);
+ assert(MAlloc::outstanding_alloc() == 0);
+ }
+ MAlloc::reset();
+ { // Other allocator - provided copy
+ using Traits = std::char_traits<CharT>;
+ using AStr = std::basic_string<CharT, Traits, MAlloc>;
+ DisableAllocationGuard g;
+ MAlloc a;
+ // don't allow another allocator to be default constructed.
+ MAlloc::disable_default_constructor = true;
+ AStr s = p.string<CharT, Traits, MAlloc>(a);
+ assert(s == value);
+ assert(MAlloc::alloc_count == 0);
+ assert(MAlloc::outstanding_alloc() == 0);
+ }
+ MAlloc::reset();
+}
+
+template <class CharT>
+void doLongStringTest(MultiStringType const& MS) {
+ using namespace fs;
+ using Ptr = CharT const*;
+ using Str = std::basic_string<CharT>;
+ Ptr value = MS;
+ const path p((const char*)MS);
+ { // Default allocator
+ using Alloc = std::allocator<CharT>;
+ Str s = p.string<CharT>();
+ assert(s == value);
+ Str s2 = p.string<CharT>(Alloc{});
+ assert(s2 == value);
+ }
+ using MAlloc = malloc_allocator<CharT>;
+ MAlloc::reset();
+ { // Other allocator - default construct
+ using Traits = std::char_traits<CharT>;
+ using AStr = std::basic_string<CharT, Traits, MAlloc>;
+ DisableAllocationGuard g;
+ AStr s = p.string<CharT, Traits, MAlloc>();
+ assert(s == value);
+ assert(MAlloc::alloc_count > 0);
+ assert(MAlloc::outstanding_alloc() == 1);
+ }
+ MAlloc::reset();
+ { // Other allocator - provided copy
+ using Traits = std::char_traits<CharT>;
+ using AStr = std::basic_string<CharT, Traits, MAlloc>;
+ DisableAllocationGuard g;
+ MAlloc a;
+ // don't allow another allocator to be default constructed.
+ MAlloc::disable_default_constructor = true;
+ AStr s = p.string<CharT, Traits, MAlloc>(a);
+ assert(s == value);
+ assert(MAlloc::alloc_count > 0);
+ assert(MAlloc::outstanding_alloc() == 1);
+ }
+ MAlloc::reset();
+ /////////////////////////////////////////////////////////////////////////////
+}
+
+int main()
+{
+ using namespace fs;
+ {
+ auto const& S = shortString;
+ doShortStringTest<char>(S);
+ doShortStringTest<wchar_t>(S);
+ doShortStringTest<char16_t>(S);
+ doShortStringTest<char32_t>(S);
+ }
+ {
+ auto const& S = longString;
+ doLongStringTest<char>(S);
+ doLongStringTest<wchar_t>(S);
+ doLongStringTest<char16_t>(S);
+ doLongStringTest<char32_t>(S);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp
new file mode 100644
index 000000000000..9cf37d4cd537
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+//-------------------------------
+// 8.4.10 path query [path.query]
+//-------------------------------
+// bool empty() const noexcept;
+// bool has_root_path() const;
+// bool has_root_name() const;
+// bool has_root_directory() const;
+// bool has_relative_path() const;
+// bool has_parent_path() const;
+// bool has_filename() const;
+// bool has_stem() const;
+// bool has_extension() const;
+// bool is_absolute() const;
+// bool is_relative() const;
+
+// tested in path.decompose
+int main() {}
diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp
new file mode 100644
index 000000000000..58983778446a
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// path operator/(path const&, path const&);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+// This is mainly tested via the member append functions.
+int main()
+{
+ using namespace fs;
+ path p1("abc");
+ path p2("def");
+ path p3 = p1 / p2;
+ assert(p3 == "abc/def");
+}
diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp
new file mode 100644
index 000000000000..28867432c61d
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp
@@ -0,0 +1,14 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// The comparison operators are tested as part of [path.compare]
+// in class.path/path.members/path.compare.pass.cpp
+int main() {}
diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp
new file mode 100644
index 000000000000..b03b8008b622
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp
@@ -0,0 +1,14 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// The "hash_value" function is tested as part of [path.compare]
+// in class.path/path.members/path.compare.pass.cpp
+int main() {}
diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp
new file mode 100644
index 000000000000..4853994b4950
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// template <class Source>
+// path u8path(Source const&);
+// template <class InputIter>
+// path u8path(InputIter, InputIter);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main()
+{
+ using namespace fs;
+ const char* In1 = "abcd/efg";
+ const std::string In2(In1);
+ const auto In3 = In2.begin();
+ const auto In3End = In2.end();
+ {
+ path p = fs::u8path(In1);
+ assert(p == In1);
+ }
+ {
+ path p = fs::u8path(In2);
+ assert(p == In1);
+ }
+ {
+ path p = fs::u8path(In3);
+ assert(p == In1);
+ }
+ {
+ path p = fs::u8path(In3, In3End);
+ assert(p == In1);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
new file mode 100644
index 000000000000..e8d150f1e39d
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const path& p);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is, path& p)
+//
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <sstream>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+MultiStringType InStr = MKSTR("abcdefg/\"hijklmnop\"/qrstuvwxyz/123456789");
+MultiStringType OutStr = MKSTR("\"abcdefg/\\\"hijklmnop\\\"/qrstuvwxyz/123456789\"");
+
+template <class CharT>
+void doIOTest() {
+ using namespace fs;
+ using Ptr = const CharT*;
+ using StrStream = std::basic_stringstream<CharT>;
+ const char* const InCStr = InStr;
+ const Ptr E = OutStr;
+ const path p((const char*)InStr);
+ StrStream ss;
+ { // test output
+ auto& ret = (ss << p);
+ assert(ss.str() == E);
+ assert(&ret == &ss);
+ }
+ { // test input
+ path p_in;
+ auto& ret = ss >> p_in;
+ assert(p_in.native() == (const char*)InStr);
+ assert(&ret == &ss);
+ }
+}
+
+
+int main() {
+ doIOTest<char>();
+ doIOTest<wchar_t>();
+ //doIOTest<char16_t>();
+ //doIOTest<char32_t>();
+}
diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp
new file mode 100644
index 000000000000..3a9b48b2669a
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const path& p);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is, path& p)
+//
+
+// TODO(EricWF) This test fails because "std::quoted" fails to compile
+// for char16_t and char32_t types. Combine with path.io.pass.cpp when this
+// passes.
+// XFAIL: *
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <sstream>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+MultiStringType InStr = MKSTR("abcdefg/\"hijklmnop\"/qrstuvwxyz/123456789");
+MultiStringType OutStr = MKSTR("\"abcdefg/\\\"hijklmnop\\\"/qrstuvwxyz/123456789\"");
+
+template <class CharT>
+void doIOTest() {
+ using namespace fs;
+ using Ptr = const CharT*;
+ using StrStream = std::basic_stringstream<CharT>;
+ const char* const InCStr = InStr;
+ const Ptr E = OutStr;
+ const path p((const char*)InStr);
+ StrStream ss;
+ { // test output
+ auto& ret = (ss << p);
+ assert(ss.str() == E);
+ assert(&ret == &ss);
+ }
+ { // test input
+ path p_in;
+ auto& ret = ss >> p_in;
+ assert(p_in.native() == (const char*)InStr);
+ assert(&ret == &ss);
+ }
+}
+
+
+int main() {
+ doIOTest<char16_t>();
+ doIOTest<char32_t>();
+}
diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp
new file mode 100644
index 000000000000..8d180463a577
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// void swap(path& lhs, path& rhs) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+// NOTE: this is tested in path.members/path.modifiers via the member swap.
+int main()
+{
+ using namespace fs;
+ const char* value1 = "foo/bar/baz";
+ const char* value2 = "_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG";
+ path p1(value1);
+ path p2(value2);
+ {
+ using namespace std; using namespace fs;
+ ASSERT_NOEXCEPT(swap(p1, p2));
+ ASSERT_SAME_TYPE(void, decltype(swap(p1, p2)));
+ }
+ {
+ DisableAllocationGuard g;
+ using namespace std;
+ using namespace fs;
+ swap(p1, p2);
+ assert(p1.native() == value2);
+ assert(p2.native() == value1);
+ swap(p1, p2);
+ assert(p1.native() == value1);
+ assert(p2.native() == value2);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.path/synop.pass.cpp b/test/std/experimental/filesystem/class.path/synop.pass.cpp
new file mode 100644
index 000000000000..b0a7b5cd65e2
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/synop.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// typedef ... value_type;
+// typedef basic_string<value_type> string_type;
+// static constexpr value_type preferred_separator = ...;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ ASSERT_SAME_TYPE(path::value_type, char);
+ ASSERT_SAME_TYPE(path::string_type, std::basic_string<path::value_type>);
+ {
+ ASSERT_SAME_TYPE(const path::value_type, decltype(path::preferred_separator));
+ static_assert(path::preferred_separator == '/', "");
+ // Make preferred_separator ODR used by taking it's address.
+ const char* dummy = &path::preferred_separator;
+ ((void)dummy);
+ }
+}
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp
new file mode 100644
index 000000000000..4dbd599e543a
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// recursive_recursive_directory_iterator(recursive_recursive_directory_iterator const&);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_copy_construct_tests)
+
+TEST_CASE(test_constructor_signature)
+{
+ using D = recursive_directory_iterator;
+ static_assert(std::is_copy_constructible<D>::value, "");
+ //static_assert(!std::is_nothrow_copy_constructible<D>::value, "");
+}
+
+TEST_CASE(test_copy_end_iterator)
+{
+ const recursive_directory_iterator endIt;
+ recursive_directory_iterator it(endIt);
+ TEST_CHECK(it == endIt);
+}
+
+TEST_CASE(test_copy_valid_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+ const recursive_directory_iterator endIt{};
+
+ // build 'it' up with "interesting" non-default state so we can test
+ // that it gets copied. We want to get 'it' into a state such that:
+ // it.options() != directory_options::none
+ // it.depth() != 0
+ // it.recursion_pending() != true
+ const directory_options opts = directory_options::skip_permission_denied;
+ recursive_directory_iterator it(testDir, opts);
+ TEST_REQUIRE(it != endIt);
+ while (it.depth() == 0) {
+ ++it;
+ TEST_REQUIRE(it != endIt);
+ }
+ it.disable_recursion_pending();
+ TEST_CHECK(it.options() == opts);
+ TEST_CHECK(it.depth() == 1);
+ TEST_CHECK(it.recursion_pending() == false);
+ const path entry = *it;
+
+ // OPERATION UNDER TEST //
+ const recursive_directory_iterator it2(it);
+ // ------------------- //
+
+ TEST_REQUIRE(it2 == it);
+ TEST_CHECK(*it2 == entry);
+ TEST_CHECK(it2.depth() == 1);
+ TEST_CHECK(it2.recursion_pending() == false);
+ TEST_CHECK(it != endIt);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp
new file mode 100644
index 000000000000..3e9257eac8fa
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp
@@ -0,0 +1,158 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// recursive_directory_iterator& operator=(recursive_directory_iterator const&);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_copy_assign_tests)
+
+recursive_directory_iterator createInterestingIterator()
+ // Create an "interesting" iterator where all fields are
+ // in a non-default state. The returned 'it' is in a
+ // state such that:
+ // it.options() == directory_options::skip_permission_denied
+ // it.depth() == 1
+ // it.recursion_pending() == true
+{
+ const path testDir = StaticEnv::Dir;
+ const recursive_directory_iterator endIt;
+ recursive_directory_iterator it(testDir,
+ directory_options::skip_permission_denied);
+ TEST_ASSERT(it != endIt);
+ while (it.depth() != 1) {
+ ++it;
+ TEST_ASSERT(it != endIt);
+ }
+ TEST_ASSERT(it.depth() == 1);
+ it.disable_recursion_pending();
+ return it;
+}
+
+
+recursive_directory_iterator createDifferentInterestingIterator()
+ // Create an "interesting" iterator where all fields are
+ // in a non-default state. The returned 'it' is in a
+ // state such that:
+ // it.options() == directory_options::follow_directory_symlink
+ // it.depth() == 2
+ // it.recursion_pending() == false
+{
+ const path testDir = StaticEnv::Dir;
+ const recursive_directory_iterator endIt;
+ recursive_directory_iterator it(testDir,
+ directory_options::follow_directory_symlink);
+ TEST_ASSERT(it != endIt);
+ while (it.depth() != 2) {
+ ++it;
+ TEST_ASSERT(it != endIt);
+ }
+ TEST_ASSERT(it.depth() == 2);
+ return it;
+}
+
+TEST_CASE(test_assignment_signature) {
+ using D = recursive_directory_iterator;
+ static_assert(std::is_copy_assignable<D>::value, "");
+}
+
+TEST_CASE(test_copy_to_end_iterator)
+{
+ const recursive_directory_iterator endIt;
+
+ const recursive_directory_iterator from = createInterestingIterator();
+ const path entry = *from;
+
+ recursive_directory_iterator to;
+ to = from;
+ TEST_REQUIRE(to == from);
+ TEST_CHECK(*to == entry);
+ TEST_CHECK(to.options() == from.options());
+ TEST_CHECK(to.depth() == from.depth());
+ TEST_CHECK(to.recursion_pending() == from.recursion_pending());
+}
+
+
+TEST_CASE(test_copy_from_end_iterator)
+{
+ const recursive_directory_iterator from;
+ recursive_directory_iterator to = createInterestingIterator();
+
+ to = from;
+ TEST_REQUIRE(to == from);
+ TEST_CHECK(to == recursive_directory_iterator{});
+}
+
+TEST_CASE(test_copy_valid_iterator)
+{
+ const recursive_directory_iterator endIt;
+
+ const recursive_directory_iterator it = createInterestingIterator();
+ const path entry = *it;
+
+ recursive_directory_iterator it2 = createDifferentInterestingIterator();
+ TEST_REQUIRE(it2 != it);
+ TEST_CHECK(it2.options() != it.options());
+ TEST_CHECK(it2.depth() != it.depth());
+ TEST_CHECK(it2.recursion_pending() != it.recursion_pending());
+ TEST_CHECK(*it2 != entry);
+
+ it2 = it;
+ TEST_REQUIRE(it2 == it);
+ TEST_CHECK(it2.options() == it.options());
+ TEST_CHECK(it2.depth() == it.depth());
+ TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
+ TEST_CHECK(*it2 == entry);
+}
+
+TEST_CASE(test_returns_reference_to_self)
+{
+ const recursive_directory_iterator it;
+ recursive_directory_iterator it2;
+ recursive_directory_iterator& ref = (it2 = it);
+ TEST_CHECK(&ref == &it2);
+}
+
+TEST_CASE(test_self_copy)
+{
+ // Create two non-equal iterators that have exactly the same state.
+ recursive_directory_iterator it = createInterestingIterator();
+ recursive_directory_iterator it2 = createInterestingIterator();
+ TEST_CHECK(it != it2);
+ TEST_CHECK(it2.options() == it.options());
+ TEST_CHECK(it2.depth() == it.depth());
+ TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
+ TEST_CHECK(*it2 == *it);
+
+ // perform a self-copy and check that the state still matches the
+ // other unmodified iterator.
+ recursive_directory_iterator const& cit = it;
+ it = cit;
+ TEST_CHECK(it2.options() == it.options());
+ TEST_CHECK(it2.depth() == it.depth());
+ TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
+ TEST_CHECK(*it2 == *it);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
new file mode 100644
index 000000000000..1cddccd0d724
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
@@ -0,0 +1,240 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class directory_iterator
+
+//
+// explicit recursive_directory_iterator(const path& p);
+// recursive_directory_iterator(const path& p, directory_options options);
+// recursive_directory_iterator(const path& p, error_code& ec) noexcept;
+// recursive_directory_iterator(const path& p, directory_options options, error_code& ec) noexcept;
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+using RDI = recursive_directory_iterator;
+
+TEST_SUITE(recursive_directory_iterator_constructor_tests)
+
+TEST_CASE(test_constructor_signatures)
+{
+ using D = recursive_directory_iterator;
+
+ // explicit directory_iterator(path const&);
+ static_assert(!std::is_convertible<path, D>::value, "");
+ static_assert(std::is_constructible<D, path>::value, "");
+ static_assert(!std::is_nothrow_constructible<D, path>::value, "");
+
+ // directory_iterator(path const&, error_code&) noexcept
+ static_assert(std::is_nothrow_constructible<D, path, std::error_code&>::value, "");
+
+ // directory_iterator(path const&, directory_options);
+ static_assert(std::is_constructible<D, path, directory_options>::value, "");
+ static_assert(!std::is_nothrow_constructible<D, path, directory_options>::value, "");
+
+ // directory_iterator(path const&, directory_options, error_code&) noexcept
+ static_assert(std::is_nothrow_constructible<D, path, directory_options, std::error_code&>::value, "");
+}
+
+TEST_CASE(test_construction_from_bad_path)
+{
+ std::error_code ec;
+ directory_options opts = directory_options::none;
+ const RDI endIt;
+
+ const path testPaths[] = { StaticEnv::DNE, StaticEnv::BadSymlink };
+ for (path const& testPath : testPaths)
+ {
+ {
+ RDI it(testPath, ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(it == endIt);
+ }
+ {
+ RDI it(testPath, opts, ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(it == endIt);
+ }
+ {
+ TEST_CHECK_THROW(filesystem_error, RDI(testPath));
+ TEST_CHECK_THROW(filesystem_error, RDI(testPath, opts));
+ }
+ }
+}
+
+TEST_CASE(access_denied_test_case)
+{
+ using namespace std::experimental::filesystem;
+ scoped_test_env env;
+ path const testDir = env.make_env_path("dir1");
+ path const testFile = testDir / "testFile";
+ env.create_dir(testDir);
+ env.create_file(testFile, 42);
+
+ // Test that we can iterator over the directory before changing the perms
+ RDI it(testDir);
+ TEST_REQUIRE(it != RDI{});
+
+ // Change the permissions so we can no longer iterate
+ permissions(testDir, perms::none);
+
+ // Check that the construction fails when skip_permissions_denied is
+ // not given.
+ {
+ std::error_code ec;
+ RDI it(testDir, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(it == RDI{});
+ }
+ // Check that construction does not report an error when
+ // 'skip_permissions_denied' is given.
+ {
+ std::error_code ec;
+ RDI it(testDir, directory_options::skip_permission_denied, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(it == RDI{});
+ }
+}
+
+
+TEST_CASE(access_denied_to_file_test_case)
+{
+ using namespace std::experimental::filesystem;
+ scoped_test_env env;
+ path const testFile = env.make_env_path("file1");
+ env.create_file(testFile, 42);
+
+ // Change the permissions so we can no longer iterate
+ permissions(testFile, perms::none);
+
+ // Check that the construction fails when skip_permissions_denied is
+ // not given.
+ {
+ std::error_code ec;
+ RDI it(testFile, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(it == RDI{});
+ }
+ // Check that construction still fails when 'skip_permissions_denied' is given
+ // because we tried to open a file and not a directory.
+ {
+ std::error_code ec;
+ RDI it(testFile, directory_options::skip_permission_denied, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(it == RDI{});
+ }
+}
+
+TEST_CASE(test_open_on_empty_directory_equals_end)
+{
+ scoped_test_env env;
+ const path testDir = env.make_env_path("dir1");
+ env.create_dir(testDir);
+
+ const RDI endIt;
+ {
+ std::error_code ec;
+ RDI it(testDir, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(it == endIt);
+ }
+ {
+ RDI it(testDir);
+ TEST_CHECK(it == endIt);
+ }
+}
+
+TEST_CASE(test_open_on_directory_succeeds)
+{
+ const path testDir = StaticEnv::Dir;
+ std::set<path> dir_contents(std::begin(StaticEnv::DirIterationList),
+ std::end( StaticEnv::DirIterationList));
+ const RDI endIt{};
+
+ {
+ std::error_code ec;
+ RDI it(testDir, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(it != endIt);
+ TEST_CHECK(dir_contents.count(*it));
+ }
+ {
+ RDI it(testDir);
+ TEST_CHECK(it != endIt);
+ TEST_CHECK(dir_contents.count(*it));
+ }
+}
+
+TEST_CASE(test_open_on_file_fails)
+{
+ const path testFile = StaticEnv::File;
+ const RDI endIt{};
+ {
+ std::error_code ec;
+ RDI it(testFile, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(it == endIt);
+ }
+ {
+ TEST_CHECK_THROW(filesystem_error, RDI(testFile));
+ }
+}
+
+TEST_CASE(test_options_post_conditions)
+{
+ const path goodDir = StaticEnv::Dir;
+ const path badDir = StaticEnv::DNE;
+
+ {
+ std::error_code ec;
+
+ RDI it1(goodDir, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(it1.options() == directory_options::none);
+
+ RDI it2(badDir, ec);
+ TEST_REQUIRE(ec);
+ TEST_REQUIRE(it2 == RDI{});
+ }
+ {
+ std::error_code ec;
+ const directory_options opts = directory_options::skip_permission_denied;
+
+ RDI it1(goodDir, opts, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(it1.options() == opts);
+
+ RDI it2(badDir, opts, ec);
+ TEST_REQUIRE(ec);
+ TEST_REQUIRE(it2 == RDI{});
+ }
+ {
+ RDI it(goodDir);
+ TEST_CHECK(it.options() == directory_options::none);
+ }
+ {
+ const directory_options opts = directory_options::follow_directory_symlink;
+ RDI it(goodDir, opts);
+ TEST_CHECK(it.options() == opts);
+ }
+}
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp
new file mode 100644
index 000000000000..676e6f27c886
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// int depth() const
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_depth_tests)
+
+TEST_CASE(test_depth)
+{
+ const path testDir = StaticEnv::Dir;
+ const path DirDepth1 = StaticEnv::Dir2;
+ const path DirDepth2 = StaticEnv::Dir3;
+ const recursive_directory_iterator endIt{};
+
+ std::error_code ec;
+ recursive_directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(it.depth() == 0);
+
+ bool seen_d1, seen_d2;
+ seen_d1 = seen_d2 = false;
+
+ while (it != endIt) {
+ const path entry = *it;
+ const path parent = entry.parent_path();
+ if (parent == testDir) {
+ TEST_CHECK(it.depth() == 0);
+ } else if (parent == DirDepth1) {
+ TEST_CHECK(it.depth() == 1);
+ seen_d1 = true;
+ } else if (parent == DirDepth2) {
+ TEST_CHECK(it.depth() == 2);
+ seen_d2 = true;
+ } else {
+ TEST_CHECK(!"Unexpected depth while iterating over static env");
+ }
+ ++it;
+ }
+ TEST_REQUIRE(seen_d1 && seen_d2);
+ TEST_CHECK(it == endIt);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp
new file mode 100644
index 000000000000..387c6145b6a5
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// void disable_recursion_pending();
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_disable_recursion_pending_tests)
+
+// NOTE: The main semantics of disable_recursion_pending are tested
+// in the 'recursion_pending()' tests.
+TEST_CASE(basic_test)
+{
+ recursive_directory_iterator it(StaticEnv::Dir);
+ TEST_REQUIRE(it.recursion_pending() == true);
+ it.disable_recursion_pending();
+ TEST_CHECK(it.recursion_pending() == false);
+ it.disable_recursion_pending();
+ TEST_CHECK(it.recursion_pending() == false);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
new file mode 100644
index 000000000000..e67fc2f20f6e
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
@@ -0,0 +1,240 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// recursive_directory_iterator& operator++();
+// recursive_directory_iterator& increment(error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+#include <iostream>
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_increment_tests)
+
+TEST_CASE(test_increment_signatures)
+{
+ using D = recursive_directory_iterator;
+ recursive_directory_iterator d; ((void)d);
+ std::error_code ec; ((void)ec);
+
+ ASSERT_SAME_TYPE(decltype(++d), recursive_directory_iterator&);
+ ASSERT_NOT_NOEXCEPT(++d);
+
+ ASSERT_SAME_TYPE(decltype(d.increment(ec)), recursive_directory_iterator&);
+ ASSERT_NOEXCEPT(d.increment(ec));
+}
+
+TEST_CASE(test_prefix_increment)
+{
+ const path testDir = StaticEnv::Dir;
+ const std::set<path> dir_contents(std::begin(StaticEnv::RecDirIterationList),
+ std::end( StaticEnv::RecDirIterationList));
+ const recursive_directory_iterator endIt{};
+
+ std::error_code ec;
+ recursive_directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+
+ std::set<path> unseen_entries = dir_contents;
+ while (!unseen_entries.empty()) {
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+ TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+ recursive_directory_iterator& it_ref = ++it;
+ TEST_CHECK(&it_ref == &it);
+ }
+
+ TEST_CHECK(it == endIt);
+}
+
+TEST_CASE(test_postfix_increment)
+{
+ const path testDir = StaticEnv::Dir;
+ const std::set<path> dir_contents(std::begin(StaticEnv::RecDirIterationList),
+ std::end( StaticEnv::RecDirIterationList));
+ const recursive_directory_iterator endIt{};
+
+ std::error_code ec;
+ recursive_directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+
+ std::set<path> unseen_entries = dir_contents;
+ while (!unseen_entries.empty()) {
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+ TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+ const path entry2 = *it++;
+ TEST_CHECK(entry2 == entry);
+ }
+ TEST_CHECK(it == endIt);
+}
+
+
+TEST_CASE(test_increment_method)
+{
+ const path testDir = StaticEnv::Dir;
+ const std::set<path> dir_contents(std::begin(StaticEnv::RecDirIterationList),
+ std::end( StaticEnv::RecDirIterationList));
+ const recursive_directory_iterator endIt{};
+
+ std::error_code ec;
+ recursive_directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+
+ std::set<path> unseen_entries = dir_contents;
+ while (!unseen_entries.empty()) {
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+ TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+ recursive_directory_iterator& it_ref = it.increment(ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(&it_ref == &it);
+ }
+
+ TEST_CHECK(it == endIt);
+}
+
+TEST_CASE(test_follow_symlinks)
+{
+ const path testDir = StaticEnv::Dir;
+ auto const& IterList = StaticEnv::RecDirFollowSymlinksIterationList;
+
+ const std::set<path> dir_contents(std::begin(IterList), std::end(IterList));
+ const recursive_directory_iterator endIt{};
+
+ std::error_code ec;
+ recursive_directory_iterator it(testDir,
+ directory_options::follow_directory_symlink, ec);
+ TEST_REQUIRE(!ec);
+
+ std::set<path> unseen_entries = dir_contents;
+ while (!unseen_entries.empty()) {
+ TEST_REQUIRE(it != endIt);
+ const path entry = *it;
+
+ TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+ recursive_directory_iterator& it_ref = it.increment(ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(&it_ref == &it);
+ }
+ TEST_CHECK(it == endIt);
+}
+
+TEST_CASE(access_denied_on_recursion_test_case)
+{
+ using namespace std::experimental::filesystem;
+ scoped_test_env env;
+ const path testFiles[] = {
+ env.create_dir("dir1"),
+ env.create_dir("dir1/dir2"),
+ env.create_file("dir1/dir2/file1"),
+ env.create_file("dir1/file2")
+ };
+ const path startDir = testFiles[0];
+ const path permDeniedDir = testFiles[1];
+ const path otherFile = testFiles[3];
+ auto SkipEPerm = directory_options::skip_permission_denied;
+
+ // Change the permissions so we can no longer iterate
+ permissions(permDeniedDir, perms::none);
+
+ const recursive_directory_iterator endIt;
+
+ // Test that recursion resulting in a "EACCESS" error is not ignored
+ // by default.
+ {
+ std::error_code ec = GetTestEC();
+ recursive_directory_iterator it(startDir, ec);
+ TEST_REQUIRE(ec != GetTestEC());
+ TEST_REQUIRE(!ec);
+ while (it != endIt && it->path() != permDeniedDir)
+ ++it;
+ TEST_REQUIRE(it != endIt);
+ TEST_REQUIRE(*it == permDeniedDir);
+
+ it.increment(ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(it == endIt);
+ }
+ // Same as obove but test operator++().
+ {
+ std::error_code ec = GetTestEC();
+ recursive_directory_iterator it(startDir, ec);
+ TEST_REQUIRE(!ec);
+ while (it != endIt && it->path() != permDeniedDir)
+ ++it;
+ TEST_REQUIRE(it != endIt);
+ TEST_REQUIRE(*it == permDeniedDir);
+
+ TEST_REQUIRE_THROW(filesystem_error, ++it);
+ }
+ // Test that recursion resulting in a "EACCESS" error is ignored when the
+ // correct options are given to the constructor.
+ {
+ std::error_code ec = GetTestEC();
+ recursive_directory_iterator it(startDir, SkipEPerm, ec);
+ TEST_REQUIRE(!ec);
+ TEST_REQUIRE(it != endIt);
+
+ bool seenOtherFile = false;
+ if (*it == otherFile) {
+ ++it;
+ seenOtherFile = true;
+ TEST_REQUIRE (it != endIt);
+ }
+ TEST_REQUIRE(*it == permDeniedDir);
+
+ ec = GetTestEC();
+ it.increment(ec);
+ TEST_REQUIRE(!ec);
+
+ if (seenOtherFile) {
+ TEST_CHECK(it == endIt);
+ } else {
+ TEST_CHECK(it != endIt);
+ TEST_CHECK(*it == otherFile);
+ }
+ }
+ // Test that construction resulting in a "EACCESS" error is not ignored
+ // by default.
+ {
+ std::error_code ec;
+ recursive_directory_iterator it(permDeniedDir, ec);
+ TEST_REQUIRE(ec);
+ TEST_REQUIRE(it == endIt);
+ }
+ // Same as obove but testing the throwing constructors
+ {
+ TEST_REQUIRE_THROW(filesystem_error,
+ recursive_directory_iterator(permDeniedDir));
+ }
+ // Test that construction resulting in a "EACCESS" error constructs the
+ // end iterator when the correct options are given.
+ {
+ std::error_code ec = GetTestEC();
+ recursive_directory_iterator it(permDeniedDir, SkipEPerm, ec);
+ TEST_REQUIRE(!ec);
+ TEST_REQUIRE(it == endIt);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp
new file mode 100644
index 000000000000..16dde66d216e
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// recursive_directory_iterator(recursive_directory_iterator&&) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_move_construct_tests)
+
+TEST_CASE(test_constructor_signature)
+{
+ using D = recursive_directory_iterator;
+ static_assert(std::is_nothrow_move_constructible<D>::value, "");
+}
+
+TEST_CASE(test_move_end_iterator)
+{
+ const recursive_directory_iterator endIt;
+ recursive_directory_iterator endIt2{};
+
+ recursive_directory_iterator it(std::move(endIt2));
+ TEST_CHECK(it == endIt);
+ TEST_CHECK(endIt2 == endIt);
+}
+
+TEST_CASE(test_move_valid_iterator)
+{
+ const path testDir = StaticEnv::Dir;
+ const recursive_directory_iterator endIt{};
+
+ // build 'it' up with "interesting" non-default state so we can test
+ // that it gets copied. We want to get 'it' into a state such that:
+ // it.options() != directory_options::none
+ // it.depth() != 0
+ // it.recursion_pending() != true
+ const directory_options opts = directory_options::skip_permission_denied;
+ recursive_directory_iterator it(testDir, opts);
+ TEST_REQUIRE(it != endIt);
+ while (it.depth() == 0) {
+ ++it;
+ TEST_REQUIRE(it != endIt);
+ }
+ it.disable_recursion_pending();
+ TEST_CHECK(it.options() == opts);
+ TEST_CHECK(it.depth() == 1);
+ TEST_CHECK(it.recursion_pending() == false);
+ const path entry = *it;
+
+ // OPERATION UNDER TEST //
+ const recursive_directory_iterator it2(std::move(it));
+ // ------------------- //
+
+ TEST_REQUIRE(it2 != endIt);
+ TEST_CHECK(*it2 == entry);
+ TEST_CHECK(it2.depth() == 1);
+ TEST_CHECK(it2.recursion_pending() == false);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
new file mode 100644
index 000000000000..915d00267a82
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
@@ -0,0 +1,169 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// recursive_directory_iterator& operator=(recursive_directory_iterator const&);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+// The filesystem specification explicitly allows for self-move on
+// the directory iterators. Turn off this warning so we can test it.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wself-move"
+#endif
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_move_assign_tests)
+
+recursive_directory_iterator createInterestingIterator()
+ // Create an "interesting" iterator where all fields are
+ // in a non-default state. The returned 'it' is in a
+ // state such that:
+ // it.options() == directory_options::skip_permission_denied
+ // it.depth() == 1
+ // it.recursion_pending() == true
+{
+ const path testDir = StaticEnv::Dir;
+ const recursive_directory_iterator endIt;
+ recursive_directory_iterator it(testDir,
+ directory_options::skip_permission_denied);
+ TEST_ASSERT(it != endIt);
+ while (it.depth() != 1) {
+ ++it;
+ TEST_ASSERT(it != endIt);
+ }
+ TEST_ASSERT(it.depth() == 1);
+ it.disable_recursion_pending();
+ return it;
+}
+
+recursive_directory_iterator createDifferentInterestingIterator()
+ // Create an "interesting" iterator where all fields are
+ // in a non-default state. The returned 'it' is in a
+ // state such that:
+ // it.options() == directory_options::follow_directory_symlink
+ // it.depth() == 2
+ // it.recursion_pending() == false
+{
+ const path testDir = StaticEnv::Dir;
+ const recursive_directory_iterator endIt;
+ recursive_directory_iterator it(testDir,
+ directory_options::follow_directory_symlink);
+ TEST_ASSERT(it != endIt);
+ while (it.depth() != 2) {
+ ++it;
+ TEST_ASSERT(it != endIt);
+ }
+ TEST_ASSERT(it.depth() == 2);
+ return it;
+}
+
+
+TEST_CASE(test_assignment_signature)
+{
+ using D = recursive_directory_iterator;
+ static_assert(std::is_nothrow_move_assignable<D>::value, "");
+}
+
+
+TEST_CASE(test_move_to_end_iterator)
+{
+ const recursive_directory_iterator endIt;
+
+ recursive_directory_iterator from = createInterestingIterator();
+ const recursive_directory_iterator from_copy(from);
+ const path entry = *from;
+
+ recursive_directory_iterator to;
+ to = std::move(from);
+ TEST_REQUIRE(to != endIt);
+ TEST_CHECK(*to == entry);
+ TEST_CHECK(to.options() == from_copy.options());
+ TEST_CHECK(to.depth() == from_copy.depth());
+ TEST_CHECK(to.recursion_pending() == from_copy.recursion_pending());
+ TEST_CHECK(from == endIt || from == to);
+}
+
+
+TEST_CASE(test_move_from_end_iterator)
+{
+ recursive_directory_iterator from;
+ recursive_directory_iterator to = createInterestingIterator();
+
+ to = std::move(from);
+ TEST_REQUIRE(to == from);
+ TEST_CHECK(to == recursive_directory_iterator{});
+}
+
+TEST_CASE(test_move_valid_iterator)
+{
+ const recursive_directory_iterator endIt;
+
+ recursive_directory_iterator it = createInterestingIterator();
+ const recursive_directory_iterator it_copy(it);
+ const path entry = *it;
+
+ recursive_directory_iterator it2 = createDifferentInterestingIterator();
+ const recursive_directory_iterator it2_copy(it2);
+ TEST_REQUIRE(it2 != it);
+ TEST_CHECK(it2.options() != it.options());
+ TEST_CHECK(it2.depth() != it.depth());
+ TEST_CHECK(it2.recursion_pending() != it.recursion_pending());
+ TEST_CHECK(*it2 != entry);
+
+ it2 = std::move(it);
+ TEST_REQUIRE(it2 != it2_copy && it2 != endIt);
+ TEST_CHECK(it2.options() == it_copy.options());
+ TEST_CHECK(it2.depth() == it_copy.depth());
+ TEST_CHECK(it2.recursion_pending() == it_copy.recursion_pending());
+ TEST_CHECK(*it2 == entry);
+ TEST_CHECK(it == endIt || it == it2);
+}
+
+TEST_CASE(test_returns_reference_to_self)
+{
+ recursive_directory_iterator it;
+ recursive_directory_iterator it2;
+ recursive_directory_iterator& ref = (it2 = std::move(it));
+ TEST_CHECK(&ref == &it2);
+}
+
+TEST_CASE(test_self_move)
+{
+ // Create two non-equal iterators that have exactly the same state.
+ recursive_directory_iterator it = createInterestingIterator();
+ recursive_directory_iterator it2 = createInterestingIterator();
+ TEST_CHECK(it != it2);
+ TEST_CHECK(it2.options() == it.options());
+ TEST_CHECK(it2.depth() == it.depth());
+ TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
+ TEST_CHECK(*it2 == *it);
+
+ it = std::move(it);
+ TEST_CHECK(it2.options() == it.options());
+ TEST_CHECK(it2.depth() == it.depth());
+ TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
+ TEST_CHECK(*it2 == *it);
+}
+
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp
new file mode 100644
index 000000000000..befa30484c0c
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp
@@ -0,0 +1,93 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// void pop();
+// void pop(error_code& ec);
+
+#include <experimental/filesystem>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_pop_tests)
+
+TEST_CASE(signature_tests)
+{
+ recursive_directory_iterator it{}; ((void)it);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(it.pop());
+ ASSERT_NOT_NOEXCEPT(it.pop(ec)); // may require allocation or other things
+}
+
+// NOTE: Since the order of iteration is unspecified we use a list of
+// seen files at each depth to determine the new depth after a 'pop()' operation.
+TEST_CASE(test_depth)
+{
+ const recursive_directory_iterator endIt{};
+
+ auto& DE0 = StaticEnv::DirIterationList;
+ std::set<path> notSeenDepth0(std::begin(DE0), std::end(DE0));
+
+ auto& DE1 = StaticEnv::DirIterationListDepth1;
+ std::set<path> notSeenDepth1(std::begin(DE1), std::end(DE1));
+
+ std::error_code ec;
+ recursive_directory_iterator it(StaticEnv::Dir, ec);
+ TEST_REQUIRE(it != endIt);
+ TEST_CHECK(it.depth() == 0);
+
+ while (it.depth() != 2) {
+ if (it.depth() == 0)
+ notSeenDepth0.erase(it->path());
+ else
+ notSeenDepth1.erase(it->path());
+ ++it;
+ TEST_REQUIRE(it != endIt);
+ }
+
+ while (true) {
+ auto set_ec = std::make_error_code(std::errc::address_in_use);
+ it.pop(set_ec);
+ TEST_REQUIRE(!set_ec);
+
+ if (it == endIt) {
+ // We must have seen every entry at depth 0 and 1.
+ TEST_REQUIRE(notSeenDepth0.empty() && notSeenDepth1.empty());
+ break;
+ }
+ else if (it.depth() == 1) {
+ // If we popped to depth 1 then there must be unseen entries
+ // at this level.
+ TEST_REQUIRE(!notSeenDepth1.empty());
+ TEST_CHECK(notSeenDepth1.count(it->path()));
+ notSeenDepth1.clear();
+ }
+ else if (it.depth() == 0) {
+ // If we popped to depth 0 there must be unseen entries at this
+ // level. There should also be no unseen entries at depth 1.
+ TEST_REQUIRE(!notSeenDepth0.empty());
+ TEST_REQUIRE(notSeenDepth1.empty());
+ TEST_CHECK(notSeenDepth0.count(it->path()));
+ notSeenDepth0.clear();
+ }
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp
new file mode 100644
index 000000000000..5a3bdd9d482b
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp
@@ -0,0 +1,162 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// bool recursion_pending() const;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_recursion_pending_tests)
+
+TEST_CASE(initial_value_test)
+{
+ recursive_directory_iterator it(StaticEnv::Dir);
+ TEST_REQUIRE(it.recursion_pending() == true);
+}
+
+TEST_CASE(value_after_copy_construction_and_assignment_test)
+{
+ recursive_directory_iterator rec_pending_it(StaticEnv::Dir);
+ recursive_directory_iterator no_rec_pending_it(StaticEnv::Dir);
+ no_rec_pending_it.disable_recursion_pending();
+
+ { // copy construction
+ recursive_directory_iterator it(rec_pending_it);
+ TEST_CHECK(it.recursion_pending() == true);
+ it.disable_recursion_pending();
+ TEST_REQUIRE(rec_pending_it.recursion_pending() == true);
+
+ recursive_directory_iterator it2(no_rec_pending_it);
+ TEST_CHECK(it2.recursion_pending() == false);
+ }
+ { // copy assignment
+ recursive_directory_iterator it(StaticEnv::Dir);
+ it.disable_recursion_pending();
+ it = rec_pending_it;
+ TEST_CHECK(it.recursion_pending() == true);
+ it.disable_recursion_pending();
+ TEST_REQUIRE(rec_pending_it.recursion_pending() == true);
+
+ recursive_directory_iterator it2(StaticEnv::Dir);
+ it2 = no_rec_pending_it;
+ TEST_CHECK(it2.recursion_pending() == false);
+ }
+ TEST_CHECK(rec_pending_it.recursion_pending() == true);
+ TEST_CHECK(no_rec_pending_it.recursion_pending() == false);
+}
+
+
+TEST_CASE(value_after_move_construction_and_assignment_test)
+{
+ recursive_directory_iterator rec_pending_it(StaticEnv::Dir);
+ recursive_directory_iterator no_rec_pending_it(StaticEnv::Dir);
+ no_rec_pending_it.disable_recursion_pending();
+
+ { // move construction
+ recursive_directory_iterator it_cp(rec_pending_it);
+ recursive_directory_iterator it(std::move(it_cp));
+ TEST_CHECK(it.recursion_pending() == true);
+
+ recursive_directory_iterator it_cp2(no_rec_pending_it);
+ recursive_directory_iterator it2(std::move(it_cp2));
+ TEST_CHECK(it2.recursion_pending() == false);
+ }
+ { // copy assignment
+ recursive_directory_iterator it(StaticEnv::Dir);
+ it.disable_recursion_pending();
+ recursive_directory_iterator it_cp(rec_pending_it);
+ it = std::move(it_cp);
+ TEST_CHECK(it.recursion_pending() == true);
+
+ recursive_directory_iterator it2(StaticEnv::Dir);
+ recursive_directory_iterator it_cp2(no_rec_pending_it);
+ it2 = std::move(it_cp2);
+ TEST_CHECK(it2.recursion_pending() == false);
+ }
+ TEST_CHECK(rec_pending_it.recursion_pending() == true);
+ TEST_CHECK(no_rec_pending_it.recursion_pending() == false);
+}
+
+TEST_CASE(increment_resets_value)
+{
+ const recursive_directory_iterator endIt;
+ {
+ recursive_directory_iterator it(StaticEnv::Dir);
+ it.disable_recursion_pending();
+ TEST_CHECK(it.recursion_pending() == false);
+ ++it;
+ TEST_CHECK(it.recursion_pending() == true);
+ TEST_CHECK(it.depth() == 0);
+ }
+ {
+ recursive_directory_iterator it(StaticEnv::Dir);
+ it.disable_recursion_pending();
+ TEST_CHECK(it.recursion_pending() == false);
+ it++;
+ TEST_CHECK(it.recursion_pending() == true);
+ TEST_CHECK(it.depth() == 0);
+ }
+ {
+ recursive_directory_iterator it(StaticEnv::Dir);
+ it.disable_recursion_pending();
+ TEST_CHECK(it.recursion_pending() == false);
+ std::error_code ec;
+ it.increment(ec);
+ TEST_CHECK(it.recursion_pending() == true);
+ TEST_CHECK(it.depth() == 0);
+ }
+}
+
+TEST_CASE(pop_does_not_reset_value)
+{
+ const recursive_directory_iterator endIt;
+
+ auto& DE0 = StaticEnv::DirIterationList;
+ std::set<path> notSeenDepth0(std::begin(DE0), std::end(DE0));
+
+ recursive_directory_iterator it(StaticEnv::Dir);
+ TEST_REQUIRE(it != endIt);
+
+ while (it.depth() == 0) {
+ notSeenDepth0.erase(it->path());
+ ++it;
+ TEST_REQUIRE(it != endIt);
+ }
+ TEST_REQUIRE(it.depth() == 1);
+ it.disable_recursion_pending();
+ it.pop();
+ // Since the order of iteration is unspecified the pop() could result
+ // in the end iterator. When this is the case it is undefined behavior
+ // to call recursion_pending().
+ if (it == endIt) {
+ TEST_CHECK(notSeenDepth0.empty());
+#if defined(_LIBCPP_VERSION)
+ TEST_CHECK(it.recursion_pending() == false);
+#endif
+ } else {
+ TEST_CHECK(! notSeenDepth0.empty());
+ TEST_CHECK(it.recursion_pending() == false);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
new file mode 100644
index 000000000000..ca5117f0e32f
--- /dev/null
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class recursive_directory_iterator
+
+// recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept;
+// recursive_directory_iterator end(recursive_directory_iterator iter) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+#include <iostream>
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(recursive_directory_iterator_begin_end_tests)
+
+TEST_CASE(test_function_signatures)
+{
+ using D = recursive_directory_iterator;
+ recursive_directory_iterator d; ((void)d);
+
+ ASSERT_SAME_TYPE(decltype(begin(d)), recursive_directory_iterator);
+ ASSERT_NOEXCEPT(begin(std::move(d)));
+
+ ASSERT_SAME_TYPE(decltype(end(d)), recursive_directory_iterator);
+ ASSERT_NOEXCEPT(end(std::move(d)));
+}
+
+TEST_CASE(test_ranged_for_loop)
+{
+ const path testDir = StaticEnv::Dir;
+ std::set<path> dir_contents(std::begin(StaticEnv::RecDirIterationList),
+ std::end( StaticEnv::RecDirIterationList));
+
+ std::error_code ec;
+ recursive_directory_iterator it(testDir, ec);
+ TEST_REQUIRE(!ec);
+
+ for (auto& elem : it) {
+ TEST_CHECK(dir_contents.erase(elem) == 1);
+ }
+ TEST_CHECK(dir_contents.empty());
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp b/test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp
new file mode 100644
index 000000000000..77b136f3fcad
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp
@@ -0,0 +1,75 @@
+#ifndef TEST_BITMASK_TYPE_HPP
+#define TEST_BITMASK_TYPE_HPP
+
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+
+template <class EnumType, EnumType Val1, EnumType Val2,
+ class UT = typename std::underlying_type<EnumType>::type,
+ UT UVal1 = static_cast<UT>(Val1),
+ UT UVal2 = static_cast<UT>(Val2),
+ UT UZero = static_cast<UT>(0),
+ EnumType Zero = static_cast<EnumType>(0)
+ >
+struct check_bitmask_type {
+
+ static constexpr UT dcast(EnumType e) { return static_cast<UT>(e); }
+ static constexpr UT unpromote(decltype((~UZero)) promoted) { return static_cast<UT>(promoted); }
+ // We need two values that are non-zero and share at least one bit.
+ static_assert(Val1 != Zero && Val2 != Zero, "");
+ static_assert(Val1 != Val2, "");
+ static_assert((UVal1 & UVal2) == 0, "");
+
+
+ static bool check()
+ {
+ {
+ EnumType ValRef = Val1;
+ ASSERT_SAME_TYPE(EnumType, decltype(Val1 & Val2));
+ ASSERT_SAME_TYPE(EnumType, decltype(Val1 | Val2));
+ ASSERT_SAME_TYPE(EnumType, decltype(Val1 ^ Val2));
+ ASSERT_SAME_TYPE(EnumType, decltype((~Val1)));
+ ASSERT_SAME_TYPE(EnumType&, decltype(ValRef &= Val2));
+ ASSERT_SAME_TYPE(EnumType&, decltype(ValRef |= Val2));
+ ASSERT_SAME_TYPE(EnumType&, decltype(ValRef ^= Val2));
+ }
+
+ static_assert((Val1 & Zero) == Zero, "");
+ static_assert((Val1 & Val1) == Val1, "");
+ static_assert(dcast(Val1 & Val2) == (UVal1 & UVal2), "");
+
+ static_assert((Val1 | Zero) == Val1, "");
+ static_assert(dcast(Val1 | Val2) == (UVal1 | UVal2), "");
+
+ static_assert((Val1 ^ Zero) == Val1, "");
+ static_assert(dcast(Val1 ^ Val2) == (UVal1 ^ UVal2), "");
+
+ static_assert(dcast(~Zero) == unpromote(~UZero), "");
+ static_assert(dcast(~Val1) == unpromote(~UVal1), "");
+
+ {
+ EnumType e = Val1;
+ EnumType& eref = (e &= Val2);
+ assert(&eref == &e);
+ assert(dcast(eref) == (UVal1 & UVal2));
+ }
+ {
+ EnumType e = Val1;
+ EnumType& eref = (e |= Val2);
+ assert(&eref == &e);
+ assert(dcast(eref) == (UVal1 | UVal2));
+ }
+ {
+ EnumType e = Val1;
+ EnumType& eref = (e ^= Val2);
+ assert(&eref == &e);
+ assert(dcast(eref) == (UVal1 ^ UVal2));
+ }
+ return true;
+ }
+};
+
+#endif // TEST_BITMASK_TYPE
diff --git a/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp
new file mode 100644
index 000000000000..22f0cb845a72
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// enum class copy_options;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "check_bitmask_types.hpp"
+#include "test_macros.h"
+
+namespace fs = std::experimental::filesystem;
+
+constexpr fs::copy_options ME(int val) { return static_cast<fs::copy_options>(val); }
+
+int main() {
+ typedef fs::copy_options E;
+ static_assert(std::is_enum<E>::value, "");
+
+ // Check that E is a scoped enum by checking for conversions.
+ typedef std::underlying_type<E>::type UT;
+ static_assert(!std::is_convertible<E, UT>::value, "");
+
+ static_assert(std::is_same<UT, unsigned short>::value, ""); // Implementation detail
+
+ typedef check_bitmask_type<E, E::skip_existing, E::update_existing> BitmaskTester;
+ assert(BitmaskTester::check());
+
+ static_assert(
+ E::none == ME(0),
+ "Expected enumeration values do not match");
+ // Option group for copy_file
+ static_assert(
+ E::skip_existing == ME(1) &&
+ E::overwrite_existing == ME(2) &&
+ E::update_existing == ME(4),
+ "Expected enumeration values do not match");
+ // Option group for copy on directories
+ static_assert(
+ E::recursive == ME(8),
+ "Expected enumeration values do not match");
+ // Option group for copy on symlinks
+ static_assert(
+ E::copy_symlinks == ME(16) &&
+ E::skip_symlinks == ME(32),
+ "Expected enumeration values do not match");
+ // Option group for changing form of copy
+ static_assert(
+ E::directories_only == ME(64) &&
+ E::create_symlinks == ME(128) &&
+ E::create_hard_links == ME(256),
+ "Expected enumeration values do not match");
+}
diff --git a/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp
new file mode 100644
index 000000000000..7dbf7b2887e8
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// enum class directory_options;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+#include <sys/stat.h>
+
+#include "test_macros.h"
+#include "check_bitmask_types.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+constexpr fs::directory_options ME(int val) { return static_cast<fs::directory_options>(val); }
+
+int main() {
+ typedef fs::directory_options E;
+ static_assert(std::is_enum<E>::value, "");
+
+ // Check that E is a scoped enum by checking for conversions.
+ typedef std::underlying_type<E>::type UT;
+ static_assert(!std::is_convertible<E, UT>::value, "");
+ static_assert(std::is_same<UT, unsigned char>::value, "");
+
+ typedef check_bitmask_type<E, E::follow_directory_symlink, E::skip_permission_denied> BitmaskTester;
+ assert(BitmaskTester::check());
+
+ static_assert(
+ E::none == ME(0) &&
+ E::follow_directory_symlink == ME(1) &&
+ E::skip_permission_denied == ME(2),
+ "Expected enumeration values do not match");
+
+}
diff --git a/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp
new file mode 100644
index 000000000000..ab94ad2877aa
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// enum class file_type;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace fs = std::experimental::filesystem;
+
+constexpr fs::file_type ME(int val) { return static_cast<fs::file_type>(val); }
+
+int main() {
+ typedef fs::file_type E;
+ static_assert(std::is_enum<E>::value, "");
+
+ // Check that E is a scoped enum by checking for conversions.
+ typedef std::underlying_type<E>::type UT;
+ static_assert(!std::is_convertible<E, UT>::value, "");
+
+ static_assert(std::is_same<UT, signed char>::value, ""); // Implementation detail
+
+ static_assert(
+ E::none == ME(0) &&
+ E::not_found == ME(-1) &&
+ E::regular == ME(1) &&
+ E::directory == ME(2) &&
+ E::symlink == ME(3) &&
+ E::block == ME(4) &&
+ E::character == ME(5) &&
+ E::fifo == ME(6) &&
+ E::socket == ME(7) &&
+ E::unknown == ME(8),
+ "Expected enumeration values do not match");
+}
diff --git a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp
new file mode 100644
index 000000000000..c0b14ba4b9b9
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// enum class perms;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+#include <sys/stat.h>
+
+#include "test_macros.h"
+#include "check_bitmask_types.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+constexpr fs::perms ME(int val) { return static_cast<fs::perms>(val); }
+
+int main() {
+ typedef fs::perms E;
+ static_assert(std::is_enum<E>::value, "");
+
+ // Check that E is a scoped enum by checking for conversions.
+ typedef std::underlying_type<E>::type UT;
+ static_assert(!std::is_convertible<E, UT>::value, "");
+
+ static_assert(std::is_same<UT, unsigned >::value, ""); // Implementation detail
+
+ typedef check_bitmask_type<E, E::group_all, E::owner_all> BitmaskTester;
+ assert(BitmaskTester::check());
+
+ static_assert(
+ E::none == ME(0) &&
+
+ E::owner_read == ME(0400) &&
+ E::owner_write == ME(0200) &&
+ E::owner_exec == ME(0100) &&
+ E::owner_all == ME(0700) &&
+
+ E::group_read == ME(040) &&
+ E::group_write == ME(020) &&
+ E::group_exec == ME(010) &&
+ E::group_all == ME(070) &&
+
+ E::others_read == ME(04) &&
+ E::others_write == ME(02) &&
+ E::others_exec == ME(01) &&
+ E::others_all == ME(07) &&
+ E::all == ME(0777) &&
+ E::set_uid == ME(04000) &&
+ E::set_gid == ME(02000) &&
+ E::sticky_bit == ME(01000) &&
+ E::mask == ME(07777) &&
+ E::unknown == ME(0xFFFF) &&
+ E::add_perms == ME(0x10000) &&
+ E::remove_perms == ME(0x20000) &&
+ E::symlink_nofollow == ME(0x40000),
+ "Expected enumeration values do not match");
+}
diff --git a/test/std/experimental/filesystem/fs.error.report/tested_elsewhere.pass.cpp b/test/std/experimental/filesystem/fs.error.report/tested_elsewhere.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.error.report/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp
new file mode 100644
index 000000000000..d8d92c5888ac
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// typedef TrivialClock file_time_type;
+
+#include <experimental/filesystem>
+#include <chrono>
+#include <type_traits>
+
+// system_clock is used because it meets the requirements of TrivialClock,
+// and it's resolution and range of system_clock should match the operating
+// systems file time type.
+typedef std::chrono::system_clock ExpectedClock;
+typedef std::chrono::time_point<ExpectedClock> ExpectedTimePoint;
+
+int main() {
+ static_assert(std::is_same<
+ std::experimental::filesystem::file_time_type,
+ ExpectedTimePoint
+ >::value, "");
+}
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
new file mode 100644
index 000000000000..4d59235c722b
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
@@ -0,0 +1,117 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// path absolute(const path& p, const path& base=current_path());
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(filesystem_absolute_path_test_suite)
+
+TEST_CASE(absolute_signature_test)
+{
+ const path p; ((void)p);
+ ASSERT_NOT_NOEXCEPT(absolute(p));
+ ASSERT_NOT_NOEXCEPT(absolute(p, p));
+}
+
+// There are 4 cases is the proposal for absolute path.
+// Each scope tests one of the cases.
+TEST_CASE(absolute_path_test)
+{
+ // has_root_name() && has_root_directory()
+ {
+ const path p("//net/foo");
+ const path base("//net/bar/baz");
+ TEST_REQUIRE(p.has_root_name());
+ TEST_REQUIRE(p.has_root_directory());
+ TEST_CHECK(p.is_absolute());
+ path ret = absolute(p, base);
+ TEST_CHECK(ret.is_absolute());
+ TEST_CHECK(ret == p);
+ }
+ // !has_root_name() && has_root_directory()
+ {
+ const path p("/foo");
+ const path base("//net/bar");
+ TEST_REQUIRE(not p.has_root_name());
+ TEST_REQUIRE(p.has_root_directory());
+ TEST_CHECK(p.is_absolute());
+ // ensure absolute(base) is not recursivly called
+ TEST_REQUIRE(base.has_root_name());
+ TEST_REQUIRE(base.has_root_directory());
+
+ path ret = absolute(p, base);
+ TEST_CHECK(ret.is_absolute());
+ TEST_CHECK(ret.has_root_name());
+ TEST_CHECK(ret.root_name() == path("//net"));
+ TEST_CHECK(ret.has_root_directory());
+ TEST_CHECK(ret.root_directory() == path("/"));
+ TEST_CHECK(ret == path("//net/foo"));
+ }
+ // has_root_name() && !has_root_directory()
+ {
+ const path p("//net");
+ const path base("//net/foo/bar");
+ TEST_REQUIRE(p.has_root_name());
+ TEST_REQUIRE(not p.has_root_directory());
+ TEST_CHECK(not p.is_absolute());
+ // absolute is called recursivly on base. The following conditions
+ // must be true for it to return base unmodified
+ TEST_REQUIRE(base.has_root_name());
+ TEST_REQUIRE(base.has_root_directory());
+ path ret = absolute(p, base);
+ const path expect("//net/foo/bar");
+ TEST_CHECK(ret.is_absolute());
+ TEST_CHECK(ret == path("//net/foo/bar"));
+ }
+ // !has_root_name() && !has_root_directory()
+ {
+ const path p("bar/baz");
+ const path base("//net/foo");
+ TEST_REQUIRE(not p.has_root_name());
+ TEST_REQUIRE(not p.has_root_directory());
+ TEST_REQUIRE(base.has_root_name());
+ TEST_REQUIRE(base.has_root_directory());
+
+ path ret = absolute(p, base);
+ TEST_CHECK(ret.is_absolute());
+ TEST_CHECK(ret == path("//net/foo/bar/baz"));
+ }
+}
+
+TEST_CASE(absolute_path_with_default_base)
+{
+ const path testCases[] = {
+ "//net/foo", // has_root_name() && has_root_directory()
+ "/foo", // !has_root_name() && has_root_directory()
+ "//net", // has_root_name() && !has_root_directory()
+ "bar/baz" // !has_root_name() && !has_root_directory()
+ };
+ const path base = current_path();
+ for (auto& p : testCases) {
+ const path ret = absolute(p);
+ const path expect = absolute(p, base);
+ TEST_CHECK(ret.is_absolute());
+ TEST_CHECK(ret == expect);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
new file mode 100644
index 000000000000..407f5b111a83
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
@@ -0,0 +1,120 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// path canonical(const path& p, const path& base = current_path());
+// path canonical(const path& p, error_code& ec);
+// path canonical(const path& p, const path& base, error_code& ec);
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(filesystem_canonical_path_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(canonical(p));
+ ASSERT_NOT_NOEXCEPT(canonical(p, p));
+ ASSERT_NOT_NOEXCEPT(canonical(p, ec));
+ ASSERT_NOT_NOEXCEPT(canonical(p, p, ec));
+}
+
+// There are 4 cases is the proposal for absolute path.
+// Each scope tests one of the cases.
+TEST_CASE(test_canonical)
+{
+ // has_root_name() && has_root_directory()
+ const path Root = StaticEnv::Root;
+ const path RootName = Root.filename();
+ const path DirName = StaticEnv::Dir.filename();
+ const path SymlinkName = StaticEnv::SymlinkToFile.filename();
+ struct TestCase {
+ path p;
+ path expect;
+ path base;
+ TestCase(path p1, path e, path b = StaticEnv::Root)
+ : p(p1), expect(e), base(b) {}
+ };
+ const TestCase testCases[] = {
+ { ".", Root, Root},
+ { DirName / ".." / "." / DirName, StaticEnv::Dir, Root},
+ { StaticEnv::Dir2 / "..", StaticEnv::Dir },
+ { StaticEnv::Dir3 / "../..", StaticEnv::Dir },
+ { StaticEnv::Dir / ".", StaticEnv::Dir },
+ { Root / "." / DirName / ".." / DirName, StaticEnv::Dir},
+ { path("..") / "." / RootName / DirName / ".." / DirName, StaticEnv::Dir, Root},
+ { StaticEnv::SymlinkToFile, StaticEnv::File },
+ { SymlinkName, StaticEnv::File, StaticEnv::Root}
+ };
+ for (auto& TC : testCases) {
+ std::error_code ec;
+ const path ret = canonical(TC.p, TC.base, ec);
+ TEST_REQUIRE(!ec);
+ const path ret2 = canonical(TC.p, TC.base);
+ TEST_CHECK(ret == TC.expect);
+ TEST_CHECK(ret == ret2);
+ TEST_CHECK(ret.is_absolute());
+ }
+}
+
+TEST_CASE(test_dne_path)
+{
+ std::error_code ec;
+ {
+ const path ret = canonical(StaticEnv::DNE, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(ret == path{});
+ }
+ ec.clear();
+ {
+ const path ret = canonical(StaticEnv::DNE, StaticEnv::Root, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(ret == path{});
+ }
+ {
+ TEST_CHECK_THROW(filesystem_error, canonical(StaticEnv::DNE));
+ TEST_CHECK_THROW(filesystem_error, canonical(StaticEnv::DNE, StaticEnv::Root));
+ }
+}
+
+TEST_CASE(test_exception_contains_paths)
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ const path p = "blabla/dne";
+ const path base = StaticEnv::Root;
+ try {
+ canonical(p, base);
+ TEST_REQUIRE(false);
+ } catch (filesystem_error const& err) {
+ TEST_CHECK(err.path1() == p);
+ TEST_CHECK(err.path2() == base);
+ }
+ try {
+ canonical(p);
+ TEST_REQUIRE(false);
+ } catch (filesystem_error const& err) {
+ TEST_CHECK(err.path1() == p);
+ TEST_CHECK(err.path2() == current_path());
+ }
+#endif
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp
new file mode 100644
index 000000000000..7d318719f740
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp
@@ -0,0 +1,251 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// void copy(const path& from, const path& to);
+// void copy(const path& from, const path& to, error_code& ec) noexcept;
+// void copy(const path& from, const path& to, copy_options options);
+// void copy(const path& from, const path& to, copy_options options,
+// error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+using CO = fs::copy_options;
+
+TEST_SUITE(filesystem_copy_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ const copy_options opts{}; ((void)opts);
+ ASSERT_NOT_NOEXCEPT(fs::copy(p, p));
+ ASSERT_NOEXCEPT(fs::copy(p, p, ec));
+ ASSERT_NOT_NOEXCEPT(copy(p, p, opts));
+ ASSERT_NOEXCEPT(copy(p, p, opts, ec));
+}
+
+// There are 4 cases is the proposal for absolute path.
+// Each scope tests one of the cases.
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::copy(f, t);
+ return false;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.path2() == t
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+ const path dir = env.create_dir("dir");
+ const path fifo = env.create_fifo("fifo");
+ TEST_REQUIRE(is_other(fifo));
+
+ // !exists(f)
+ {
+ std::error_code ec;
+ const path f = StaticEnv::DNE;
+ const path t = env.test_root;
+ fs::copy(f, t, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(f, t, ec));
+ }
+ { // equivalent(f, t) == true
+ std::error_code ec;
+ fs::copy(file, file, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(file, file, ec));
+ }
+ { // is_directory(from) && is_file(to)
+ std::error_code ec;
+ fs::copy(dir, file, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(dir, file, ec));
+ }
+ { // is_other(from)
+ std::error_code ec;
+ fs::copy(fifo, dir, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(fifo, dir, ec));
+ }
+ { // is_other(to)
+ std::error_code ec;
+ fs::copy(file, fifo, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(file, fifo, ec));
+ }
+}
+
+TEST_CASE(from_is_symlink)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file", 42);
+ const path symlink = env.create_symlink(file, "sym");
+ const path dne = env.make_env_path("dne");
+
+ { // skip symlinks
+ std::error_code ec = GetTestEC();
+ fs::copy(symlink, dne, copy_options::skip_symlinks, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(dne));
+ }
+ {
+ const path dest = env.make_env_path("dest");
+ std::error_code ec = GetTestEC();
+ fs::copy(symlink, dest, copy_options::copy_symlinks, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(exists(dest));
+ TEST_CHECK(is_symlink(dest));
+ }
+ { // copy symlink but target exists
+ std::error_code ec = GetTestEC();
+ fs::copy(symlink, file, copy_options::copy_symlinks, ec);
+ TEST_CHECK(ec);
+ }
+ { // create symlinks but target exists
+ std::error_code ec = GetTestEC();
+ fs::copy(symlink, file, copy_options::create_symlinks, ec);
+ TEST_CHECK(ec);
+ }
+}
+
+TEST_CASE(from_is_regular_file)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file", 42);
+ const path dir = env.create_dir("dir");
+ { // skip copy because of directory
+ const path dest = env.make_env_path("dest1");
+ std::error_code ec = GetTestEC();
+ fs::copy(file, dest, CO::directories_only, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(dest));
+ }
+ { // create symlink to file
+ const path dest = env.make_env_path("sym");
+ std::error_code ec = GetTestEC();
+ fs::copy(file, dest, CO::create_symlinks, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_symlink(dest));
+ TEST_CHECK(equivalent(file, canonical(dest)));
+ }
+ { // create hard link to file
+ const path dest = env.make_env_path("hardlink");
+ TEST_CHECK(hard_link_count(file) == 1);
+ std::error_code ec = GetTestEC();
+ fs::copy(file, dest, CO::create_hard_links, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(exists(dest));
+ TEST_CHECK(hard_link_count(file) == 2);
+ }
+ { // is_directory(t)
+ const path dest_dir = env.create_dir("dest_dir");
+ const path expect_dest = dest_dir / file.filename();
+ std::error_code ec = GetTestEC();
+ fs::copy(file, dest_dir, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_regular_file(expect_dest));
+ }
+ { // otherwise copy_file(from, to, ...)
+ const path dest = env.make_env_path("file_copy");
+ std::error_code ec = GetTestEC();
+ fs::copy(file, dest, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_regular_file(dest));
+ }
+}
+
+TEST_CASE(from_is_directory)
+{
+ struct FileInfo {
+ path filename;
+ int size;
+ };
+ const FileInfo files[] = {
+ {"file1", 0},
+ {"file2", 42},
+ {"file3", 300}
+ };
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path nested_dir_name = "dir2";
+ const path nested_dir = env.create_dir("dir/dir2");
+
+ for (auto& FI : files) {
+ env.create_file(dir / FI.filename, FI.size);
+ env.create_file(nested_dir / FI.filename, FI.size);
+ }
+ { // test for non-existent directory
+ const path dest = env.make_env_path("dest_dir1");
+ std::error_code ec = GetTestEC();
+ fs::copy(dir, dest, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(is_directory(dest));
+ for (auto& FI : files) {
+ path created = dest / FI.filename;
+ TEST_CHECK(is_regular_file(created));
+ TEST_CHECK(file_size(created) == FI.size);
+ }
+ TEST_CHECK(!is_directory(dest / nested_dir_name));
+ }
+ { // test for existing directory
+ const path dest = env.create_dir("dest_dir2");
+ std::error_code ec = GetTestEC();
+ fs::copy(dir, dest, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(is_directory(dest));
+ for (auto& FI : files) {
+ path created = dest / FI.filename;
+ TEST_CHECK(is_regular_file(created));
+ TEST_CHECK(file_size(created) == FI.size);
+ }
+ TEST_CHECK(!is_directory(dest / nested_dir_name));
+ }
+ { // test recursive copy
+ const path dest = env.make_env_path("dest_dir3");
+ std::error_code ec = GetTestEC();
+ fs::copy(dir, dest, CO::recursive, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(is_directory(dest));
+ const path nested_dest = dest / nested_dir_name;
+ TEST_REQUIRE(is_directory(nested_dest));
+ for (auto& FI : files) {
+ path created = dest / FI.filename;
+ path nested_created = nested_dest / FI.filename;
+ TEST_CHECK(is_regular_file(created));
+ TEST_CHECK(file_size(created) == FI.size);
+ TEST_CHECK(is_regular_file(nested_created));
+ TEST_CHECK(file_size(nested_created) == FI.size);
+ }
+ }
+
+}
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
new file mode 100644
index 000000000000..ac9877bbd9ce
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
@@ -0,0 +1,164 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool copy_file(const path& from, const path& to);
+// bool copy_file(const path& from, const path& to, error_code& ec) noexcept;
+// bool copy_file(const path& from, const path& to, copy_options options);
+// bool copy_file(const path& from, const path& to, copy_options options,
+// error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+using CO = fs::copy_options;
+
+TEST_SUITE(filesystem_copy_file_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ const copy_options opts{}; ((void)opts);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(fs::copy_file(p, p)), bool);
+ ASSERT_SAME_TYPE(decltype(fs::copy_file(p, p, opts)), bool);
+ ASSERT_SAME_TYPE(decltype(fs::copy_file(p, p, ec)), bool);
+ ASSERT_SAME_TYPE(decltype(fs::copy_file(p, p, opts, ec)), bool);
+ ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p));
+ ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p, opts));
+ ASSERT_NOEXCEPT(fs::copy_file(p, p, ec));
+ ASSERT_NOEXCEPT(fs::copy_file(p, p, opts, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::copy_file(f, t);
+ return false;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.path2() == t
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+ const path file2 = env.create_file("file2", 55);
+ const path dne = env.make_env_path("dne");
+ { // exists(to) && equivalent(to, from)
+ std::error_code ec;
+ TEST_CHECK(fs::copy_file(file, file, ec) == false);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(file, file, ec));
+ }
+ { // exists(to) && !(skip_existing | overwrite_existing | update_existing)
+ std::error_code ec;
+ TEST_CHECK(fs::copy_file(file, file2, ec) == false);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(file, file2, ec));
+ }
+}
+
+TEST_CASE(copy_file)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+
+ { // !exists(to)
+ const path dest = env.make_env_path("dest1");
+ std::error_code ec;
+ TEST_REQUIRE(fs::copy_file(file, dest, ec) == true);
+ TEST_CHECK(!ec);
+ TEST_CHECK(file_size(dest) == 42);
+ }
+ { // exists(to) && overwrite_existing
+ const path dest = env.create_file("dest2", 55);
+ std::error_code ec;
+ TEST_REQUIRE(fs::copy_file(file, dest,
+ copy_options::overwrite_existing, ec) == true);
+ TEST_CHECK(!ec);
+ TEST_CHECK(file_size(dest) == 42);
+ }
+ { // exists(to) && update_existing
+ using Sec = std::chrono::seconds;
+ const path older = env.create_file("older_file", 1);
+
+ SleepFor(Sec(2));
+ const path from = env.create_file("update_from", 55);
+
+ SleepFor(Sec(2));
+ const path newer = env.create_file("newer_file", 2);
+
+ std::error_code ec;
+ TEST_REQUIRE(fs::copy_file(from, older, copy_options::update_existing, ec) == true);
+ TEST_CHECK(!ec);
+ TEST_CHECK(file_size(older) == 55);
+
+ TEST_REQUIRE(fs::copy_file(from, newer, copy_options::update_existing, ec) == false);
+ TEST_CHECK(!ec);
+ TEST_CHECK(file_size(newer) == 2);
+ }
+ { // skip_existing
+ const path file2 = env.create_file("file2", 55);
+ std::error_code ec;
+ TEST_REQUIRE(fs::copy_file(file, file2, copy_options::skip_existing, ec) == false);
+ TEST_CHECK(!ec);
+ TEST_CHECK(file_size(file2) == 55);
+ }
+}
+
+TEST_CASE(test_attributes_get_copied)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+ const path dest = env.make_env_path("file2");
+ auto st = status(file);
+ perms default_perms = st.permissions();
+ perms new_perms = perms::owner_read;
+ permissions(file, new_perms);
+ std::error_code ec;
+ TEST_REQUIRE(fs::copy_file(file, dest, ec) == true);
+ TEST_CHECK(!ec);
+ auto new_st = status(dest);
+ TEST_CHECK(new_st.permissions() == new_perms);
+}
+
+TEST_CASE(copy_dir_test)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+ const path dest = env.create_dir("dir1");
+ std::error_code ec;
+ TEST_CHECK(fs::copy_file(file, dest, ec) == false);
+ TEST_CHECK(ec);
+ ec.clear();
+ TEST_CHECK(fs::copy_file(dest, file, ec) == false);
+ TEST_CHECK(ec);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
new file mode 100644
index 000000000000..6fae11195206
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
@@ -0,0 +1,108 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// void copy_symlink(const path& existing_symlink, const path& new_symlink);
+// void copy_symlink(const path& existing_symlink, const path& new_symlink,
+// error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_copy_symlink_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(fs::copy_symlink(p, p));
+ ASSERT_NOEXCEPT(fs::copy_symlink(p, p, ec));
+}
+
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::copy_symlink(f, t);
+ return true;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+ const path file2 = env.create_file("file2", 55);
+ const path sym = env.create_symlink(file, "sym");
+ const path dir = env.create_dir("dir");
+ const path dne = env.make_env_path("dne");
+ { // from is a file, not a symlink
+ std::error_code ec;
+ fs::copy_symlink(file, dne, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(file, dne, ec));
+ }
+ { // from is a file, not a symlink
+ std::error_code ec;
+ fs::copy_symlink(dir, dne, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(dir, dne, ec));
+ }
+ { // destination exists
+ std::error_code ec;
+ fs::copy_symlink(sym, file2, ec);
+ TEST_REQUIRE(ec);
+ }
+}
+
+TEST_CASE(copy_symlink_basic)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path dir_sym = env.create_symlink(dir, "dir_sym");
+ const path file = env.create_file("file", 42);
+ const path file_sym = env.create_symlink(file, "file_sym");
+ { // test for directory symlinks
+ const path dest = env.make_env_path("dest1");
+ std::error_code ec;
+ fs::copy_symlink(dir_sym, dest, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(is_symlink(dest));
+ TEST_CHECK(equivalent(dest, dir));
+ }
+ { // test for file symlinks
+ const path dest = env.make_env_path("dest2");
+ std::error_code ec;
+ fs::copy_symlink(file_sym, dest, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(is_symlink(dest));
+ TEST_CHECK(equivalent(dest, file));
+ }
+}
+
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
new file mode 100644
index 000000000000..ba060254956f
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool create_directories(const path& p);
+// bool create_directories(const path& p, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_create_directories_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(fs::create_directories(p)), bool);
+ ASSERT_SAME_TYPE(decltype(fs::create_directories(p, ec)), bool);
+ ASSERT_NOT_NOEXCEPT(fs::create_directories(p));
+ ASSERT_NOEXCEPT(fs::create_directories(p, ec));
+}
+
+TEST_CASE(create_existing_directory)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir1");
+ std::error_code ec;
+ TEST_CHECK(fs::create_directories(dir, ec) == false);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_directory(dir));
+}
+
+TEST_CASE(create_directory_one_level)
+{
+ scoped_test_env env;
+ const path dir = env.make_env_path("dir1");
+ std::error_code ec;
+ TEST_CHECK(fs::create_directories(dir, ec) == true);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_directory(dir));
+}
+
+TEST_CASE(create_directories_multi_level)
+{
+ scoped_test_env env;
+ const path dir = env.make_env_path("dir1/dir2/dir3");
+ std::error_code ec;
+ TEST_CHECK(fs::create_directories(dir, ec) == true);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_directory(dir));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
new file mode 100644
index 000000000000..5fce217bc49e
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool create_directory(const path& p);
+// bool create_directory(const path& p, error_code& ec) noexcept;
+// bool create_directory(const path& p, const path& attr);
+// bool create_directory(const path& p, const path& attr, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+fs::perms read_umask() {
+ mode_t old_mask = umask(0);
+ umask(old_mask); // reset the mask to the old value.
+ return static_cast<fs::perms>(old_mask);
+}
+
+TEST_SUITE(filesystem_create_directory_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(fs::create_directory(p)), bool);
+ ASSERT_SAME_TYPE(decltype(fs::create_directory(p, ec)), bool);
+ ASSERT_SAME_TYPE(decltype(fs::create_directory(p, p)), bool);
+ ASSERT_SAME_TYPE(decltype(fs::create_directory(p, p, ec)), bool);
+ ASSERT_NOT_NOEXCEPT(fs::create_directory(p));
+ ASSERT_NOEXCEPT(fs::create_directory(p, ec));
+ ASSERT_NOT_NOEXCEPT(fs::create_directory(p, p));
+ ASSERT_NOEXCEPT(fs::create_directory(p, p, ec));
+}
+
+
+TEST_CASE(create_existing_directory)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir1");
+ std::error_code ec;
+ TEST_CHECK(fs::create_directory(dir, ec) == false);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_directory(dir));
+ // Test throwing version
+ TEST_CHECK(fs::create_directory(dir) == false);
+}
+
+TEST_CASE(create_directory_one_level)
+{
+ scoped_test_env env;
+ const path dir = env.make_env_path("dir1");
+ std::error_code ec;
+ TEST_CHECK(fs::create_directory(dir, ec) == true);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_directory(dir));
+
+ auto st = status(dir);
+ const perms expect_perms = perms::all & ~(read_umask());
+ TEST_CHECK((st.permissions() & perms::all) == expect_perms);
+}
+
+TEST_CASE(create_directory_multi_level)
+{
+ scoped_test_env env;
+ const path dir = env.make_env_path("dir1/dir2");
+ const path dir1 = env.make_env_path("dir1");
+ std::error_code ec;
+ TEST_CHECK(fs::create_directory(dir, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(!is_directory(dir));
+ TEST_CHECK(!is_directory(dir1));
+}
+
+TEST_CASE(dest_is_file)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file", 42);
+ std::error_code ec;
+ TEST_CHECK(fs::create_directory(file, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(is_regular_file(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
new file mode 100644
index 000000000000..c32bdd2d1928
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool create_directory(const path& p, const path& attr);
+// bool create_directory(const path& p, const path& attr, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_create_directory_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(fs::create_directory(p, p)), bool);
+ ASSERT_SAME_TYPE(decltype(fs::create_directory(p, p, ec)), bool);
+ ASSERT_NOT_NOEXCEPT(fs::create_directory(p, p));
+ ASSERT_NOEXCEPT(fs::create_directory(p, p, ec));
+}
+
+TEST_CASE(create_existing_directory)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir1");
+ const path dir2 = env.create_dir("dir2");
+
+ const perms orig_p = status(dir).permissions();
+ permissions(dir2, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(fs::create_directory(dir, dir2, ec) == false);
+ TEST_CHECK(!ec);
+
+ // Check that the permissions were unchanged
+ TEST_CHECK(orig_p == status(dir).permissions());
+
+ // Test throwing version
+ TEST_CHECK(fs::create_directory(dir, dir2) == false);
+}
+
+TEST_CASE(create_directory_one_level)
+{
+ scoped_test_env env;
+ // Remove setgid which mkdir would inherit
+ permissions(env.test_root, perms::remove_perms | perms::set_gid);
+
+ const path dir = env.make_env_path("dir1");
+ const path attr_dir = env.create_dir("dir2");
+ permissions(attr_dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(fs::create_directory(dir, attr_dir, ec) == true);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_directory(dir));
+
+ // Check that the new directory has the same permissions as attr_dir
+ auto st = status(dir);
+ TEST_CHECK(st.permissions() == perms::none);
+}
+
+TEST_CASE(create_directory_multi_level)
+{
+ scoped_test_env env;
+ const path dir = env.make_env_path("dir1/dir2");
+ const path dir1 = env.make_env_path("dir1");
+ const path attr_dir = env.create_dir("attr_dir");
+ std::error_code ec;
+ TEST_CHECK(fs::create_directory(dir, attr_dir, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(!is_directory(dir));
+ TEST_CHECK(!is_directory(dir1));
+}
+
+TEST_CASE(dest_is_file)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file", 42);
+ const path attr_dir = env.create_dir("attr_dir");
+ std::error_code ec;
+ TEST_CHECK(fs::create_directory(file, attr_dir, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(is_regular_file(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
new file mode 100644
index 000000000000..e0473754cc88
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// void create_directory_symlink(const path& existing_symlink, const path& new_symlink);
+// void create_directory_symlink(const path& existing_symlink, const path& new_symlink,
+// error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_create_directory_symlink_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(fs::create_directory_symlink(p, p));
+ ASSERT_NOEXCEPT(fs::create_directory_symlink(p, p, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::create_directory_symlink(f, t);
+ return true;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+ const path file2 = env.create_file("file2", 55);
+ const path sym = env.create_symlink(file, "sym");
+ { // destination exists
+ std::error_code ec;
+ fs::create_directory_symlink(sym, file2, ec);
+ TEST_REQUIRE(ec);
+ }
+}
+
+TEST_CASE(create_directory_symlink_basic)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path dir_sym = env.create_symlink(dir, "dir_sym");
+
+ const path dest = env.make_env_path("dest1");
+ std::error_code ec;
+ fs::create_directory_symlink(dir_sym, dest, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(is_symlink(dest));
+ TEST_CHECK(equivalent(dest, dir));
+}
+
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
new file mode 100644
index 000000000000..4a865fdee7e8
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// void create_hard_link(const path& existing_symlink, const path& new_symlink);
+// void create_hard_link(const path& existing_symlink, const path& new_symlink,
+// error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_create_hard_link_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(fs::create_hard_link(p, p));
+ ASSERT_NOEXCEPT(fs::create_hard_link(p, p, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::create_hard_link(f, t);
+ return true;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+ const path file2 = env.create_file("file2", 55);
+ const path sym = env.create_symlink(file, "sym");
+ { // destination exists
+ std::error_code ec;
+ fs::create_hard_link(sym, file2, ec);
+ TEST_REQUIRE(ec);
+ }
+}
+
+TEST_CASE(create_file_hard_link)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file");
+ const path dest = env.make_env_path("dest1");
+ std::error_code ec;
+ TEST_CHECK(hard_link_count(file) == 1);
+ fs::create_hard_link(file, dest, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(exists(dest));
+ TEST_CHECK(equivalent(dest, file));
+ TEST_CHECK(hard_link_count(file) == 2);
+}
+
+TEST_CASE(create_directory_hard_link_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path dest = env.make_env_path("dest2");
+ std::error_code ec;
+
+ fs::create_hard_link(dir, dest, ec);
+ TEST_REQUIRE(ec);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
new file mode 100644
index 000000000000..35ba57f3ab46
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// void create_symlink(const path& existing_symlink, const path& new_symlink);
+// void create_symlink(const path& existing_symlink, const path& new_symlink,
+// error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_create_symlink_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(fs::create_symlink(p, p));
+ ASSERT_NOEXCEPT(fs::create_symlink(p, p, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::create_symlink(f, t);
+ return true;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+ const path file2 = env.create_file("file2", 55);
+ const path sym = env.create_symlink(file, "sym");
+ { // destination exists
+ std::error_code ec;
+ fs::create_symlink(sym, file2, ec);
+ TEST_REQUIRE(ec);
+ }
+}
+
+TEST_CASE(create_symlink_basic)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file", 42);
+ const path file_sym = env.create_symlink(file, "file_sym");
+ const path dir = env.create_dir("dir");
+ const path dir_sym = env.create_symlink(dir, "dir_sym");
+ {
+ const path dest = env.make_env_path("dest1");
+ std::error_code ec;
+ fs::create_symlink(file_sym, dest, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(is_symlink(dest));
+ TEST_CHECK(equivalent(dest, file));
+ }
+ {
+ const path dest = env.make_env_path("dest2");
+ std::error_code ec;
+ fs::create_symlink(dir_sym, dest, ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(is_symlink(dest));
+ TEST_CHECK(equivalent(dest, dir));
+ }
+}
+
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
new file mode 100644
index 000000000000..9d004ab854c1
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
@@ -0,0 +1,93 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// path current_path();
+// path current_path(error_code& ec);
+// void current_path(path const&);
+// void current_path(path const&, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(filesystem_current_path_path_test_suite)
+
+TEST_CASE(current_path_signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(current_path());
+ ASSERT_NOT_NOEXCEPT(current_path(ec));
+ ASSERT_NOT_NOEXCEPT(current_path(p));
+ ASSERT_NOEXCEPT(current_path(p, ec));
+}
+
+TEST_CASE(current_path_test)
+{
+ std::error_code ec;
+ const path p = current_path(ec);
+ TEST_REQUIRE(!ec);
+ TEST_CHECK(p.is_absolute());
+ TEST_CHECK(is_directory(p));
+
+ const path p2 = current_path();
+ TEST_CHECK(p2 == p);
+}
+
+TEST_CASE(current_path_after_change_test)
+{
+ const path new_path = StaticEnv::Dir;
+ current_path(new_path);
+ TEST_CHECK(current_path() == new_path);
+}
+
+TEST_CASE(current_path_is_file_test)
+{
+ const path p = StaticEnv::File;
+ std::error_code ec;
+ const path old_p = current_path();
+ current_path(p, ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(old_p == current_path());
+}
+
+TEST_CASE(set_to_non_absolute_path)
+{
+ const path base = StaticEnv::Dir;
+ current_path(base);
+ const path p = StaticEnv::Dir2.filename();
+ std::error_code ec;
+ current_path(p, ec);
+ TEST_CHECK(!ec);
+ const path new_cwd = current_path();
+ TEST_CHECK(new_cwd == StaticEnv::Dir2);
+ TEST_CHECK(new_cwd.is_absolute());
+}
+
+TEST_CASE(set_to_empty)
+{
+ const path p = "";
+ std::error_code ec;
+ const path old_p = current_path();
+ current_path(p, ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(old_p == current_path());
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp
new file mode 100644
index 000000000000..621ff8305fc3
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool equivalent(path const& lhs, path const& rhs);
+// bool equivalent(path const& lhs, path const& rhs, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(equivalent_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(equivalent(p, p, ec));
+ ASSERT_NOT_NOEXCEPT(equivalent(p, p));
+}
+
+TEST_CASE(equivalent_test)
+{
+ struct TestCase {
+ path lhs;
+ path rhs;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {StaticEnv::Dir, StaticEnv::Dir, true},
+ {StaticEnv::File, StaticEnv::Dir, false},
+ {StaticEnv::Dir, StaticEnv::SymlinkToDir, true},
+ {StaticEnv::Dir, StaticEnv::SymlinkToFile, false},
+ {StaticEnv::File, StaticEnv::File, true},
+ {StaticEnv::File, StaticEnv::SymlinkToFile, true},
+ };
+ for (auto& TC : testCases) {
+ std::error_code ec;
+ TEST_CHECK(equivalent(TC.lhs, TC.rhs, ec) == TC.expect);
+ TEST_CHECK(!ec);
+ }
+}
+
+TEST_CASE(equivalent_reports_double_dne)
+{
+ const path E = StaticEnv::File;
+ const path DNE = StaticEnv::DNE;
+ { // Test that no exception is thrown if one of the paths exists
+ TEST_CHECK(equivalent(E, DNE) == false);
+ TEST_CHECK(equivalent(DNE, E) == false);
+ }
+ { // Test that an exception is thrown if both paths do not exist.
+ TEST_CHECK_THROW(filesystem_error, equivalent(DNE, DNE));
+ }
+ {
+ std::error_code ec;
+ TEST_CHECK(equivalent(DNE, DNE, ec) == false);
+ TEST_CHECK(ec);
+ }
+}
+
+TEST_CASE(equivalent_is_other_succeeds)
+{
+ scoped_test_env env;
+ path const file = env.create_file("file", 42);
+ const path hl1 = env.create_hardlink(file, "hl1");
+ const path hl2 = env.create_hardlink(file, "hl2");
+ TEST_CHECK(equivalent(file, hl1));
+ TEST_CHECK(equivalent(file, hl2));
+ TEST_CHECK(equivalent(hl1, hl2));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp
new file mode 100644
index 000000000000..252ced6fd65f
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool exists(file_status s) noexcept
+// bool exists(path const& p);
+// bool exists(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(exists_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(exists(s));
+ ASSERT_NOEXCEPT(exists(p, ec));
+ ASSERT_NOT_NOEXCEPT(exists(p));
+}
+
+TEST_CASE(exists_status_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, false},
+ {file_type::regular, true},
+ {file_type::directory, true},
+ {file_type::symlink, true},
+ {file_type::block, true},
+ {file_type::character, true},
+ {file_type::fifo, true},
+ {file_type::socket, true},
+ {file_type::unknown, true}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(exists(s) == TC.expect);
+ }
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ TEST_CHECK(exists(p) == false);
+
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(exists(p, ec) == false);
+ TEST_CHECK(!ec);
+}
+
+TEST_CASE(test_exists_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(exists(file, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, exists(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
new file mode 100644
index 000000000000..460e42dd1c3f
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// uintmax_t file_size(const path& p);
+// uintmax_t file_size(const path& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(file_size_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(file_size(p)), uintmax_t);
+ ASSERT_SAME_TYPE(decltype(file_size(p, ec)), uintmax_t);
+ ASSERT_NOT_NOEXCEPT(file_size(p));
+ ASSERT_NOEXCEPT(file_size(p, ec));
+}
+
+TEST_CASE(file_size_empty_test)
+{
+ const path p = StaticEnv::EmptyFile;
+ TEST_CHECK(file_size(p) == 0);
+ std::error_code ec;
+ TEST_CHECK(file_size(p, ec) == 0);
+}
+
+TEST_CASE(file_size_non_empty)
+{
+ scoped_test_env env;
+ const path p = env.create_file("file", 42);
+ TEST_CHECK(file_size(p) == 42);
+ std::error_code ec;
+ TEST_CHECK(file_size(p, ec) == 42);
+}
+
+TEST_CASE(symlink_test_case)
+{
+ const path p = StaticEnv::File;
+ const path p2 = StaticEnv::SymlinkToFile;
+ TEST_CHECK(file_size(p) == file_size(p2));
+}
+
+TEST_CASE(file_size_error_cases)
+{
+ const path testCases[] = {
+ StaticEnv::Dir,
+ StaticEnv::SymlinkToDir,
+ StaticEnv::BadSymlink,
+ StaticEnv::DNE
+ };
+ const uintmax_t expect = static_cast<uintmax_t>(-1);
+ for (auto& TC : testCases) {
+ std::error_code ec;
+ TEST_CHECK(file_size(TC, ec) == expect);
+ TEST_CHECK(ec);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
new file mode 100644
index 000000000000..abc50e9c6a41
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// uintmax_t hard_link_count(const path& p);
+// uintmax_t hard_link_count(const path& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(hard_link_count_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(hard_link_count(p)), uintmax_t);
+ ASSERT_SAME_TYPE(decltype(hard_link_count(p, ec)), uintmax_t);
+ ASSERT_NOT_NOEXCEPT(hard_link_count(p));
+ ASSERT_NOEXCEPT(hard_link_count(p, ec));
+}
+
+TEST_CASE(hard_link_count_for_file)
+{
+ TEST_CHECK(hard_link_count(StaticEnv::File) == 1);
+ std::error_code ec;
+ TEST_CHECK(hard_link_count(StaticEnv::File, ec) == 1);
+}
+
+TEST_CASE(hard_link_count_for_directory)
+{
+ uintmax_t DirExpect = 3;
+ uintmax_t Dir3Expect = 2;
+#if defined(__APPLE__)
+ DirExpect += 2;
+ Dir3Expect += 1;
+#endif
+ TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect);
+
+ std::error_code ec;
+ TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect);
+}
+TEST_CASE(hard_link_count_increments_test)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file", 42);
+ TEST_CHECK(hard_link_count(file) == 1);
+
+ env.create_hardlink(file, "file_hl");
+ TEST_CHECK(hard_link_count(file) == 2);
+}
+
+
+TEST_CASE(hard_link_count_error_cases)
+{
+ const path testCases[] = {
+ StaticEnv::BadSymlink,
+ StaticEnv::DNE
+ };
+ const uintmax_t expect = static_cast<uintmax_t>(-1);
+ for (auto& TC : testCases) {
+ std::error_code ec;
+ TEST_CHECK(hard_link_count(TC, ec) == expect);
+ TEST_CHECK(ec);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp
new file mode 100644
index 000000000000..dee28aa5be61
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool is_block_file(file_status s) noexcept
+// bool is_block_file(path const& p);
+// bool is_block_file(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(is_block_file_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(is_block_file(s));
+ ASSERT_NOEXCEPT(is_block_file(p, ec));
+ ASSERT_NOT_NOEXCEPT(is_block_file(p));
+}
+
+TEST_CASE(is_block_file_status_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, false},
+ {file_type::regular, false},
+ {file_type::directory, false},
+ {file_type::symlink, false},
+ {file_type::block, true},
+ {file_type::character, false},
+ {file_type::fifo, false},
+ {file_type::socket, false},
+ {file_type::unknown, false}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(is_block_file(s) == TC.expect);
+ }
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ TEST_CHECK(is_block_file(p) == false);
+}
+
+TEST_CASE(test_is_block_file_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(is_block_file(file, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, is_block_file(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp
new file mode 100644
index 000000000000..2de42bf20975
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool is_character_file(file_status s) noexcept
+// bool is_character_file(path const& p);
+// bool is_character_file(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(is_character_file_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(is_character_file(s));
+ ASSERT_NOEXCEPT(is_character_file(p, ec));
+ ASSERT_NOT_NOEXCEPT(is_character_file(p));
+}
+
+TEST_CASE(is_character_file_status_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, false},
+ {file_type::regular, false},
+ {file_type::directory, false},
+ {file_type::symlink, false},
+ {file_type::block, false},
+ {file_type::character, true},
+ {file_type::fifo, false},
+ {file_type::socket, false},
+ {file_type::unknown, false}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(is_character_file(s) == TC.expect);
+ }
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ TEST_CHECK(is_character_file(p) == false);
+}
+
+TEST_CASE(test_is_character_file_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(is_character_file(file, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, is_character_file(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp
new file mode 100644
index 000000000000..d6ecb1a1e684
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool is_directory(file_status s) noexcept
+// bool is_directory(path const& p);
+// bool is_directory(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(is_directory_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(is_directory(s));
+ ASSERT_NOEXCEPT(is_directory(p, ec));
+ ASSERT_NOT_NOEXCEPT(is_directory(p));
+}
+
+TEST_CASE(is_directory_status_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, false},
+ {file_type::regular, false},
+ {file_type::directory, true},
+ {file_type::symlink, false},
+ {file_type::block, false},
+ {file_type::character, false},
+ {file_type::fifo, false},
+ {file_type::socket, false},
+ {file_type::unknown, false}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(is_directory(s) == TC.expect);
+ }
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ TEST_CHECK(is_directory(p) == false);
+}
+
+TEST_CASE(static_env_test)
+{
+ TEST_CHECK(is_directory(StaticEnv::Dir));
+ TEST_CHECK(is_directory(StaticEnv::SymlinkToDir));
+ TEST_CHECK(!is_directory(StaticEnv::File));
+}
+
+TEST_CASE(test_is_directory_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path dir2 = env.create_dir("dir/dir2");
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(is_directory(dir2, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, is_directory(dir2));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
new file mode 100644
index 000000000000..ba07d09d10d9
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool is_empty(path const& p);
+// bool is_empty(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(is_empty_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(is_empty(p, ec));
+ ASSERT_NOT_NOEXCEPT(is_empty(p));
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ std::error_code ec;
+ TEST_CHECK(is_empty(p, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK_THROW(filesystem_error, is_empty(p));
+}
+
+TEST_CASE(test_is_empty_directory)
+{
+ TEST_CHECK(!is_empty(StaticEnv::Dir));
+ TEST_CHECK(!is_empty(StaticEnv::SymlinkToDir));
+}
+
+TEST_CASE(test_is_empty_directory_dynamic)
+{
+ scoped_test_env env;
+ TEST_CHECK(is_empty(env.test_root));
+ env.create_file("foo", 42);
+ TEST_CHECK(!is_empty(env.test_root));
+}
+
+TEST_CASE(test_is_empty_file)
+{
+ TEST_CHECK(is_empty(StaticEnv::EmptyFile));
+ TEST_CHECK(!is_empty(StaticEnv::NonEmptyFile));
+}
+
+TEST_CASE(test_is_empty_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path dir2 = env.create_dir("dir/dir2");
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(is_empty(dir2, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, is_empty(dir2));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp
new file mode 100644
index 000000000000..44892f65d86e
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool is_fifo(file_status s) noexcept
+// bool is_fifo(path const& p);
+// bool is_fifo(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(is_fifo_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(is_fifo(s));
+ ASSERT_NOEXCEPT(is_fifo(p, ec));
+ ASSERT_NOT_NOEXCEPT(is_fifo(p));
+}
+
+TEST_CASE(is_fifo_status_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, false},
+ {file_type::regular, false},
+ {file_type::directory, false},
+ {file_type::symlink, false},
+ {file_type::block, false},
+ {file_type::character, false},
+ {file_type::fifo, true},
+ {file_type::socket, false},
+ {file_type::unknown, false}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(is_fifo(s) == TC.expect);
+ }
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ TEST_CHECK(is_fifo(p) == false);
+}
+
+TEST_CASE(test_is_fifo_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(is_fifo(file, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, is_fifo(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp
new file mode 100644
index 000000000000..e86b66b4ea64
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool is_other(file_status s) noexcept
+// bool is_other(path const& p);
+// bool is_other(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(is_other_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(is_other(s));
+ ASSERT_NOEXCEPT(is_other(p, ec));
+ ASSERT_NOT_NOEXCEPT(is_other(p));
+}
+
+TEST_CASE(is_other_status_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, false},
+ {file_type::regular, false},
+ {file_type::directory, false},
+ {file_type::symlink, false},
+ {file_type::block, true},
+ {file_type::character, true},
+ {file_type::fifo, true},
+ {file_type::socket, true},
+ {file_type::unknown, true}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(is_other(s) == TC.expect);
+ }
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ TEST_CHECK(is_other(p) == false);
+}
+
+TEST_CASE(test_is_other_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(is_other(file, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, is_other(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp
new file mode 100644
index 000000000000..be68dcfc35de
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool is_regular_file(file_status s) noexcept
+// bool is_regular_file(path const& p);
+// bool is_regular_file(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(is_regular_file_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(is_regular_file(s));
+ ASSERT_NOEXCEPT(is_regular_file(p, ec));
+ ASSERT_NOT_NOEXCEPT(is_regular_file(p));
+}
+
+TEST_CASE(is_regular_file_status_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, false},
+ {file_type::regular, true},
+ {file_type::directory, false},
+ {file_type::symlink, false},
+ {file_type::block, false},
+ {file_type::character, false},
+ {file_type::fifo, false},
+ {file_type::socket, false},
+ {file_type::unknown, false}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(is_regular_file(s) == TC.expect);
+ }
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ TEST_CHECK(is_regular_file(p) == false);
+ std::error_code ec;
+ TEST_CHECK(is_regular_file(p, ec) == false);
+ TEST_CHECK(ec);
+}
+
+TEST_CASE(test_is_regular_file_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(is_regular_file(file, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, is_regular_file(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp
new file mode 100644
index 000000000000..49fd402eb546
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool is_socket(file_status s) noexcept
+// bool is_socket(path const& p);
+// bool is_socket(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(is_socket_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(is_socket(s));
+ ASSERT_NOEXCEPT(is_socket(p, ec));
+ ASSERT_NOT_NOEXCEPT(is_socket(p));
+}
+
+TEST_CASE(is_socket_status_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, false},
+ {file_type::regular, false},
+ {file_type::directory, false},
+ {file_type::symlink, false},
+ {file_type::block, false},
+ {file_type::character, false},
+ {file_type::fifo, false},
+ {file_type::socket, true},
+ {file_type::unknown, false}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(is_socket(s) == TC.expect);
+ }
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ TEST_CHECK(is_socket(p) == false);
+}
+
+TEST_CASE(test_is_socket_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(is_socket(file, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, is_socket(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp
new file mode 100644
index 000000000000..3de002978683
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp
@@ -0,0 +1,105 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool is_symlink(file_status s) noexcept
+// bool is_symlink(path const& p);
+// bool is_symlink(path const& p, std::error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(is_symlink_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOEXCEPT(is_symlink(s));
+ ASSERT_NOEXCEPT(is_symlink(p, ec));
+ ASSERT_NOT_NOEXCEPT(is_symlink(p));
+}
+
+TEST_CASE(is_symlink_status_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, false},
+ {file_type::regular, false},
+ {file_type::directory, false},
+ {file_type::symlink, true},
+ {file_type::block, false},
+ {file_type::character, false},
+ {file_type::fifo, false},
+ {file_type::socket, false},
+ {file_type::unknown, false}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(is_symlink(s) == TC.expect);
+ }
+}
+
+TEST_CASE(static_env_test)
+{
+ struct TestCase {
+ path p;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {StaticEnv::File, false},
+ {StaticEnv::Dir, false},
+ {StaticEnv::SymlinkToFile, true},
+ {StaticEnv::SymlinkToDir, true},
+ {StaticEnv::BadSymlink, true}
+ };
+ for (auto& TC : testCases) {
+ TEST_CHECK(is_symlink(TC.p) == TC.expect);
+ }
+}
+
+TEST_CASE(test_exist_not_found)
+{
+ const path p = StaticEnv::DNE;
+ TEST_CHECK(is_symlink(p) == false);
+ std::error_code ec;
+ TEST_CHECK(is_symlink(p, ec) == false);
+ TEST_CHECK(ec);
+}
+
+TEST_CASE(test_is_symlink_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec;
+ TEST_CHECK(is_symlink(file, ec) == false);
+ TEST_CHECK(ec);
+
+ TEST_CHECK_THROW(filesystem_error, is_symlink(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
new file mode 100644
index 000000000000..3c61b26d18e0
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
@@ -0,0 +1,361 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// file_time_type last_write_time(const path& p);
+// file_time_type last_write_time(const path& p, std::error_code& ec) noexcept;
+// void last_write_time(const path& p, file_time_type new_time);
+// void last_write_time(const path& p, file_time_type new_type,
+// std::error_code& ec) noexcept;
+
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <chrono>
+#include <fstream>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+#include <sys/stat.h>
+#include <iostream>
+
+using namespace std::experimental::filesystem;
+
+
+std::pair<std::time_t, std::time_t> GetTimes(path const& p) {
+ using Clock = file_time_type::clock;
+ struct ::stat st;
+ if (::stat(p.c_str(), &st) == -1) {
+ std::error_code ec(errno, std::generic_category());
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw ec;
+#else
+ std::cerr << ec.message() << std::endl;
+ std::exit(EXIT_FAILURE);
+#endif
+ }
+ return {st.st_atime, st.st_mtime};
+}
+
+std::time_t LastAccessTime(path const& p) {
+ return GetTimes(p).first;
+}
+
+std::time_t LastWriteTime(path const& p) {
+ return GetTimes(p).second;
+}
+
+std::pair<std::time_t, std::time_t> GetSymlinkTimes(path const& p) {
+ using Clock = file_time_type::clock;
+ struct ::stat st;
+ if (::lstat(p.c_str(), &st) == -1) {
+ std::error_code ec(errno, std::generic_category());
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw ec;
+#else
+ std::cerr << ec.message() << std::endl;
+ std::exit(EXIT_FAILURE);
+#endif
+ }
+ return {st.st_atime, st.st_mtime};
+}
+
+inline bool TimeIsRepresentableAsTimeT(file_time_type tp) {
+ using namespace std::chrono;
+ using Lim = std::numeric_limits<std::time_t>;
+ auto sec = duration_cast<seconds>(tp.time_since_epoch()).count();
+ return (sec >= Lim::min() && sec <= Lim::max());
+}
+
+
+TEST_SUITE(exists_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const file_time_type t;
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(last_write_time(p)), file_time_type);
+ ASSERT_SAME_TYPE(decltype(last_write_time(p, ec)), file_time_type);
+ ASSERT_SAME_TYPE(decltype(last_write_time(p, t)), void);
+ ASSERT_SAME_TYPE(decltype(last_write_time(p, t, ec)), void);
+ ASSERT_NOT_NOEXCEPT(last_write_time(p));
+ ASSERT_NOT_NOEXCEPT(last_write_time(p, t));
+ ASSERT_NOEXCEPT(last_write_time(p, ec));
+ ASSERT_NOEXCEPT(last_write_time(p, t, ec));
+}
+
+TEST_CASE(read_last_write_time_static_env_test)
+{
+ using C = file_time_type::clock;
+ file_time_type min = file_time_type::min();
+ {
+ file_time_type ret = last_write_time(StaticEnv::File);
+ TEST_CHECK(ret != min);
+ TEST_CHECK(ret < C::now());
+ TEST_CHECK(C::to_time_t(ret) == LastWriteTime(StaticEnv::File));
+
+ file_time_type ret2 = last_write_time(StaticEnv::SymlinkToFile);
+ TEST_CHECK(ret == ret2);
+ TEST_CHECK(C::to_time_t(ret2) == LastWriteTime(StaticEnv::SymlinkToFile));
+ }
+ {
+ file_time_type ret = last_write_time(StaticEnv::Dir);
+ TEST_CHECK(ret != min);
+ TEST_CHECK(ret < C::now());
+ TEST_CHECK(C::to_time_t(ret) == LastWriteTime(StaticEnv::Dir));
+
+ file_time_type ret2 = last_write_time(StaticEnv::SymlinkToDir);
+ TEST_CHECK(ret == ret2);
+ TEST_CHECK(C::to_time_t(ret2) == LastWriteTime(StaticEnv::SymlinkToDir));
+ }
+}
+
+TEST_CASE(get_last_write_time_dynamic_env_test)
+{
+ using Clock = file_time_type::clock;
+ using Sec = std::chrono::seconds;
+ scoped_test_env env;
+
+ const path file = env.create_file("file", 42);
+ const path dir = env.create_dir("dir");
+
+ const auto file_times = GetTimes(file);
+ const std::time_t file_access_time = file_times.first;
+ const std::time_t file_write_time = file_times.second;
+ const auto dir_times = GetTimes(dir);
+ const std::time_t dir_access_time = dir_times.first;
+ const std::time_t dir_write_time = dir_times.second;
+
+ file_time_type ftime = last_write_time(file);
+ TEST_CHECK(Clock::to_time_t(ftime) == file_write_time);
+
+ file_time_type dtime = last_write_time(dir);
+ TEST_CHECK(Clock::to_time_t(dtime) == dir_write_time);
+
+ SleepFor(Sec(2));
+
+ // update file and add a file to the directory. Make sure the times increase.
+ std::ofstream of(file, std::ofstream::app);
+ of << "hello";
+ of.close();
+ env.create_file("dir/file1", 1);
+
+ file_time_type ftime2 = last_write_time(file);
+ file_time_type dtime2 = last_write_time(dir);
+
+ TEST_CHECK(ftime2 > ftime);
+ TEST_CHECK(dtime2 > dtime);
+ TEST_CHECK(LastAccessTime(file) == file_access_time);
+ TEST_CHECK(LastAccessTime(dir) == dir_access_time);
+}
+
+
+TEST_CASE(set_last_write_time_dynamic_env_test)
+{
+ using Clock = file_time_type::clock;
+ using Sec = std::chrono::seconds;
+ using Hours = std::chrono::hours;
+ using Minutes = std::chrono::minutes;
+ using MicroSec = std::chrono::microseconds;
+ scoped_test_env env;
+
+ const path file = env.create_file("file", 42);
+ const path dir = env.create_dir("dir");
+ const auto now = Clock::now();
+ const file_time_type epoch_time = now - now.time_since_epoch();
+
+ const file_time_type future_time = now + Hours(3) + Sec(42) + MicroSec(17);
+ const file_time_type past_time = now - Minutes(3) - Sec(42) - MicroSec(17);
+ const file_time_type before_epoch_time = epoch_time - Minutes(3) - Sec(42) - MicroSec(17);
+ // FreeBSD has a bug in their utimes implementation where the time is not update
+ // when the number of seconds is '-1'.
+#if defined(__FreeBSD__)
+ const file_time_type just_before_epoch_time = epoch_time - Sec(2) - MicroSec(17);
+#else
+ const file_time_type just_before_epoch_time = epoch_time - MicroSec(17);
+#endif
+
+ struct TestCase {
+ path p;
+ file_time_type new_time;
+ } cases[] = {
+ {file, epoch_time},
+ {dir, epoch_time},
+ {file, future_time},
+ {dir, future_time},
+ {file, past_time},
+ {dir, past_time},
+ {file, before_epoch_time},
+ {dir, before_epoch_time},
+ {file, just_before_epoch_time},
+ {dir, just_before_epoch_time}
+ };
+ for (const auto& TC : cases) {
+ const auto old_times = GetTimes(TC.p);
+ file_time_type old_time(Sec(old_times.second));
+
+ std::error_code ec = GetTestEC();
+ last_write_time(TC.p, TC.new_time, ec);
+ TEST_CHECK(!ec);
+
+ file_time_type got_time = last_write_time(TC.p);
+
+ TEST_CHECK(got_time != old_time);
+ if (TC.new_time < epoch_time) {
+ TEST_CHECK(got_time <= TC.new_time);
+ TEST_CHECK(got_time > TC.new_time - Sec(1));
+ } else {
+ TEST_CHECK(got_time <= TC.new_time + Sec(1));
+ TEST_CHECK(got_time >= TC.new_time - Sec(1));
+ }
+ TEST_CHECK(LastAccessTime(TC.p) == old_times.first);
+ }
+}
+
+TEST_CASE(last_write_time_symlink_test)
+{
+ using Clock = file_time_type::clock;
+ using Sec = std::chrono::seconds;
+ using Hours = std::chrono::hours;
+ using Minutes = std::chrono::minutes;
+
+ scoped_test_env env;
+
+ const path file = env.create_file("file", 42);
+ const path sym = env.create_symlink("file", "sym");
+
+ const file_time_type new_time = Clock::now() + Hours(3);
+
+ const auto old_times = GetTimes(sym);
+ const auto old_sym_times = GetSymlinkTimes(sym);
+
+ std::error_code ec = GetTestEC();
+ last_write_time(sym, new_time, ec);
+ TEST_CHECK(!ec);
+
+ const std::time_t new_time_t = Clock::to_time_t(new_time);
+ file_time_type got_time = last_write_time(sym);
+ std::time_t got_time_t = Clock::to_time_t(got_time);
+
+ TEST_CHECK(got_time_t != old_times.second);
+ TEST_CHECK(got_time_t == new_time_t);
+ TEST_CHECK(LastWriteTime(file) == new_time_t);
+ TEST_CHECK(LastAccessTime(sym) == old_times.first);
+ TEST_CHECK(GetSymlinkTimes(sym) == old_sym_times);
+}
+
+
+TEST_CASE(test_write_min_time)
+{
+ using Clock = file_time_type::clock;
+ using Sec = std::chrono::seconds;
+ using MicroSec = std::chrono::microseconds;
+ using Lim = std::numeric_limits<std::time_t>;
+ scoped_test_env env;
+ const path p = env.create_file("file", 42);
+
+ std::error_code ec = GetTestEC();
+ file_time_type last_time = last_write_time(p);
+ file_time_type new_time = file_time_type::min();
+
+ last_write_time(p, new_time, ec);
+ file_time_type tt = last_write_time(p);
+
+ if (!TimeIsRepresentableAsTimeT(new_time)) {
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(tt == last_time);
+ } else {
+ TEST_CHECK(!ec);
+ TEST_CHECK(tt >= new_time);
+ TEST_CHECK(tt < new_time + Sec(1));
+ }
+
+ ec = GetTestEC();
+ last_write_time(p, Clock::now());
+ last_time = last_write_time(p);
+
+ new_time = file_time_type::min() + MicroSec(1);
+
+ last_write_time(p, new_time, ec);
+ tt = last_write_time(p);
+
+ if (!TimeIsRepresentableAsTimeT(new_time)) {
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(tt == last_time);
+ } else {
+ TEST_CHECK(!ec);
+ TEST_CHECK(tt >= new_time);
+ TEST_CHECK(tt < new_time + Sec(1));
+ }
+}
+
+
+
+TEST_CASE(test_write_min_max_time)
+{
+ using Clock = file_time_type::clock;
+ using Sec = std::chrono::seconds;
+ using Hours = std::chrono::hours;
+ using Lim = std::numeric_limits<std::time_t>;
+ scoped_test_env env;
+ const path p = env.create_file("file", 42);
+
+ std::error_code ec = GetTestEC();
+ file_time_type last_time = last_write_time(p);
+ file_time_type new_time = file_time_type::max();
+
+ ec = GetTestEC();
+ last_write_time(p, new_time, ec);
+ file_time_type tt = last_write_time(p);
+
+ if (!TimeIsRepresentableAsTimeT(new_time)) {
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(tt == last_time);
+ } else {
+ TEST_CHECK(!ec);
+ TEST_CHECK(tt > new_time - Sec(1));
+ TEST_CHECK(tt <= new_time);
+ }
+}
+
+TEST_CASE(test_value_on_failure)
+{
+ const path p = StaticEnv::DNE;
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(last_write_time(p, ec) == file_time_type::min());
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+}
+
+TEST_CASE(test_exists_fails)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(last_write_time(file, ec) == file_time_type::min());
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+
+ TEST_CHECK_THROW(filesystem_error, last_write_time(file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
new file mode 100644
index 000000000000..b177693c09bd
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
@@ -0,0 +1,158 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// void permissions(const path& p, perms prms);
+// void permissions(const path& p, perms prms, std::error_code& ec) noexcept;
+
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+using PR = fs::perms;
+
+TEST_SUITE(filesystem_permissions_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ const perms opts{}; ((void)opts);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts));
+ // Not noexcept because of narrow contract
+ ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, fs::perms opts, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::permissions(f, opts);
+ return false;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.path2() == ""
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+
+ scoped_test_env env;
+ const path dne = env.make_env_path("dne");
+ const path dne_sym = env.create_symlink(dne, "dne_sym");
+ { // !exists
+ std::error_code ec;
+ fs::permissions(dne, fs::perms{}, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(dne, fs::perms{}, ec));
+ }
+ {
+ std::error_code ec;
+ fs::permissions(dne_sym, fs::perms{}, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(dne_sym, fs::perms{}, ec));
+ }
+}
+
+TEST_CASE(basic_permissions_test)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file1", 42);
+ const path dir = env.create_dir("dir1");
+ const path file_for_sym = env.create_file("file2", 42);
+ const path sym = env.create_symlink(file_for_sym, "sym");
+ const perms AP = perms::add_perms;
+ const perms RP = perms::remove_perms;
+ const perms NF = perms::symlink_nofollow;
+ struct TestCase {
+ path p;
+ perms set_perms;
+ perms expected;
+ } cases[] = {
+ // test file
+ {file, perms::none, perms::none},
+ {file, perms::owner_all, perms::owner_all},
+ {file, perms::group_all | AP, perms::owner_all | perms::group_all},
+ {file, perms::group_all | RP, perms::owner_all},
+ // test directory
+ {dir, perms::none, perms::none},
+ {dir, perms::owner_all, perms::owner_all},
+ {dir, perms::group_all | AP, perms::owner_all | perms::group_all},
+ {dir, perms::group_all | RP, perms::owner_all},
+ // test symlink without symlink_nofollow
+ {sym, perms::none, perms::none},
+ {sym, perms::owner_all, perms::owner_all},
+ {sym, perms::group_all | AP, perms::owner_all | perms::group_all},
+ {sym, perms::group_all | RP , perms::owner_all},
+ // test non-symlink with symlink_nofollow. The last test on file/dir
+ // will have set their permissions to perms::owner_all
+ {file, perms::group_all | AP | NF, perms::owner_all | perms::group_all},
+ {dir, perms::group_all | AP | NF, perms::owner_all | perms::group_all}
+ };
+ for (auto const& TC : cases) {
+ TEST_CHECK(status(TC.p).permissions() != TC.expected);
+ // Set the error code to ensure it's cleared.
+ std::error_code ec = std::make_error_code(std::errc::bad_address);
+ permissions(TC.p, TC.set_perms, ec);
+ TEST_CHECK(!ec);
+ auto pp = status(TC.p).permissions();
+ TEST_CHECK(status(TC.p).permissions() == TC.expected);
+ }
+}
+
+TEST_CASE(test_no_resolve_symlink_on_symlink)
+{
+ scoped_test_env env;
+ const path file = env.create_file("file", 42);
+ const path sym = env.create_symlink(file, "sym");
+ const auto file_perms = status(file).permissions();
+
+ struct TestCase {
+ perms set_perms;
+ perms expected; // only expected on platform that support symlink perms.
+ } cases[] = {
+ {perms::owner_all, perms::owner_all},
+ {perms::group_all | perms::add_perms, perms::owner_all | perms::group_all},
+ {perms::owner_all | perms::remove_perms, perms::group_all},
+ };
+ for (auto const& TC : cases) {
+#if defined(__APPLE__) || defined(__FreeBSD__)
+ // On OS X symlink permissions are supported. We should get an empty
+ // error code and the expected permissions.
+ const auto expected_link_perms = TC.expected;
+ std::error_code expected_ec;
+#else
+ // On linux symlink permissions are not supported. The error code should
+ // be 'operation_not_supported' and the sylink permissions should be
+ // unchanged.
+ const auto expected_link_perms = symlink_status(sym).permissions();
+ std::error_code expected_ec = std::make_error_code(std::errc::operation_not_supported);
+#endif
+ std::error_code ec = std::make_error_code(std::errc::bad_address);
+ permissions(sym, TC.set_perms | perms::symlink_nofollow, ec);
+ TEST_CHECK(ec == expected_ec);
+ TEST_CHECK(status(file).permissions() == file_perms);
+ TEST_CHECK(symlink_status(sym).permissions() == expected_link_perms);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
new file mode 100644
index 000000000000..00581cbe8bcc
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// path read_symlink(const path& p);
+// path read_symlink(const path& p, error_code& ec);
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_read_symlink_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(fs::read_symlink(p)), fs::path);
+ ASSERT_SAME_TYPE(decltype(fs::read_symlink(p, ec)), fs::path);
+
+ ASSERT_NOT_NOEXCEPT(fs::read_symlink(p));
+ // Not noexcept because of narrow contract
+ ASSERT_NOT_NOEXCEPT(fs::read_symlink(p, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::read_symlink(f);
+ return false;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.path2() == ""
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+
+ scoped_test_env env;
+ const path cases[] = {
+ env.make_env_path("dne"),
+ env.create_file("file", 42),
+ env.create_dir("dir")
+ };
+ for (path const& p : cases) {
+ std::error_code ec;
+ const path ret = fs::read_symlink(p, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(ret == path{});
+ TEST_CHECK(checkThrow(p, ec));
+ }
+
+}
+
+TEST_CASE(basic_symlink_test)
+{
+ scoped_test_env env;
+ const path dne = env.make_env_path("dne");
+ const path file = env.create_file("file", 42);
+ const path dir = env.create_dir("dir");
+ const path link = env.create_symlink(dne, "link");
+ const path nested_link = env.make_env_path("nested_link");
+ create_symlink(link, nested_link);
+ struct TestCase {
+ path symlink;
+ path expected;
+ } testCases[] = {
+ {env.create_symlink(dne, "dne_link"), dne},
+ {env.create_symlink(file, "file_link"), file},
+ {env.create_symlink(dir, "dir_link"), dir},
+ {nested_link, link}
+ };
+ for (auto& TC : testCases) {
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ const path ret = read_symlink(TC.symlink, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(ret == TC.expected);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp
new file mode 100644
index 000000000000..edb0c4fc76c9
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool remove(const path& p);
+// bool remove(const path& p, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_remove_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(fs::remove(p)), bool);
+ ASSERT_SAME_TYPE(decltype(fs::remove(p, ec)), bool);
+
+ ASSERT_NOT_NOEXCEPT(fs::remove(p));
+ ASSERT_NOEXCEPT(fs::remove(p, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::remove(f);
+ return false;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.path2() == ""
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+ scoped_test_env env;
+ const path non_empty_dir = env.create_dir("dir");
+ env.create_file(non_empty_dir / "file1", 42);
+ const path bad_perms_dir = env.create_dir("bad_dir");
+ const path file_in_bad_dir = env.create_file(bad_perms_dir / "file", 42);
+ permissions(bad_perms_dir, perms::none);
+ const path testCases[] = {
+ "",
+ env.make_env_path("dne"),
+ non_empty_dir,
+ file_in_bad_dir,
+ };
+ for (auto& p : testCases) {
+ std::error_code ec;
+ TEST_CHECK(!fs::remove(p, ec));
+ TEST_CHECK(ec);
+ TEST_CHECK(checkThrow(p, ec));
+ }
+}
+
+TEST_CASE(basic_remove_test)
+{
+ scoped_test_env env;
+ const path dne = env.make_env_path("dne");
+ const path link = env.create_symlink(dne, "link");
+ const path nested_link = env.make_env_path("nested_link");
+ create_symlink(link, nested_link);
+ const path testCases[] = {
+ env.create_file("file", 42),
+ env.create_dir("empty_dir"),
+ nested_link,
+ link
+ };
+ for (auto& p : testCases) {
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ TEST_CHECK(remove(p, ec));
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(symlink_status(p)));
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
new file mode 100644
index 000000000000..aecfce7885e9
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
@@ -0,0 +1,141 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// uintmax_t remove_all(const path& p);
+// uintmax_t remove_all(const path& p, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_remove_all_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(fs::remove_all(p)), std::uintmax_t);
+ ASSERT_SAME_TYPE(decltype(fs::remove_all(p, ec)), std::uintmax_t);
+
+ ASSERT_NOT_NOEXCEPT(fs::remove_all(p));
+ ASSERT_NOEXCEPT(fs::remove_all(p, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::remove_all(f);
+ return false;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.path2() == ""
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+ scoped_test_env env;
+ const path non_empty_dir = env.create_dir("dir");
+ env.create_file(non_empty_dir / "file1", 42);
+ const path bad_perms_dir = env.create_dir("bad_dir");
+ const path file_in_bad_dir = env.create_file(bad_perms_dir / "file", 42);
+ permissions(bad_perms_dir, perms::none);
+ const path bad_perms_file = env.create_file("file2", 42);
+ permissions(bad_perms_file, perms::none);
+
+ const path testCases[] = {
+ env.make_env_path("dne"),
+ file_in_bad_dir
+ };
+ const auto BadRet = static_cast<std::uintmax_t>(-1);
+ for (auto& p : testCases) {
+ std::error_code ec;
+ TEST_CHECK(fs::remove_all(p, ec) == BadRet);
+ TEST_CHECK(ec);
+ TEST_CHECK(checkThrow(p, ec));
+ }
+}
+
+TEST_CASE(basic_remove_all_test)
+{
+ scoped_test_env env;
+ const path dne = env.make_env_path("dne");
+ const path link = env.create_symlink(dne, "link");
+ const path nested_link = env.make_env_path("nested_link");
+ create_symlink(link, nested_link);
+ const path testCases[] = {
+ env.create_file("file", 42),
+ env.create_dir("empty_dir"),
+ nested_link,
+ link
+ };
+ for (auto& p : testCases) {
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ TEST_CHECK(remove(p, ec));
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(symlink_status(p)));
+ }
+}
+
+TEST_CASE(symlink_to_dir)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file(dir / "file", 42);
+ const path link = env.create_symlink(dir, "sym");
+
+ {
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ TEST_CHECK(remove_all(link, ec) == 1);
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(symlink_status(link)));
+ TEST_CHECK(exists(dir));
+ TEST_CHECK(exists(file));
+ }
+}
+
+
+TEST_CASE(nested_dir)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path dir1 = env.create_dir(dir / "dir1");
+ const path out_of_dir_file = env.create_file("file1", 42);
+ const path all_files[] = {
+ dir, dir1,
+ env.create_file(dir / "file1", 42),
+ env.create_symlink(out_of_dir_file, dir / "sym1"),
+ env.create_file(dir1 / "file2", 42),
+ env.create_symlink(dir, dir1 / "sym2")
+ };
+ const std::size_t expected_count = sizeof(all_files) / sizeof(all_files[0]);
+
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ TEST_CHECK(remove_all(dir, ec) == expected_count);
+ TEST_CHECK(!ec);
+ for (auto const& p : all_files) {
+ TEST_CHECK(!exists(symlink_status(p)));
+ }
+ TEST_CHECK(exists(out_of_dir_file));
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp
new file mode 100644
index 000000000000..c2ae854c0bf6
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp
@@ -0,0 +1,125 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// void rename(const path& old_p, const path& new_p);
+// void rename(const path& old_p, const path& new_p, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_rename_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(fs::rename(p, p)), void);
+ ASSERT_SAME_TYPE(decltype(fs::rename(p, p, ec)), void);
+
+ ASSERT_NOT_NOEXCEPT(fs::rename(p, p));
+ ASSERT_NOEXCEPT(fs::rename(p, p, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::rename(f, t);
+ return false;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.path2() == t
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+ scoped_test_env env;
+ const path dne = env.make_env_path("dne");
+ const path file = env.create_file("file1", 42);
+ const path dir = env.create_dir("dir1");
+ struct TestCase {
+ path from;
+ path to;
+ } cases[] = {
+ {dne, dne},
+ {file, dir},
+ {dir, file}
+ };
+ for (auto& TC : cases) {
+ auto from_before = status(TC.from);
+ auto to_before = status(TC.to);
+ std::error_code ec;
+ rename(TC.from, TC.to, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(from_before.type() == status(TC.from).type());
+ TEST_CHECK(to_before.type() == status(TC.to).type());
+ TEST_CHECK(checkThrow(TC.from, TC.to, ec));
+ }
+}
+
+TEST_CASE(basic_rename_test)
+{
+ scoped_test_env env;
+
+ const std::error_code set_ec = std::make_error_code(std::errc::address_in_use);
+ const path file = env.create_file("file1", 42);
+ { // same file
+ std::error_code ec = set_ec;
+ rename(file, file, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(is_regular_file(file));
+ TEST_CHECK(file_size(file) == 42);
+ }
+ const path sym = env.create_symlink(file, "sym");
+ { // file -> symlink
+ std::error_code ec = set_ec;
+ rename(file, sym, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(file));
+ TEST_CHECK(is_regular_file(symlink_status(sym)));
+ TEST_CHECK(file_size(sym) == 42);
+ }
+ const path file2 = env.create_file("file2", 42);
+ const path file3 = env.create_file("file3", 100);
+ { // file -> file
+ std::error_code ec = set_ec;
+ rename(file2, file3, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(file2));
+ TEST_CHECK(is_regular_file(file3));
+ TEST_CHECK(file_size(file3) == 42);
+ }
+ const path dne = env.make_env_path("dne");
+ const path bad_sym = env.create_symlink(dne, "bad_sym");
+ const path bad_sym_dest = env.make_env_path("bad_sym2");
+ { // bad-symlink
+ std::error_code ec = set_ec;
+ rename(bad_sym, bad_sym_dest, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(symlink_status(bad_sym)));
+ TEST_CHECK(is_symlink(bad_sym_dest));
+ TEST_CHECK(read_symlink(bad_sym_dest) == dne);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
new file mode 100644
index 000000000000..8a6aa09b14c7
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// void resize_file(const path& p, uintmax_t new_size);
+// void resize_file(const path& p, uintmax_t new_size, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+namespace fs = std::experimental::filesystem;
+
+TEST_SUITE(filesystem_resize_file_test_suite)
+
+TEST_CASE(test_signatures)
+{
+ const path p; ((void)p);
+ std::uintmax_t i; ((void)i);
+ std::error_code ec; ((void)ec);
+
+ ASSERT_SAME_TYPE(decltype(fs::resize_file(p, i)), void);
+ ASSERT_SAME_TYPE(decltype(fs::resize_file(p, i, ec)), void);
+
+ ASSERT_NOT_NOEXCEPT(fs::resize_file(p, i));
+ ASSERT_NOEXCEPT(fs::resize_file(p, i, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, std::uintmax_t s, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ fs::resize_file(f, s);
+ return false;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.path2() == ""
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+ scoped_test_env env;
+ const path dne = env.make_env_path("dne");
+ const path bad_sym = env.create_symlink(dne, "sym");
+ const path dir = env.create_dir("dir1");
+ const path cases[] = {
+ dne, bad_sym, dir
+ };
+ for (auto& p : cases) {
+ std::error_code ec;
+ resize_file(p, 42, ec);
+ TEST_REQUIRE(ec);
+ TEST_CHECK(checkThrow(p, 42, ec));
+ }
+}
+
+TEST_CASE(basic_resize_file_test)
+{
+ scoped_test_env env;
+ const path file1 = env.create_file("file1", 42);
+ const auto set_ec = std::make_error_code(std::errc::address_in_use);
+ { // grow file
+ const std::uintmax_t new_s = 100;
+ std::error_code ec = set_ec;
+ resize_file(file1, new_s, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(file_size(file1) == new_s);
+ }
+ { // shrink file
+ const std::uintmax_t new_s = 1;
+ std::error_code ec = set_ec;
+ resize_file(file1, new_s, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(file_size(file1) == new_s);
+ }
+ { // shrink file to zero
+ const std::uintmax_t new_s = 0;
+ std::error_code ec = set_ec;
+ resize_file(file1, new_s, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(file_size(file1) == new_s);
+ }
+ const path sym = env.create_symlink(file1, "sym");
+ { // grow file via symlink
+ const std::uintmax_t new_s = 1024;
+ std::error_code ec = set_ec;
+ resize_file(sym, new_s, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(file_size(file1) == new_s);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp
new file mode 100644
index 000000000000..865191520be3
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp
@@ -0,0 +1,127 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// space_info space(const path& p);
+// space_info space(const path& p, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+#include <sys/statvfs.h>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+bool EqualDelta(std::uintmax_t x, std::uintmax_t y, std::uintmax_t delta) {
+ if (x >= y) {
+ return (x - y) <= delta;
+ } else {
+ return (y - x) <= delta;
+ }
+}
+
+TEST_SUITE(filesystem_space_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_SAME_TYPE(decltype(space(p)), space_info);
+ ASSERT_SAME_TYPE(decltype(space(p, ec)), space_info);
+ ASSERT_NOT_NOEXCEPT(space(p));
+ ASSERT_NOEXCEPT(space(p, ec));
+}
+
+TEST_CASE(test_error_reporting)
+{
+ auto checkThrow = [](path const& f, const std::error_code& ec)
+ {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ space(f);
+ return false;
+ } catch (filesystem_error const& err) {
+ return err.path1() == f
+ && err.path2() == ""
+ && err.code() == ec;
+ }
+#else
+ return true;
+#endif
+ };
+ const path cases[] = {
+ "",
+ StaticEnv::DNE,
+ StaticEnv::BadSymlink
+ };
+ for (auto& p : cases) {
+ const auto expect = static_cast<std::uintmax_t>(-1);
+ std::error_code ec;
+ space_info info = space(p, ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(info.capacity == expect);
+ TEST_CHECK(info.free == expect);
+ TEST_CHECK(info.available == expect);
+ TEST_CHECK(checkThrow(p, ec));
+ }
+}
+
+TEST_CASE(basic_space_test)
+{
+ // All the test cases should reside on the same filesystem and therefore
+ // should have the same expected result. Compute this expected result
+ // one and check that it looks semi-sane.
+ struct statvfs expect;
+ TEST_REQUIRE(::statvfs(StaticEnv::Dir.c_str(), &expect) != -1);
+ TEST_CHECK(expect.f_bavail > 0);
+ TEST_CHECK(expect.f_bfree > 0);
+ TEST_CHECK(expect.f_bsize > 0);
+ TEST_CHECK(expect.f_blocks > 0);
+ TEST_REQUIRE(expect.f_frsize > 0);
+ auto do_mult = [&](std::uintmax_t val) {
+ std::uintmax_t fsize = expect.f_frsize;
+ std::uintmax_t new_val = val * fsize;
+ TEST_CHECK(new_val / fsize == val); // Test for overflow
+ return new_val;
+ };
+ const std::uintmax_t bad_value = static_cast<std::uintmax_t>(-1);
+ const std::uintmax_t expect_capacity = do_mult(expect.f_blocks);
+ const std::uintmax_t expect_free = do_mult(expect.f_bfree);
+ const std::uintmax_t expect_avail = do_mult(expect.f_bavail);
+
+ // Other processes running on the operating system may have changed
+ // the amount of space available. Check that these are within tolerances.
+ // Currently 5% of capacity
+ const std::uintmax_t delta = expect_capacity / 20;
+ const path cases[] = {
+ StaticEnv::File,
+ StaticEnv::Dir,
+ StaticEnv::Dir2,
+ StaticEnv::SymlinkToFile,
+ StaticEnv::SymlinkToDir
+ };
+ for (auto& p : cases) {
+ std::error_code ec = GetTestEC();
+ space_info info = space(p, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(info.capacity != bad_value);
+ TEST_CHECK(expect_capacity == info.capacity);
+ TEST_CHECK(info.free != bad_value);
+ TEST_CHECK(EqualDelta(expect_free, info.free, delta));
+ TEST_CHECK(info.available != bad_value);
+ TEST_CHECK(EqualDelta(expect_avail, info.available, delta));
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp
new file mode 100644
index 000000000000..2c76caf74c84
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp
@@ -0,0 +1,159 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// file_status status(const path& p);
+// file_status status(const path& p, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(filesystem_status_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(status(p));
+ ASSERT_NOEXCEPT(status(p, ec));
+}
+
+TEST_CASE(test_status_not_found)
+{
+ const std::error_code expect_ec =
+ std::make_error_code(std::errc::no_such_file_or_directory);
+ const path cases[] {
+ StaticEnv::DNE,
+ StaticEnv::BadSymlink
+ };
+ for (auto& p : cases) {
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ // test non-throwing overload.
+ file_status st = status(p, ec);
+ TEST_CHECK(ec == expect_ec);
+ TEST_CHECK(st.type() == file_type::not_found);
+ TEST_CHECK(st.permissions() == perms::unknown);
+ // test throwing overload. It should not throw even though it reports
+ // that the file was not found.
+ TEST_CHECK_NO_THROW(st = status(p));
+ TEST_CHECK(st.type() == file_type::not_found);
+ TEST_CHECK(st.permissions() == perms::unknown);
+ }
+}
+
+TEST_CASE(test_status_cannot_resolve)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file = env.create_file("dir/file", 42);
+ const path sym = env.create_symlink("dir/file", "sym");
+ permissions(dir, perms::none);
+
+ const std::error_code set_ec =
+ std::make_error_code(std::errc::address_in_use);
+ const std::error_code expect_ec =
+ std::make_error_code(std::errc::permission_denied);
+
+ const path cases[] = {
+ file, sym
+ };
+ for (auto& p : cases)
+ {
+ { // test non-throwing case
+ std::error_code ec = set_ec;
+ file_status st = status(p, ec);
+ TEST_CHECK(ec == expect_ec);
+ TEST_CHECK(st.type() == file_type::none);
+ TEST_CHECK(st.permissions() == perms::unknown);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ { // test throwing case
+ try {
+ status(p);
+ } catch (filesystem_error const& err) {
+ TEST_CHECK(err.path1() == p);
+ TEST_CHECK(err.path2() == "");
+ TEST_CHECK(err.code() == expect_ec);
+ }
+ }
+#endif
+ }
+}
+
+TEST_CASE(status_file_types_test)
+{
+ scoped_test_env env;
+ struct TestCase {
+ path p;
+ file_type expect_type;
+ } cases[] = {
+ {StaticEnv::File, file_type::regular},
+ {StaticEnv::SymlinkToFile, file_type::regular},
+ {StaticEnv::Dir, file_type::directory},
+ {StaticEnv::SymlinkToDir, file_type::directory},
+ // Block files tested elsewhere
+ {StaticEnv::CharFile, file_type::character},
+#if !defined(__APPLE__) && !defined(__FreeBSD__) // No support for domain sockets
+ {env.create_socket("socket"), file_type::socket},
+#endif
+ {env.create_fifo("fifo"), file_type::fifo}
+ };
+ for (const auto& TC : cases) {
+ // test non-throwing case
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ file_status st = status(TC.p, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(st.type() == TC.expect_type);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ // test throwing case
+ TEST_REQUIRE_NO_THROW(st = status(TC.p));
+ TEST_CHECK(st.type() == TC.expect_type);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ }
+}
+
+TEST_CASE(test_block_file)
+{
+ const path possible_paths[] = {
+ "/dev/drive0", // Apple
+ "/dev/sda",
+ "/dev/loop0"
+ };
+ path p;
+ for (const path& possible_p : possible_paths) {
+ std::error_code ec;
+ if (exists(possible_p, ec)) {
+ p = possible_p;
+ break;
+ }
+ }
+ if (p == path{}) {
+ TEST_UNSUPPORTED();
+ }
+ // test non-throwing case
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ file_status st = status(p, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(st.type() == file_type::block);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ // test throwing case
+ TEST_REQUIRE_NO_THROW(st = status(p));
+ TEST_CHECK(st.type() == file_type::block);
+ TEST_CHECK(st.permissions() != perms::unknown);
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp
new file mode 100644
index 000000000000..169c5be9d9a8
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// bool status_known(file_status s) noexcept;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(status_known_test_suite)
+
+TEST_CASE(signature_test)
+{
+ file_status s; ((void)s);
+ ASSERT_SAME_TYPE(decltype(status_known(s)), bool);
+ ASSERT_NOEXCEPT(status_known(s));
+}
+
+TEST_CASE(status_known_test)
+{
+ struct TestCase {
+ file_type type;
+ bool expect;
+ };
+ const TestCase testCases[] = {
+ {file_type::none, false},
+ {file_type::not_found, true},
+ {file_type::regular, true},
+ {file_type::directory, true},
+ {file_type::symlink, true},
+ {file_type::block, true},
+ {file_type::character, true},
+ {file_type::fifo, true},
+ {file_type::socket, true},
+ {file_type::unknown, true}
+ };
+ for (auto& TC : testCases) {
+ file_status s(TC.type);
+ TEST_CHECK(status_known(s) == TC.expect);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp
new file mode 100644
index 000000000000..647504f6e1a4
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp
@@ -0,0 +1,192 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// file_status symlink_status(const path& p);
+// file_status symlink_status(const path& p, error_code& ec) noexcept;
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(filesystem_symlink_status_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(symlink_status(p));
+ ASSERT_NOEXCEPT(symlink_status(p, ec));
+}
+
+TEST_CASE(test_symlink_status_not_found)
+{
+ const std::error_code expect_ec =
+ std::make_error_code(std::errc::no_such_file_or_directory);
+ const path cases[] {
+ StaticEnv::DNE
+ };
+ for (auto& p : cases) {
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ // test non-throwing overload.
+ file_status st = symlink_status(p, ec);
+ TEST_CHECK(ec == expect_ec);
+ TEST_CHECK(st.type() == file_type::not_found);
+ TEST_CHECK(st.permissions() == perms::unknown);
+ // test throwing overload. It should not throw even though it reports
+ // that the file was not found.
+ TEST_CHECK_NO_THROW(st = status(p));
+ TEST_CHECK(st.type() == file_type::not_found);
+ TEST_CHECK(st.permissions() == perms::unknown);
+ }
+}
+
+TEST_CASE(test_symlink_status_cannot_resolve)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file_in_dir = env.create_file("dir/file", 42);
+ const path sym_in_dir = env.create_symlink("dir/file", "dir/bad_sym");
+ const path sym_points_in_dir = env.create_symlink("dir/file", "sym");
+ permissions(dir, perms::none);
+
+ const std::error_code set_ec =
+ std::make_error_code(std::errc::address_in_use);
+ const std::error_code expect_ec =
+ std::make_error_code(std::errc::permission_denied);
+
+ const path fail_cases[] = {
+ file_in_dir, sym_in_dir
+ };
+ for (auto& p : fail_cases)
+ {
+ { // test non-throwing case
+ std::error_code ec = set_ec;
+ file_status st = symlink_status(p, ec);
+ TEST_CHECK(ec == expect_ec);
+ TEST_CHECK(st.type() == file_type::none);
+ TEST_CHECK(st.permissions() == perms::unknown);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ { // test throwing case
+ try {
+ symlink_status(p);
+ } catch (filesystem_error const& err) {
+ TEST_CHECK(err.path1() == p);
+ TEST_CHECK(err.path2() == "");
+ TEST_CHECK(err.code() == expect_ec);
+ }
+ }
+#endif
+ }
+ // Test that a symlink that points into a directory without read perms
+ // can be stat-ed using symlink_status
+ {
+ std::error_code ec = set_ec;
+ file_status st = symlink_status(sym_points_in_dir, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(st.type() == file_type::symlink);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ // test non-throwing version
+ TEST_REQUIRE_NO_THROW(st = symlink_status(sym_points_in_dir));
+ TEST_CHECK(st.type() == file_type::symlink);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ }
+}
+
+
+TEST_CASE(symlink_status_file_types_test)
+{
+ scoped_test_env env;
+ struct TestCase {
+ path p;
+ file_type expect_type;
+ } cases[] = {
+ {StaticEnv::BadSymlink, file_type::symlink},
+ {StaticEnv::File, file_type::regular},
+ {StaticEnv::SymlinkToFile, file_type::symlink},
+ {StaticEnv::Dir, file_type::directory},
+ {StaticEnv::SymlinkToDir, file_type::symlink},
+ // Block files tested elsewhere
+ {StaticEnv::CharFile, file_type::character},
+#if !defined(__APPLE__) && !defined(__FreeBSD__) // No support for domain sockets
+ {env.create_socket("socket"), file_type::socket},
+#endif
+ {env.create_fifo("fifo"), file_type::fifo}
+ };
+ for (const auto& TC : cases) {
+ // test non-throwing case
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ file_status st = symlink_status(TC.p, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(st.type() == TC.expect_type);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ // test throwing case
+ TEST_REQUIRE_NO_THROW(st = symlink_status(TC.p));
+ TEST_CHECK(st.type() == TC.expect_type);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ }
+}
+
+TEST_CASE(test_block_file)
+{
+ const path possible_paths[] = {
+ "/dev/drive0", // Apple
+ "/dev/sda", // Linux
+ "/dev/loop0" // Linux
+ // No FreeBSD files known
+ };
+ path p;
+ for (const path& possible_p : possible_paths) {
+ std::error_code ec;
+ if (exists(possible_p, ec)) {
+ p = possible_p;
+ break;
+ }
+ }
+ if (p == path{}) {
+ TEST_UNSUPPORTED();
+ }
+ scoped_test_env env;
+ { // test block file
+ // test non-throwing case
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ file_status st = symlink_status(p, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(st.type() == file_type::block);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ // test throwing case
+ TEST_REQUIRE_NO_THROW(st = symlink_status(p));
+ TEST_CHECK(st.type() == file_type::block);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ }
+ const path sym = env.make_env_path("sym");
+ create_symlink(p, sym);
+ { // test symlink to block file
+ // test non-throwing case
+ std::error_code ec = std::make_error_code(std::errc::address_in_use);
+ file_status st = symlink_status(sym, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(st.type() == file_type::symlink);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ // test throwing case
+ TEST_REQUIRE_NO_THROW(st = symlink_status(sym));
+ TEST_CHECK(st.type() == file_type::symlink);
+ TEST_CHECK(st.permissions() != perms::unknown);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp
new file mode 100644
index 000000000000..634184e24e6d
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.system_complete/system_complete.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// path system_complete(const path& p);
+// path system_complete(const path& p, error_code& ec);
+
+// Note: For POSIX based operating systems, 'system_complete(p)' has the
+// same semantics as 'absolute(p, current_path())'.
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+TEST_SUITE(filesystem_system_complete_test_suite)
+
+TEST_CASE(signature_test)
+{
+ const path p; ((void)p);
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(system_complete(p));
+ ASSERT_NOT_NOEXCEPT(system_complete(p, ec));
+}
+
+
+TEST_CASE(basic_system_complete_tests)
+{
+ const path testCases[] = {
+ "//net/foo", // has_root_name() && has_root_directory()
+ "/foo", // !has_root_name() && has_root_directory()
+ "//net", // has_root_name() && !has_root_directory()
+ "bar/baz" // !has_root_name() && !has_root_directory()
+ };
+ const path base = current_path();
+ for (auto& p : testCases) {
+ const path ret = system_complete(p);
+ const path expect = absolute(p, base);
+ TEST_CHECK(ret.is_absolute());
+ TEST_CHECK(ret == expect);
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
new file mode 100644
index 000000000000..215c35a33f30
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
@@ -0,0 +1,110 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// path temp_directory_path();
+// path temp_directory_path(error_code& ec);
+
+#include <experimental/filesystem>
+#include <memory>
+#include <cstdlib>
+#include <cstring>
+#include <cassert>
+
+#include "test_macros.h"
+#include "rapid-cxx-test.hpp"
+#include "filesystem_test_helper.hpp"
+
+using namespace std::experimental::filesystem;
+
+void PutEnv(std::string var, std::string value) {
+ assert(::setenv(var.c_str(), value.c_str(), /* overwrite */ 1) == 0);
+}
+
+void UnsetEnv(std::string var) {
+ assert(::unsetenv(var.c_str()) == 0);
+}
+
+TEST_SUITE(filesystem_temp_directory_path_test_suite)
+
+TEST_CASE(signature_test)
+{
+ std::error_code ec; ((void)ec);
+ ASSERT_NOT_NOEXCEPT(temp_directory_path());
+ ASSERT_NOT_NOEXCEPT(temp_directory_path(ec));
+}
+
+TEST_CASE(basic_tests)
+{
+ scoped_test_env env;
+ const path dne = env.make_env_path("dne");
+ const path file = env.create_file("file", 42);
+ const path dir_perms = env.create_dir("bad_perms_dir");
+ const path nested_dir = env.create_dir("bad_perms_dir/nested");
+ permissions(dir_perms, perms::none);
+ const std::error_code set_ec = std::make_error_code(std::errc::address_in_use);
+ const std::error_code expect_ec = std::make_error_code(std::errc::not_a_directory);
+ struct TestCase {
+ std::string name;
+ path p;
+ } cases[] = {
+ {"TMPDIR", env.create_dir("dir1")},
+ {"TMP", env.create_dir("dir2")},
+ {"TEMP", env.create_dir("dir3")},
+ {"TEMPDIR", env.create_dir("dir4")}
+ };
+ for (auto& TC : cases) {
+ PutEnv(TC.name, TC.p);
+ }
+ for (auto& TC : cases) {
+ std::error_code ec = set_ec;
+ path ret = temp_directory_path(ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(ret == TC.p);
+ TEST_CHECK(is_directory(ret));
+
+ // Set the env variable to a path that does not exist and check
+ // that it fails.
+ PutEnv(TC.name, dne);
+ ec = set_ec;
+ ret = temp_directory_path(ec);
+ TEST_CHECK(ec == expect_ec);
+ TEST_CHECK(ret == "");
+
+ // Set the env variable to point to a file and check that it fails.
+ PutEnv(TC.name, file);
+ ec = set_ec;
+ ret = temp_directory_path(ec);
+ TEST_CHECK(ec == expect_ec);
+ TEST_CHECK(ret == "");
+
+ // Set the env variable to point to a dir we can't access
+ PutEnv(TC.name, nested_dir);
+ ec = set_ec;
+ ret = temp_directory_path(ec);
+ TEST_CHECK(ec == std::make_error_code(std::errc::permission_denied));
+ TEST_CHECK(ret == "");
+
+ // Finally erase this env variable
+ UnsetEnv(TC.name);
+ }
+ // No env variables are defined
+ {
+ std::error_code ec = set_ec;
+ path ret = temp_directory_path(ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(ret == "/tmp");
+ TEST_CHECK(is_directory(ret));
+ }
+}
+
+TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp b/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp
new file mode 100644
index 000000000000..d57dff4a7b78
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// #define __cpp_lib_experimental_filesystem 201406L
+
+#include <experimental/filesystem>
+
+#ifndef __cpp_lib_experimental_filesystem
+#error Filesystem feature test macro is not defined (__cpp_lib_experimental_filesystem)
+#elif __cpp_lib_experimental_filesystem != 201406L
+#error Filesystem feature test macro has an incorrect value (__cpp_lib_experimental_filesystem)
+#endif
+
+int main() { }
diff --git a/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp b/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp
new file mode 100644
index 000000000000..77ae7b0989be
--- /dev/null
+++ b/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// namespace std::experimental::filesystem::v1
+
+#include <experimental/filesystem>
+#include <type_traits>
+
+int main() {
+ static_assert(std::is_same<
+ std::experimental::filesystem::path,
+ std::experimental::filesystem::v1::path
+ >::value, "");
+}
diff --git a/test/std/experimental/filesystem/lit.local.cfg b/test/std/experimental/filesystem/lit.local.cfg
new file mode 100644
index 000000000000..3d9360431f48
--- /dev/null
+++ b/test/std/experimental/filesystem/lit.local.cfg
@@ -0,0 +1,3 @@
+# Disable all of the filesystem tests if the correct feature is not available.
+if 'c++filesystem' not in config.available_features:
+ config.unsupported = True
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp
index 7647b536aa95..ae1b64222a29 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp
@@ -19,11 +19,11 @@
// public:
// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
-//
+//
// template<class RandomAccessIterator2>
-// RandomAccessIterator2
+// pair<RandomAccessIterator2, RandomAccessIterator2>
// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
-//
+//
// private:
// RandomAccessIterator1 pat_first_; // exposition only
// RandomAccessIterator1 pat_last_; // exposition only
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp
index 1323044c8704..bc44f1f6cbbf 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp
@@ -19,11 +19,11 @@
// public:
// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
-//
+//
// template<class RandomAccessIterator2>
-// RandomAccessIterator2
+// pair<RandomAccessIterator2, RandomAccessIterator2>
// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
-//
+//
// private:
// RandomAccessIterator1 pat_first_; // exposition only
// RandomAccessIterator1 pat_last_; // exposition only
@@ -44,7 +44,7 @@ template <typename T> struct MyHash {
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
- std::experimental::boyer_moore_searcher<Iter2,
+ std::experimental::boyer_moore_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
s{b2, e2};
assert(result == std::experimental::search(b1, e1, s));
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp
index 8fd5b8c9f784..743ab92156be 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp
@@ -19,11 +19,11 @@
// public:
// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
-//
+//
// template<class RandomAccessIterator2>
-// RandomAccessIterator2
+// pair<RandomAccessIterator2, RandomAccessIterator2>
// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
-//
+//
// private:
// RandomAccessIterator1 pat_first_; // exposition only
// RandomAccessIterator1 pat_last_; // exposition only
@@ -54,7 +54,7 @@ unsigned count_equal::count = 0;
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
- std::experimental::boyer_moore_searcher<Iter2,
+ std::experimental::boyer_moore_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
count_equal>
s{b2, e2};
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
index d0655c82febb..b27cabd76ab3 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
@@ -19,11 +19,11 @@
// public:
// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
-//
+//
// template<class RandomAccessIterator2>
-// RandomAccessIterator2
+// pair<RandomAccessIterator2, RandomAccessIterator2>
// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
-//
+//
// private:
// RandomAccessIterator1 pat_first_; // exposition only
// RandomAccessIterator1 pat_last_; // exposition only
@@ -50,7 +50,7 @@ unsigned count_equal::count = 0;
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
- std::experimental::boyer_moore_searcher<Iter2,
+ std::experimental::boyer_moore_searcher<Iter2,
typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp
index af3bbbafb24e..cbf9b41d590f 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp
@@ -19,11 +19,11 @@
// public:
// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
-//
+//
// template<class RandomAccessIterator2>
-// RandomAccessIterator2
+// pair<RandomAccessIterator2, RandomAccessIterator2>
// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
-//
+//
// private:
// RandomAccessIterator1 pat_first_; // exposition only
// RandomAccessIterator1 pat_last_; // exposition only
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp
index ff289f0edeb0..28a3f6d912f8 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp
@@ -19,11 +19,11 @@
// public:
// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
-//
+//
// template<class RandomAccessIterator2>
-// RandomAccessIterator2
+// pair<RandomAccessIterator2, RandomAccessIterator2>
// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
-//
+//
// private:
// RandomAccessIterator1 pat_first_; // exposition only
// RandomAccessIterator1 pat_last_; // exposition only
@@ -43,7 +43,7 @@ template <typename T> struct MyHash {
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
- std::experimental::boyer_moore_horspool_searcher<Iter2,
+ std::experimental::boyer_moore_horspool_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
s{b2, e2};
assert(result == std::experimental::search(b1, e1, s));
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp
index 1150210a978a..3a6647dbc7f5 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp
@@ -19,11 +19,11 @@
// public:
// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
-//
+//
// template<class RandomAccessIterator2>
-// RandomAccessIterator2
+// pair<RandomAccessIterator2, RandomAccessIterator2>
// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
-//
+//
// private:
// RandomAccessIterator1 pat_first_; // exposition only
// RandomAccessIterator1 pat_last_; // exposition only
@@ -53,7 +53,7 @@ unsigned count_equal::count = 0;
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
- std::experimental::boyer_moore_horspool_searcher<Iter2,
+ std::experimental::boyer_moore_horspool_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
count_equal>
s{b2, e2};
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
index 55426874abe5..8c78b9de0b35 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
@@ -19,11 +19,11 @@
// public:
// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
-//
+//
// template<class RandomAccessIterator2>
-// RandomAccessIterator2
+// pair<RandomAccessIterator2, RandomAccessIterator2>
// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
-//
+//
// private:
// RandomAccessIterator1 pat_first_; // exposition only
// RandomAccessIterator1 pat_last_; // exposition only
@@ -49,7 +49,7 @@ unsigned count_equal::count = 0;
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
- std::experimental::boyer_moore_horspool_searcher<Iter2,
+ std::experimental::boyer_moore_horspool_searcher<Iter2,
typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
diff --git a/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp
index 446dcbde42be..4eaf3a870390 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp
@@ -15,15 +15,16 @@
// template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
// class default_searcher {
// public:
-// default_searcher(_ForwardIterator __f, _ForwardIterator __l,
+// default_searcher(_ForwardIterator __f, _ForwardIterator __l,
// _BinaryPredicate __p = _BinaryPredicate())
// : __first_(__f), __last_(__l), __pred_(__p) {}
-//
+//
// template <typename _ForwardIterator2>
-// _ForwardIterator2 operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const {
+// pair<_ForwardIterator2, _ForwardIterator2>
+// operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const {
// return std::search(__f, __l, __first_, __last_, __pred_);
// }
-//
+//
// private:
// _ForwardIterator __first_;
// _ForwardIterator __last_;
diff --git a/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp
index b65c500c3192..a2f690d7b7bf 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp
@@ -15,15 +15,16 @@
// template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
// class default_searcher {
// public:
-// default_searcher(_ForwardIterator __f, _ForwardIterator __l,
+// default_searcher(_ForwardIterator __f, _ForwardIterator __l,
// _BinaryPredicate __p = _BinaryPredicate())
// : __first_(__f), __last_(__l), __pred_(__p) {}
-//
+//
// template <typename _ForwardIterator2>
-// _ForwardIterator2 operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const {
+// pair<_ForwardIterator2, _ForwardIterator2>
+// operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const {
// return std::search(__f, __l, __first_, __last_, __pred_);
// }
-//
+//
// private:
// _ForwardIterator __first_;
// _ForwardIterator __last_;
diff --git a/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp
index 9528002d5f2d..7798a6e73f5e 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp
@@ -25,7 +25,7 @@
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) {
- assert(result == std::experimental::search(b1, e1,
+ assert(result == std::experimental::search(b1, e1,
std::experimental::make_default_searcher(b2, e2)));
}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp
index 277020213149..21f50a397e2a 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp
@@ -36,7 +36,7 @@ unsigned count_equal::count = 0;
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
count_equal::count = 0;
- assert(result == std::experimental::search(b1, e1,
+ assert(result == std::experimental::search(b1, e1,
std::experimental::make_default_searcher(b2, e2)));
assert(count_equal::count <= max_count);
}
diff --git a/test/std/experimental/iterator/nothing_to_do.pass.cpp b/test/std/experimental/iterator/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..892d6895a326
--- /dev/null
+++ b/test/std/experimental/iterator/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <experimental/iterator>
+
+int main () {}
diff --git a/test/std/experimental/iterator/ostream.joiner/ostream.joiner.cons/ostream_joiner.cons.pass.cpp b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.cons/ostream_joiner.cons.pass.cpp
new file mode 100644
index 000000000000..5c84d210e53e
--- /dev/null
+++ b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.cons/ostream_joiner.cons.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/iterator>
+//
+// template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
+// class ostream_joiner;
+//
+// ostream_joiner(ostream_type& __os, _Delim&& __d);
+// ostream_joiner(ostream_type& __os, const _Delim& __d);
+
+#include <experimental/iterator>
+#include <iostream>
+#include <string>
+
+#include "test_macros.h"
+
+namespace exp = std::experimental;
+
+int main () {
+ const char eight = '8';
+ const std::string nine = "9";
+ const std::wstring ten = L"10";
+ const int eleven = 11;
+
+// Narrow streams w/rvalues
+ { exp::ostream_joiner<char> oj(std::cout, '8'); }
+ { exp::ostream_joiner<std::string> oj(std::cout, std::string("9")); }
+ { exp::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); }
+ { exp::ostream_joiner<int> oj(std::cout, 11); }
+
+// Narrow streams w/lvalues
+ { exp::ostream_joiner<char> oj(std::cout, eight); }
+ { exp::ostream_joiner<std::string> oj(std::cout, nine); }
+ { exp::ostream_joiner<std::wstring> oj(std::cout, ten); }
+ { exp::ostream_joiner<int> oj(std::cout, eleven); }
+
+// Wide streams w/rvalues
+ { exp::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); }
+ { exp::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); }
+ { exp::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); }
+ { exp::ostream_joiner<int, wchar_t> oj(std::wcout, 11); }
+
+// Wide streams w/lvalues
+ { exp::ostream_joiner<char, wchar_t> oj(std::wcout, eight); }
+ { exp::ostream_joiner<std::string, wchar_t> oj(std::wcout, nine); }
+ { exp::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, ten); }
+ { exp::ostream_joiner<int, wchar_t> oj(std::wcout, eleven); }
+
+ }
diff --git a/test/std/experimental/iterator/ostream.joiner/ostream.joiner.creation/make_ostream_joiner.pass.cpp b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.creation/make_ostream_joiner.pass.cpp
new file mode 100644
index 000000000000..a8c1b286f1de
--- /dev/null
+++ b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.creation/make_ostream_joiner.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/iterator>
+//
+// template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
+// class ostream_joiner;
+//
+// template <class _CharT, class _Traits, class _Delim>
+// ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits>
+// make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d);
+//
+
+#include <experimental/iterator>
+#include <iostream>
+#include <sstream>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+namespace exp = std::experimental;
+
+template <class Delim, class Iter, class CharT = char, class Traits = std::char_traits<CharT>>
+void test (Delim &&d, Iter first, Iter last, const CharT *expected ) {
+ std::basic_stringstream<CharT, Traits> sstream;
+ auto joiner = exp::make_ostream_joiner(sstream, d);
+ typedef exp::ostream_joiner<typename std::decay<Delim>::type, CharT, Traits> Joiner;
+ static_assert((std::is_same<decltype(joiner), Joiner>::value), "" );
+ while (first != last)
+ joiner = *first++;
+ assert(sstream.str() == expected);
+ }
+
+int main () {
+ const char chars[] = "0123456789";
+ const int ints [] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
+
+// There are more of these tests in another file.
+// This is just to make sure that the ostream_joiner is created correctly
+ test('X', chars, chars+10, "0X1X2X3X4X5X6X7X8X9");
+ test('x', ints, ints+10, "10x11x12x13x14x15x16x17x18x19");
+ test("Z", chars, chars+10, "0Z1Z2Z3Z4Z5Z6Z7Z8Z9");
+ test("z", ints, ints+10, "10z11z12z13z14z15z16z17z18z19");
+ }
diff --git a/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.assign.pass.cpp b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.assign.pass.cpp
new file mode 100644
index 000000000000..b2c294fd034b
--- /dev/null
+++ b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.assign.pass.cpp
@@ -0,0 +1,120 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/iterator>
+//
+// template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
+// class ostream_joiner;
+//
+// template<typename T>
+// ostream_joiner & operator=(const T&)
+//
+
+#include <experimental/iterator>
+#include <iostream>
+#include <sstream>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+struct mutating_delimiter {
+ mutating_delimiter(char c = ' ') : c_(c) {}
+ char get () const { return c_++; }
+ mutable char c_;
+ };
+
+template<class _CharT, class _Traits>
+std::basic_ostream<_CharT, _Traits>&
+operator<<(std::basic_ostream<_CharT, _Traits>& os, const mutating_delimiter &d)
+{ return os << d.get(); }
+
+
+struct mutating_delimiter2 { // same as above, w/o the const and the mutable
+ mutating_delimiter2(char c = ' ') : c_(c) {}
+ char get () { return c_++; }
+ char c_;
+ };
+
+template<class _CharT, class _Traits>
+std::basic_ostream<_CharT, _Traits>&
+operator<<(std::basic_ostream<_CharT, _Traits>& os, mutating_delimiter2 &d)
+{ return os << d.get(); }
+
+
+namespace exp = std::experimental;
+
+template <class Delim, class Iter, class CharT = char, class Traits = std::char_traits<CharT>>
+void test (Delim &&d, Iter first, Iter last, const CharT *expected ) {
+ typedef exp::ostream_joiner<typename std::decay<Delim>::type, CharT, Traits> Joiner;
+
+ static_assert((std::is_copy_constructible<Joiner>::value == std::is_copy_constructible<typename std::decay<Delim>::type>::value), "" );
+ static_assert((std::is_move_constructible<Joiner>::value == std::is_move_constructible<typename std::decay<Delim>::type>::value), "" );
+ static_assert((std::is_copy_assignable<Joiner> ::value == std::is_copy_assignable<typename std::decay<Delim>::type> ::value), "" );
+ static_assert((std::is_move_assignable<Joiner> ::value == std::is_move_assignable<typename std::decay<Delim>::type> ::value), "" );
+
+ std::basic_stringstream<CharT, Traits> sstream;
+ Joiner joiner(sstream, d);
+ while (first != last)
+ *joiner++ = *first++;
+ assert(sstream.str() == expected);
+ }
+
+int main () {
+{
+ const char chars[] = "0123456789";
+ const int ints [] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
+
+ test('X', chars, chars+10, "0X1X2X3X4X5X6X7X8X9");
+ test('x', ints, ints+10, "10x11x12x13x14x15x16x17x18x19");
+ test('X', input_iterator<const char*>(chars), input_iterator<const char*>(chars+10), "0X1X2X3X4X5X6X7X8X9");
+ test('x', input_iterator<const int*>(ints), input_iterator<const int*>(ints+10), "10x11x12x13x14x15x16x17x18x19");
+ test('X', forward_iterator<const char*>(chars), forward_iterator<const char*>(chars+10), "0X1X2X3X4X5X6X7X8X9");
+ test('x', forward_iterator<const int*>(ints), forward_iterator<const int*>(ints+10), "10x11x12x13x14x15x16x17x18x19");
+ test('X', random_access_iterator<const char*>(chars), random_access_iterator<const char*>(chars+10), "0X1X2X3X4X5X6X7X8X9");
+ test('x', random_access_iterator<const int*>(ints), random_access_iterator<const int*>(ints+10), "10x11x12x13x14x15x16x17x18x19");
+
+ test("Z", chars, chars+10, "0Z1Z2Z3Z4Z5Z6Z7Z8Z9");
+ test("z", ints, ints+10, "10z11z12z13z14z15z16z17z18z19");
+
+ test<char, const char *, wchar_t> ('X', chars, chars+10, L"0X1X2X3X4X5X6X7X8X9");
+ test<char, const int *, wchar_t> ('x', ints, ints+10, L"10x11x12x13x14x15x16x17x18x19");
+// test<char, const char *, char16_t>('X', chars, chars+10, u"0X1X2X3X4X5X6X7X8X9");
+// test<char, const int *, char16_t>('x', ints, ints+10, u"10x11x12x13x14x15x16x17x18x19");
+// test<char, const char *, char32_t>('X', chars, chars+10, U"0X1X2X3X4X5X6X7X8X9");
+// test<char, const int *, char32_t>('x', ints, ints+10, U"10x11x12x13x14x15x16x17x18x19");
+
+ test(mutating_delimiter(), chars, chars+10, "0 1!2\"3#4$5%6&7'8(9");
+ test(mutating_delimiter2(), chars, chars+10, "0 1!2\"3#4$5%6&7'8(9");
+ }
+
+ {
+ const wchar_t chars[] = L"0123456789";
+ const int ints [] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
+ test(L'X', chars, chars+10, L"0X1X2X3X4X5X6X7X8X9");
+ test(L'x', ints, ints+10, L"10x11x12x13x14x15x16x17x18x19");
+ test(L'X', input_iterator<const wchar_t*>(chars), input_iterator<const wchar_t*>(chars+10), L"0X1X2X3X4X5X6X7X8X9");
+ test(L'x', input_iterator<const int*>(ints), input_iterator<const int*>(ints+10), L"10x11x12x13x14x15x16x17x18x19");
+ test(L'X', forward_iterator<const wchar_t*>(chars), forward_iterator<const wchar_t*>(chars+10), L"0X1X2X3X4X5X6X7X8X9");
+ test(L'x', forward_iterator<const int*>(ints), forward_iterator<const int*>(ints+10), L"10x11x12x13x14x15x16x17x18x19");
+ test(L'X', random_access_iterator<const wchar_t*>(chars), random_access_iterator<const wchar_t*>(chars+10), L"0X1X2X3X4X5X6X7X8X9");
+ test(L'x', random_access_iterator<const int*>(ints), random_access_iterator<const int*>(ints+10), L"10x11x12x13x14x15x16x17x18x19");
+
+ test(L"Z", chars, chars+10, L"0Z1Z2Z3Z4Z5Z6Z7Z8Z9");
+ test(L"z", ints, ints+10, L"10z11z12z13z14z15z16z17z18z19");
+
+ test<char, const wchar_t *, wchar_t> ('X', chars, chars+10, L"0X1X2X3X4X5X6X7X8X9");
+ test<char, const int *, wchar_t> ('x', ints, ints+10, L"10x11x12x13x14x15x16x17x18x19");
+
+ test(mutating_delimiter(), chars, chars+10, L"0 1!2\"3#4$5%6&7'8(9");
+ }
+
+}
diff --git a/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.postincrement.pass.cpp b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.postincrement.pass.cpp
new file mode 100644
index 000000000000..e3872c3e030b
--- /dev/null
+++ b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.postincrement.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/iterator>
+//
+// template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
+// class ostream_joiner;
+//
+// ostream_joiner & operator++(int) noexcept
+// returns *this;
+
+#include <experimental/iterator>
+#include <iostream>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace exp = std::experimental;
+
+template <class Delim, class CharT, class Traits>
+void test ( exp::ostream_joiner<Delim, CharT, Traits> &oj ) {
+ static_assert((noexcept(oj++)), "" );
+ exp::ostream_joiner<Delim, CharT, Traits> &ret = oj++;
+ assert( &ret == &oj );
+ }
+
+int main () {
+
+ { exp::ostream_joiner<char> oj(std::cout, '8'); test(oj); }
+ { exp::ostream_joiner<std::string> oj(std::cout, std::string("9")); test(oj); }
+ { exp::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); test(oj); }
+ { exp::ostream_joiner<int> oj(std::cout, 11); test(oj); }
+
+ { exp::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); test(oj); }
+ { exp::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); test(oj); }
+ { exp::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); test(oj); }
+ { exp::ostream_joiner<int, wchar_t> oj(std::wcout, 11); test(oj); }
+ }
diff --git a/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.pretincrement.pass.cpp b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.pretincrement.pass.cpp
new file mode 100644
index 000000000000..87b493e6393a
--- /dev/null
+++ b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.pretincrement.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/iterator>
+//
+// template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
+// class ostream_joiner;
+//
+// ostream_joiner & operator++() noexcept
+// returns *this;
+
+#include <experimental/iterator>
+#include <iostream>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace exp = std::experimental;
+
+template <class Delim, class CharT, class Traits>
+void test ( exp::ostream_joiner<Delim, CharT, Traits> &oj ) {
+ static_assert((noexcept(++oj)), "" );
+ exp::ostream_joiner<Delim, CharT, Traits> &ret = ++oj;
+ assert( &ret == &oj );
+ }
+
+int main () {
+
+ { exp::ostream_joiner<char> oj(std::cout, '8'); test(oj); }
+ { exp::ostream_joiner<std::string> oj(std::cout, std::string("9")); test(oj); }
+ { exp::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); test(oj); }
+ { exp::ostream_joiner<int> oj(std::cout, 11); test(oj); }
+
+ { exp::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); test(oj); }
+ { exp::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); test(oj); }
+ { exp::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); test(oj); }
+ { exp::ostream_joiner<int, wchar_t> oj(std::wcout, 11); test(oj); }
+ }
diff --git a/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.star.pass.cpp b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.star.pass.cpp
new file mode 100644
index 000000000000..794346d75e7f
--- /dev/null
+++ b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.star.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/iterator>
+//
+// template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
+// class ostream_joiner;
+//
+// ostream_joiner & operator*() noexcept
+// returns *this;
+
+#include <experimental/iterator>
+#include <iostream>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace exp = std::experimental;
+
+template <class Delim, class CharT, class Traits>
+void test ( exp::ostream_joiner<Delim, CharT, Traits> &oj ) {
+ static_assert((noexcept(*oj)), "" );
+ exp::ostream_joiner<Delim, CharT, Traits> &ret = *oj;
+ assert( &ret == &oj );
+ }
+
+int main () {
+
+ { exp::ostream_joiner<char> oj(std::cout, '8'); test(oj); }
+ { exp::ostream_joiner<std::string> oj(std::cout, std::string("9")); test(oj); }
+ { exp::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); test(oj); }
+ { exp::ostream_joiner<int> oj(std::cout, 11); test(oj); }
+
+ { exp::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); test(oj); }
+ { exp::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); test(oj); }
+ { exp::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); test(oj); }
+ { exp::ostream_joiner<int, wchar_t> oj(std::wcout, 11); test(oj); }
+ }
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp
new file mode 100644
index 000000000000..c4309d9097aa
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// polymorphic_allocator operator=(polymorphic_allocator const &) = delete
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef ex::polymorphic_allocator<void> T;
+ static_assert(!std::is_copy_assignable<T>::value, "");
+ static_assert(!std::is_move_assignable<T>::value, "");
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/copy.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/copy.pass.cpp
new file mode 100644
index 000000000000..ba3710d4de1b
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/copy.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// polymorphic_allocator<T>::polymorphic_allocator(polymorphic_allocator const &);
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef ex::polymorphic_allocator<void> A1;
+ {
+ static_assert(
+ std::is_copy_constructible<A1>::value, ""
+ );
+ static_assert(
+ std::is_move_constructible<A1>::value, ""
+ );
+ }
+ // copy
+ {
+ A1 const a((ex::memory_resource*)42);
+ A1 const a2(a);
+ assert(a.resource() == a2.resource());
+ }
+ // move
+ {
+ A1 a((ex::memory_resource*)42);
+ A1 a2(std::move(a));
+ assert(a.resource() == a2.resource());
+ assert(a2.resource() == (ex::memory_resource*)42);
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp
new file mode 100644
index 000000000000..b696d0c13fb3
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// polymorphic_allocator<T>::polymorphic_allocator() noexcept
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ {
+ static_assert(
+ std::is_nothrow_default_constructible<ex::polymorphic_allocator<void>>::value
+ , "Must me nothrow default constructible"
+ );
+ }
+ {
+ // test that the allocator gets its resource from get_default_resource
+ TestResource R1(42);
+ ex::set_default_resource(&R1);
+
+ typedef ex::polymorphic_allocator<void> A;
+ A const a;
+ assert(a.resource() == &R1);
+
+ ex::set_default_resource(nullptr);
+ A const a2;
+ assert(a.resource() == &R1);
+ assert(a2.resource() == ex::new_delete_resource());
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/memory_resource_convert.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/memory_resource_convert.pass.cpp
new file mode 100644
index 000000000000..19d9646ad616
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/memory_resource_convert.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// polymorphic_allocator<T>::polymorphic_allocator(memory_resource *)
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ {
+ typedef ex::polymorphic_allocator<void> A;
+ static_assert(
+ std::is_convertible<decltype(nullptr), A>::value
+ , "Must be convertible"
+ );
+ static_assert(
+ std::is_convertible<ex::memory_resource *, A>::value
+ , "Must be convertible"
+ );
+ }
+ {
+ typedef ex::polymorphic_allocator<void> A;
+ TestResource R;
+ A const a(&R);
+ assert(a.resource() == &R);
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/other_alloc.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/other_alloc.pass.cpp
new file mode 100644
index 000000000000..aadfbcc322fc
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/other_alloc.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// template <class U>
+// polymorphic_allocator<T>::polymorphic_allocator(polymorphic_allocator<U> const &);
+
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef ex::polymorphic_allocator<void> A1;
+ typedef ex::polymorphic_allocator<char> A2;
+ { // Test that the conversion is implicit and noexcept.
+ static_assert(
+ std::is_convertible<A1 const &, A2>::value, ""
+ );
+ static_assert(
+ std::is_convertible<A2 const &, A1>::value, ""
+ );
+ static_assert(
+ std::is_nothrow_constructible<A1, A2 const &>::value, ""
+ );
+ static_assert(
+ std::is_nothrow_constructible<A2, A1 const &>::value, ""
+ );
+ }
+ // copy other type
+ {
+ A1 const a((ex::memory_resource*)42);
+ A2 const a2(a);
+ assert(a.resource() == a2.resource());
+ assert(a2.resource() == (ex::memory_resource*)42);
+ }
+ {
+ A1 a((ex::memory_resource*)42);
+ A2 const a2(std::move(a));
+ assert(a.resource() == a2.resource());
+ assert(a2.resource() == (ex::memory_resource*)42);
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp
new file mode 100644
index 000000000000..d4aea1cf5f21
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp
@@ -0,0 +1,134 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator;
+
+// template <class T, class U>
+// bool operator==(
+// polymorphic_allocator<T> const &
+// , polymorphic_allocator<U> const &) noexcept
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef ex::polymorphic_allocator<void> A1;
+ typedef ex::polymorphic_allocator<int> A2;
+ // check return types
+ {
+ A1 const a1;
+ A2 const a2;
+ static_assert(std::is_same<decltype(a1 == a2), bool>::value, "");
+ static_assert(noexcept(a1 == a2), "");
+ }
+ // equal same type (different resource)
+ {
+ TestResource d1(1);
+ TestResource d2(1);
+ A1 const a1(&d1);
+ A1 const a2(&d2);
+
+ assert(a1 == a2);
+ assert(d1.checkIsEqualCalledEq(1));
+ assert(d2.checkIsEqualCalledEq(0));
+
+ d1.reset();
+
+ assert(a2 == a1);
+ assert(d1.checkIsEqualCalledEq(0));
+ assert(d2.checkIsEqualCalledEq(1));
+ }
+ // equal same type (same resource)
+ {
+ TestResource d1;
+ A1 const a1(&d1);
+ A1 const a2(&d1);
+
+ assert(a1 == a2);
+ assert(d1.checkIsEqualCalledEq(0));
+
+ assert(a2 == a1);
+ assert(d1.checkIsEqualCalledEq(0));
+ }
+ // equal different type (different resource)
+ {
+ TestResource d1(42);
+ TestResource d2(42);
+ A1 const a1(&d1);
+ A2 const a2(&d2);
+
+ assert(a1 == a2);
+ assert(d1.checkIsEqualCalledEq(1));
+ assert(d2.checkIsEqualCalledEq(0));
+
+ assert(a2 == a1);
+ assert(d1.checkIsEqualCalledEq(1));
+ assert(d2.checkIsEqualCalledEq(1));
+
+ }
+ // equal different type (same resource)
+ {
+ TestResource d1(42);
+ A1 const a1(&d1);
+ A2 const a2(&d1);
+
+ assert(a1 == a2);
+ assert(d1.checkIsEqualCalledEq(0));
+
+ assert(a2 == a1);
+ assert(d1.checkIsEqualCalledEq(0));
+
+ }
+ // not equal same type
+ {
+ TestResource d1(1);
+ TestResource d2(2);
+ A1 const a1(&d1);
+ A1 const a2(&d2);
+
+ assert(!(a1 == a2));
+ assert(d1.checkIsEqualCalledEq(1));
+ assert(d2.checkIsEqualCalledEq(0));
+
+ d1.reset();
+
+ assert(!(a2 == a1));
+ assert(d1.checkIsEqualCalledEq(0));
+ assert(d2.checkIsEqualCalledEq(1));
+
+ }
+ // not equal different types
+ {
+ TestResource d1;
+ TestResource1 d2;
+ A1 const a1(&d1);
+ A2 const a2(&d2);
+
+ assert(!(a1 == a2));
+ assert(d1.checkIsEqualCalledEq(1));
+ assert(d2.checkIsEqualCalledEq(0));
+
+ d1.reset();
+
+ assert(!(a2 == a1));
+ assert(d1.checkIsEqualCalledEq(0));
+ assert(d2.checkIsEqualCalledEq(1));
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp
new file mode 100644
index 000000000000..7b9b1d3857b7
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp
@@ -0,0 +1,105 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator;
+
+// template <class T>
+// bool operator!=(
+// polymorphic_allocator<T> const &
+// , polymorphic_allocator<T> const &) noexcept
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef ex::polymorphic_allocator<void> A1;
+ typedef ex::polymorphic_allocator<int> A2;
+ // check return types
+ {
+ A1 const a1;
+ A2 const a2;
+ static_assert(std::is_same<decltype(a1 != a2), bool>::value, "");
+ static_assert(noexcept(a1 != a2), "");
+ }
+ // not equal same type (different resource)
+ {
+ TestResource d1(1);
+ TestResource d2(2);
+ A1 const a1(&d1);
+ A1 const a2(&d2);
+
+ assert(a1 != a2);
+ assert(d1.checkIsEqualCalledEq(1));
+ assert(d2.checkIsEqualCalledEq(0));
+
+ d1.reset();
+
+ assert(a2 != a1);
+ assert(d1.checkIsEqualCalledEq(0));
+ assert(d2.checkIsEqualCalledEq(1));
+ }
+ // equal same type (same resource)
+ {
+ TestResource d1;
+ A1 const a1(&d1);
+ A1 const a2(&d1);
+
+ assert(!(a1 != a2));
+ assert(d1.checkIsEqualCalledEq(0));
+
+ assert(!(a2 != a1));
+ assert(d1.checkIsEqualCalledEq(0));
+ }
+ // equal same type
+ {
+ TestResource d1(1);
+ TestResource d2(1);
+ A1 const a1(&d1);
+ A1 const a2(&d2);
+
+ assert(!(a1 != a2));
+ assert(d1.checkIsEqualCalledEq(1));
+ assert(d2.checkIsEqualCalledEq(0));
+
+ d1.reset();
+
+ assert(!(a2 != a1));
+ assert(d1.checkIsEqualCalledEq(0));
+ assert(d2.checkIsEqualCalledEq(1));
+
+ }
+ // not equal different types
+ {
+ TestResource d1;
+ TestResource1 d2;
+ A1 const a1(&d1);
+ A2 const a2(&d2);
+
+ assert(a1 != a2);
+ assert(d1.checkIsEqualCalledEq(1));
+ assert(d2.checkIsEqualCalledEq(0));
+
+ d1.reset();
+
+ assert(a2 != a1);
+ assert(d1.checkIsEqualCalledEq(0));
+ assert(d2.checkIsEqualCalledEq(1));
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
new file mode 100644
index 000000000000..a7efad1156dc
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// T* polymorphic_allocator<T>::allocate(size_t n)
+
+#include <experimental/memory_resource>
+#include <limits>
+#include <memory>
+#include <exception>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+template <size_t S, size_t Align>
+void testForSizeAndAlign() {
+ using T = typename std::aligned_storage<S, Align>::type;
+ TestResource R;
+ ex::polymorphic_allocator<T> a(&R);
+
+ for (int N = 1; N <= 5; ++N) {
+ auto ret = a.allocate(N);
+ assert(R.checkAlloc(ret, N * sizeof(T), alignof(T)));
+
+ a.deallocate(ret, N);
+ R.reset();
+ }
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+template <size_t S>
+void testAllocForSizeThrows() {
+ using T = typename std::aligned_storage<S>::type;
+ using Alloc = ex::polymorphic_allocator<T>;
+ using Traits = std::allocator_traits<Alloc>;
+ NullResource R;
+ Alloc a(&R);
+
+ // Test that allocating exactly the max size does not throw.
+ size_t maxSize = Traits::max_size(a);
+ try {
+ a.allocate(maxSize);
+ } catch (...) {
+ assert(false);
+ }
+
+ size_t sizeTypeMax = std::numeric_limits<std::size_t>::max();
+ if (maxSize != sizeTypeMax)
+ {
+ // Test that allocating size_t(~0) throws bad alloc.
+ try {
+ a.allocate(sizeTypeMax);
+ assert(false);
+ } catch (std::exception const&) {
+ }
+
+ // Test that allocating even one more than the max size does throw.
+ size_t overSize = maxSize + 1;
+ try {
+ a.allocate(overSize);
+ assert(false);
+ } catch (std::exception const&) {
+ }
+ }
+}
+#endif // TEST_HAS_NO_EXCEPTIONS
+
+int main()
+{
+ {
+ ex::polymorphic_allocator<int> a;
+ static_assert(std::is_same<decltype(a.allocate(0)), int*>::value, "");
+ static_assert(!noexcept(a.allocate(0)), "");
+ }
+ {
+ constexpr std::size_t MA = alignof(std::max_align_t);
+ testForSizeAndAlign<1, 1>();
+ testForSizeAndAlign<1, 2>();
+ testForSizeAndAlign<1, MA>();
+ testForSizeAndAlign<2, 2>();
+ testForSizeAndAlign<73, alignof(void*)>();
+ testForSizeAndAlign<73, MA>();
+ testForSizeAndAlign<13, MA>();
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ testAllocForSizeThrows<1>();
+ testAllocForSizeThrows<2>();
+ testAllocForSizeThrows<4>();
+ testAllocForSizeThrows<8>();
+ testAllocForSizeThrows<16>();
+ testAllocForSizeThrows<73>();
+ testAllocForSizeThrows<13>();
+ }
+#endif
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp
new file mode 100644
index 000000000000..2b43594756b7
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// template <class U1, class U2>
+// void polymorphic_allocator<T>::construct(pair<U1, U2>*)
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int constructed = 0;
+
+struct default_constructible
+{
+ default_constructible() : x(42) { ++constructed; }
+ int x{0};
+};
+
+int main()
+{
+ // pair<default_constructible, default_constructible> as T()
+ {
+ typedef default_constructible T;
+ typedef std::pair<T, T> P;
+ typedef ex::polymorphic_allocator<void> A;
+ P * ptr = (P*)std::malloc(sizeof(P));
+ A a;
+ a.construct(ptr);
+ assert(constructed == 2);
+ assert(ptr->first.x == 42);
+ assert(ptr->second.x == 42);
+ std::free(ptr);
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
new file mode 100644
index 000000000000..50a71eeca82b
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// template <class P1, class P2, class U1, class U2>
+// void polymorphic_allocator<T>::construct(pair<P1, P2>*, pair<U1, U2> const&)
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+
+namespace ex = std::experimental::pmr;
+
+
+template <class UA1, class UA2, class TT, class UU>
+bool doTest(UsesAllocatorType TExpect, UsesAllocatorType UExpect,
+ std::pair<TT, UU> const& p)
+{
+ using P = std::pair<UA1, UA2>;
+ TestResource R;
+ ex::memory_resource * M = &R;
+ ex::polymorphic_allocator<P> A(M);
+ P * ptr = (P*)std::malloc(sizeof(P));
+ P * ptr2 = (P*)std::malloc(sizeof(P));
+
+ // UNDER TEST //
+ A.construct(ptr, p);
+
+ A.construct(ptr2, std::piecewise_construct,
+ std::forward_as_tuple(p.first),
+ std::forward_as_tuple(p.second));
+ // ------- //
+
+ bool tres = checkConstruct<decltype((p.first))>(ptr->first, TExpect, M) &&
+ checkConstructionEquiv(ptr->first, ptr2->first);
+
+ bool ures = checkConstruct<decltype((p.second))>(ptr->second, UExpect, M) &&
+ checkConstructionEquiv(ptr->second, ptr2->second);
+
+ A.destroy(ptr);
+ std::free(ptr);
+ A.destroy(ptr2);
+ std::free(ptr2);
+ return tres && ures;
+
+}
+
+template <class Alloc, class TT, class UU>
+void test_pmr_uses_allocator(std::pair<TT, UU> const& p)
+{
+ {
+ using T = NotUsesAllocator<Alloc, 1>;
+ using U = NotUsesAllocator<Alloc, 1>;
+ assert((doTest<T, U>(UA_None, UA_None, p)));
+ }
+ {
+ using T = UsesAllocatorV1<Alloc, 1>;
+ using U = UsesAllocatorV2<Alloc, 1>;
+ assert((doTest<T, U>(UA_AllocArg, UA_AllocLast, p)));
+ }
+ {
+ using T = UsesAllocatorV2<Alloc, 1>;
+ using U = UsesAllocatorV3<Alloc, 1>;
+ assert((doTest<T, U>(UA_AllocLast, UA_AllocArg, p)));
+ }
+ {
+ using T = UsesAllocatorV3<Alloc, 1>;
+ using U = NotUsesAllocator<Alloc, 1>;
+ assert((doTest<T, U>(UA_AllocArg, UA_None, p)));
+ }
+}
+template <class Tp>
+struct Print;
+
+int main()
+{
+ using ERT = std::experimental::erased_type;
+ using PMR = ex::memory_resource*;
+ using PMA = ex::polymorphic_allocator<char>;
+ {
+ int x = 42;
+ int y = 42;
+ const std::pair<int, int&> p(x, y);
+ test_pmr_uses_allocator<ERT>(p);
+ test_pmr_uses_allocator<PMR>(p);
+ test_pmr_uses_allocator<PMA>(p);
+ }
+ {
+ int x = 42;
+ int y = 42;
+ const std::pair<int&, int&&> p(x, std::move(y));
+ test_pmr_uses_allocator<ERT>(p);
+ test_pmr_uses_allocator<PMR>(p);
+ test_pmr_uses_allocator<PMA>(p);
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
new file mode 100644
index 000000000000..b6adb558b1e4
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// template <class P1, class P2, class U1, class U2>
+// void polymorphic_allocator<T>::construct(pair<P1, P2>*, pair<U1, U2> &&)
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+
+namespace ex = std::experimental::pmr;
+
+
+
+template <class UA1, class UA2, class TT, class UU>
+bool doTest(UsesAllocatorType TExpect, UsesAllocatorType UExpect,
+ std::pair<TT, UU>&& p)
+{
+ using P = std::pair<UA1, UA2>;
+ TestResource R;
+ ex::memory_resource * M = &R;
+ ex::polymorphic_allocator<P> A(M);
+ P * ptr = A.allocate(2);
+ P * ptr2 = ptr + 1;
+
+ // UNDER TEST //
+ A.construct(ptr, std::move(p));
+
+ A.construct(ptr2, std::piecewise_construct,
+ std::forward_as_tuple(std::forward<TT>(p.first)),
+ std::forward_as_tuple(std::forward<UU>(p.second)));
+ // ------- //
+
+ bool tres = checkConstruct<TT&&>(ptr->first, TExpect, M) &&
+ checkConstructionEquiv(ptr->first, ptr2->first);
+
+ bool ures = checkConstruct<UU&&>(ptr->second, UExpect, M) &&
+ checkConstructionEquiv(ptr->second, ptr2->second);
+
+ A.destroy(ptr);
+ A.destroy(ptr2);
+ A.deallocate(ptr, 2);
+ return tres && ures;
+}
+
+template <class Alloc, class TT, class UU>
+void test_pmr_uses_allocator(std::pair<TT, UU>&& p)
+{
+ {
+ using T = NotUsesAllocator<Alloc, 1>;
+ using U = NotUsesAllocator<Alloc, 1>;
+ assert((doTest<T, U>(UA_None, UA_None, std::move(p))));
+ }
+ {
+ using T = UsesAllocatorV1<Alloc, 1>;
+ using U = UsesAllocatorV2<Alloc, 1>;
+ assert((doTest<T, U>(UA_AllocArg, UA_AllocLast, std::move(p))));
+ }
+ {
+ using T = UsesAllocatorV2<Alloc, 1>;
+ using U = UsesAllocatorV3<Alloc, 1>;
+ assert((doTest<T, U>(UA_AllocLast, UA_AllocArg, std::move(p))));
+ }
+ {
+ using T = UsesAllocatorV3<Alloc, 1>;
+ using U = NotUsesAllocator<Alloc, 1>;
+ assert((doTest<T, U>(UA_AllocArg, UA_None, std::move(p))));
+ }
+}
+
+int main()
+{
+ using ERT = std::experimental::erased_type;
+ using PMR = ex::memory_resource*;
+ using PMA = ex::polymorphic_allocator<char>;
+ {
+ int x = 42;
+ int y = 42;
+ std::pair<int&, int&&> p(x, std::move(y));
+ test_pmr_uses_allocator<ERT>(std::move(p));
+ test_pmr_uses_allocator<PMR>(std::move(p));
+ test_pmr_uses_allocator<PMA>(std::move(p));
+ }
+ {
+ int x = 42;
+ int y = 42;
+ std::pair<int&&, int&> p(std::move(x), y);
+ test_pmr_uses_allocator<ERT>(std::move(p));
+ test_pmr_uses_allocator<PMR>(std::move(p));
+ test_pmr_uses_allocator<PMA>(std::move(p));
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
new file mode 100644
index 000000000000..a913742a854b
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
@@ -0,0 +1,110 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// template <class P1, class P2, class U1, class U2>
+// void polymorphic_allocator<T>::construct(pair<P1, P2>*, U1&&, U2&&)
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+
+namespace ex = std::experimental::pmr;
+
+
+template <class UA1, class UA2, class TT, class UU>
+bool doTest(UsesAllocatorType TExpect, UsesAllocatorType UExpect,
+ TT&& t, UU&& u)
+{
+ using P = std::pair<UA1, UA2>;
+ TestResource R;
+ ex::memory_resource * M = &R;
+ ex::polymorphic_allocator<P> A(M);
+ P * ptr = (P*)std::malloc(sizeof(P));
+ P * ptr2 = (P*)std::malloc(sizeof(P));
+
+ // UNDER TEST //
+ A.construct(ptr, std::forward<TT>(t), std::forward<UU>(u));
+ A.construct(ptr2, std::piecewise_construct,
+ std::forward_as_tuple(std::forward<TT>(t)),
+ std::forward_as_tuple(std::forward<UU>(u)));
+ // ------- //
+
+ bool tres = checkConstruct<TT&&>(ptr->first, TExpect, M) &&
+ checkConstructionEquiv(ptr->first, ptr2->first);
+
+ bool ures = checkConstruct<UU&&>(ptr->second, UExpect, M) &&
+ checkConstructionEquiv(ptr->second, ptr2->second);
+
+ A.destroy(ptr);
+ A.destroy(ptr2);
+ std::free(ptr);
+ std::free(ptr2);
+ return tres && ures;
+}
+
+template <class Alloc, class TT, class UU>
+void test_pmr_uses_allocator(TT&& t, UU&& u)
+{
+ {
+ using T = NotUsesAllocator<Alloc, 1>;
+ using U = NotUsesAllocator<Alloc, 1>;
+ assert((doTest<T, U>(UA_None, UA_None,
+ std::forward<TT>(t), std::forward<UU>(u))));
+ }
+ {
+ using T = UsesAllocatorV1<Alloc, 1>;
+ using U = UsesAllocatorV2<Alloc, 1>;
+ assert((doTest<T, U>(UA_AllocArg, UA_AllocLast,
+ std::forward<TT>(t), std::forward<UU>(u))));
+ }
+ {
+ using T = UsesAllocatorV2<Alloc, 1>;
+ using U = UsesAllocatorV3<Alloc, 1>;
+ assert((doTest<T, U>(UA_AllocLast, UA_AllocArg,
+ std::forward<TT>(t), std::forward<UU>(u))));
+ }
+ {
+ using T = UsesAllocatorV3<Alloc, 1>;
+ using U = NotUsesAllocator<Alloc, 1>;
+ assert((doTest<T, U>(UA_AllocArg, UA_None,
+ std::forward<TT>(t), std::forward<UU>(u))));
+ }
+}
+
+int main()
+{
+ using ERT = std::experimental::erased_type;
+ using PMR = ex::memory_resource*;
+ using PMA = ex::polymorphic_allocator<char>;
+ {
+ int x = 42;
+ int y = 42;
+ test_pmr_uses_allocator<ERT>(x, std::move(y));
+ test_pmr_uses_allocator<PMR>(x, std::move(y));
+ test_pmr_uses_allocator<PMA>(x, std::move(y));
+ }
+ {
+ int x = 42;
+ const int y = 42;
+ test_pmr_uses_allocator<ERT>(std::move(x), y);
+ test_pmr_uses_allocator<PMR>(std::move(x), y);
+ test_pmr_uses_allocator<PMA>(std::move(x), y);
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
new file mode 100644
index 000000000000..d0d76503da50
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
@@ -0,0 +1,130 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// template <class U1, class U2, class ...Args1, class ...Args2>
+// void polymorphic_allocator<T>::construct(pair<U1, U2>*, piecewise_construct_t
+// tuple<Args1...>, tuple<Args2...>)
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+#include "test_allocator.h"
+
+namespace ex = std::experimental::pmr;
+
+template <class T, class U, class ...TTuple, class ...UTuple>
+bool doTest(UsesAllocatorType TExpect, UsesAllocatorType UExpect,
+ std::tuple<TTuple...> ttuple, std::tuple<UTuple...> utuple)
+{
+ using P = std::pair<T, U>;
+ TestResource R;
+ ex::memory_resource * M = &R;
+ ex::polymorphic_allocator<P> A(M);
+ P * ptr = A.allocate(1);
+
+ // UNDER TEST //
+ A.construct(ptr, std::piecewise_construct, std::move(ttuple), std::move(utuple));
+ // ------- //
+ bool tres = checkConstruct<TTuple&&...>(ptr->first, TExpect, M);
+ bool ures = checkConstruct<UTuple&&...>(ptr->second, UExpect, M);
+
+ A.destroy(ptr);
+ A.deallocate(ptr, 1);
+ return tres && ures;
+}
+
+template <class Alloc, class ...TTypes, class ...UTypes>
+void test_pmr_uses_allocator(std::tuple<TTypes...> ttuple, std::tuple<UTypes...> utuple)
+{
+ {
+ using T = NotUsesAllocator<Alloc, sizeof...(TTypes)>;
+ using U = NotUsesAllocator<Alloc, sizeof...(UTypes)>;
+ assert((doTest<T, U>(UA_None, UA_None,
+ std::move(ttuple), std::move(utuple))));
+ }
+ {
+ using T = UsesAllocatorV1<Alloc, sizeof...(TTypes)>;
+ using U = UsesAllocatorV2<Alloc, sizeof...(UTypes)>;
+ assert((doTest<T, U>(UA_AllocArg, UA_AllocLast,
+ std::move(ttuple), std::move(utuple))));
+ }
+ {
+ using T = UsesAllocatorV2<Alloc, sizeof...(TTypes)>;
+ using U = UsesAllocatorV3<Alloc, sizeof...(UTypes)>;
+ assert((doTest<T, U>(UA_AllocLast, UA_AllocArg,
+ std::move(ttuple), std::move(utuple))));
+ }
+ {
+ using T = UsesAllocatorV3<Alloc, sizeof...(TTypes)>;
+ using U = NotUsesAllocator<Alloc, sizeof...(UTypes)>;
+ assert((doTest<T, U>(UA_AllocArg, UA_None,
+ std::move(ttuple), std::move(utuple))));
+ }
+}
+
+int main()
+{
+ using ERT = std::experimental::erased_type;
+ using PMR = ex::memory_resource*;
+ using PMA = ex::polymorphic_allocator<char>;
+ {
+ std::tuple<> t1;
+ test_pmr_uses_allocator<ERT>(t1, t1);
+ test_pmr_uses_allocator<PMR>(t1, t1);
+ test_pmr_uses_allocator<PMA>(t1, t1);
+ }
+ {
+ std::tuple<int> t1(42);
+ std::tuple<> t2;
+ test_pmr_uses_allocator<ERT>(t1, t2);
+ test_pmr_uses_allocator<ERT>(t2, t1);
+ test_pmr_uses_allocator<PMR>(t1, t2);
+ test_pmr_uses_allocator<PMR>(t2, t1);
+ test_pmr_uses_allocator<PMA>(t1, t2);
+ test_pmr_uses_allocator<PMA>(t2, t1);
+ }
+ {
+ std::tuple<int> t1(42);
+ int x = 55;
+ double dx = 42.42;
+ std::tuple<int&, double&&> t2(x, std::move(dx));
+ test_pmr_uses_allocator<ERT>( t1, std::move(t2));
+ test_pmr_uses_allocator<ERT>(std::move(t2), t1);
+ test_pmr_uses_allocator<PMR>( t1, std::move(t2));
+ test_pmr_uses_allocator<PMR>(std::move(t2), t1);
+ test_pmr_uses_allocator<PMA>( t1, std::move(t2));
+ test_pmr_uses_allocator<PMA>(std::move(t2), t1);
+ }
+ {
+ void* xptr = nullptr;
+ long y = 4242;
+ std::tuple<int, long const&, void*&> t1(42, y, xptr);
+ int x = 55;
+ double dx = 42.42;
+ const char* s = "hello World";
+ std::tuple<int&, double&&, const char*> t2(x, std::move(dx), s);
+ test_pmr_uses_allocator<ERT>( t1, std::move(t2));
+ test_pmr_uses_allocator<ERT>(std::move(t2), t1);
+ test_pmr_uses_allocator<PMR>( t1, std::move(t2));
+ test_pmr_uses_allocator<PMR>(std::move(t2), t1);
+ test_pmr_uses_allocator<PMA>( t1, std::move(t2));
+ test_pmr_uses_allocator<PMA>(std::move(t2), t1);
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
new file mode 100644
index 000000000000..73e4f0e101a8
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
@@ -0,0 +1,190 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// template <class U, class ...Args>
+// void polymorphic_allocator<T>::construct(U *, Args &&...)
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+#include "test_allocator.h"
+
+namespace ex = std::experimental::pmr;
+
+template <class T>
+struct PMATest {
+ TestResource R;
+ ex::polymorphic_allocator<T> A;
+ T* ptr;
+ bool constructed;
+
+ PMATest() : A(&R), ptr(A.allocate(1)), constructed(false) {}
+
+ template <class ...Args>
+ void construct(Args&&... args) {
+ A.construct(ptr, std::forward<Args>(args)...);
+ constructed = true;
+ }
+
+ ~PMATest() {
+ if (constructed) A.destroy(ptr);
+ A.deallocate(ptr, 1);
+ }
+};
+
+template <class T, class ...Args>
+bool doTest(UsesAllocatorType UAExpect, Args&&... args)
+{
+ PMATest<T> TH;
+ // UNDER TEST //
+ TH.construct(std::forward<Args>(args)...);
+ return checkConstruct<Args&&...>(*TH.ptr, UAExpect, &TH.R);
+ // ------- //
+}
+
+
+template <class T, class ...Args>
+bool doTestUsesAllocV0(Args&&... args)
+{
+ PMATest<T> TH;
+ // UNDER TEST //
+ TH.construct(std::forward<Args>(args)...);
+ return checkConstruct<Args&&...>(*TH.ptr, UA_None);
+ // -------- //
+}
+
+
+template <class T, class EAlloc, class ...Args>
+bool doTestUsesAllocV1(EAlloc const& ealloc, Args&&... args)
+{
+ PMATest<T> TH;
+ // UNDER TEST //
+ TH.construct(std::allocator_arg, ealloc, std::forward<Args>(args)...);
+ return checkConstruct<Args&&...>(*TH.ptr, UA_AllocArg, ealloc);
+ // -------- //
+}
+
+template <class T, class EAlloc, class ...Args>
+bool doTestUsesAllocV2(EAlloc const& ealloc, Args&&... args)
+{
+ PMATest<T> TH;
+ // UNDER TEST //
+ TH.construct(std::forward<Args>(args)..., ealloc);
+ return checkConstruct<Args&&...>(*TH.ptr, UA_AllocLast, ealloc);
+ // -------- //
+}
+
+template <class Alloc, class ...Args>
+void test_pmr_uses_alloc(Args&&... args)
+{
+ TestResource R(12435);
+ ex::memory_resource* M = &R;
+ {
+ // NotUsesAllocator provides valid signatures for each uses-allocator
+ // construction but does not supply the required allocator_type typedef.
+ // Test that we can call these constructors manually without
+ // polymorphic_allocator interfering.
+ using T = NotUsesAllocator<Alloc, sizeof...(Args)>;
+ assert(doTestUsesAllocV0<T>(std::forward<Args>(args)...));
+ assert((doTestUsesAllocV1<T>(M, std::forward<Args>(args)...)));
+ assert((doTestUsesAllocV2<T>(M, std::forward<Args>(args)...)));
+ }
+ {
+ // Test T(std::allocator_arg_t, Alloc const&, Args...) construction
+ using T = UsesAllocatorV1<Alloc, sizeof...(Args)>;
+ assert((doTest<T>(UA_AllocArg, std::forward<Args>(args)...)));
+ }
+ {
+ // Test T(Args..., Alloc const&) construction
+ using T = UsesAllocatorV2<Alloc, sizeof...(Args)>;
+ assert((doTest<T>(UA_AllocLast, std::forward<Args>(args)...)));
+ }
+ {
+ // Test that T(std::allocator_arg_t, Alloc const&, Args...) construction
+ // is prefered when T(Args..., Alloc const&) is also available.
+ using T = UsesAllocatorV3<Alloc, sizeof...(Args)>;
+ assert((doTest<T>(UA_AllocArg, std::forward<Args>(args)...)));
+ }
+}
+
+// Test that polymorphic_allocator does not prevent us from manually
+// doing non-pmr uses-allocator construction.
+template <class Alloc, class AllocObj, class ...Args>
+void test_non_pmr_uses_alloc(AllocObj const& A, Args&&... args)
+{
+ {
+ using T = NotUsesAllocator<Alloc, sizeof...(Args)>;
+ assert(doTestUsesAllocV0<T>(std::forward<Args>(args)...));
+ assert((doTestUsesAllocV1<T>(A, std::forward<Args>(args)...)));
+ assert((doTestUsesAllocV2<T>(A, std::forward<Args>(args)...)));
+ }
+ {
+ using T = UsesAllocatorV1<Alloc, sizeof...(Args)>;
+ assert(doTestUsesAllocV0<T>(std::forward<Args>(args)...));
+ assert((doTestUsesAllocV1<T>(A, std::forward<Args>(args)...)));
+ }
+ {
+ using T = UsesAllocatorV2<Alloc, sizeof...(Args)>;
+ assert(doTestUsesAllocV0<T>(std::forward<Args>(args)...));
+ assert((doTestUsesAllocV2<T>(A, std::forward<Args>(args)...)));
+ }
+ {
+ using T = UsesAllocatorV3<Alloc, sizeof...(Args)>;
+ assert(doTestUsesAllocV0<T>(std::forward<Args>(args)...));
+ assert((doTestUsesAllocV1<T>(A, std::forward<Args>(args)...)));
+ assert((doTestUsesAllocV2<T>(A, std::forward<Args>(args)...)));
+ }
+}
+
+int main()
+{
+ using ET = std::experimental::erased_type;
+ using PMR = ex::memory_resource*;
+ using PMA = ex::polymorphic_allocator<void>;
+ using STDA = std::allocator<char>;
+ using TESTA = test_allocator<char>;
+
+ int value = 42;
+ const int cvalue = 43;
+ {
+ test_pmr_uses_alloc<ET>();
+ test_pmr_uses_alloc<PMR>();
+ test_pmr_uses_alloc<PMA>();
+ test_pmr_uses_alloc<ET>(value);
+ test_pmr_uses_alloc<PMR>(value);
+ test_pmr_uses_alloc<PMA>(value);
+ test_pmr_uses_alloc<ET>(cvalue);
+ test_pmr_uses_alloc<PMR>(cvalue);
+ test_pmr_uses_alloc<PMA>(cvalue);
+ test_pmr_uses_alloc<ET>(cvalue, std::move(value));
+ test_pmr_uses_alloc<PMR>(cvalue, std::move(value));
+ test_pmr_uses_alloc<PMA>(cvalue, std::move(value));
+ }
+ {
+ STDA std_alloc;
+ TESTA test_alloc(42);
+ test_non_pmr_uses_alloc<STDA>(std_alloc);
+ test_non_pmr_uses_alloc<TESTA>(test_alloc);
+ test_non_pmr_uses_alloc<STDA>(std_alloc, value);
+ test_non_pmr_uses_alloc<TESTA>(test_alloc, value);
+ test_non_pmr_uses_alloc<STDA>(std_alloc, cvalue);
+ test_non_pmr_uses_alloc<TESTA>(test_alloc, cvalue);
+ test_non_pmr_uses_alloc<STDA>(std_alloc, cvalue, std::move(value));
+ test_non_pmr_uses_alloc<TESTA>(test_alloc, cvalue, std::move(value));
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp
new file mode 100644
index 000000000000..d60c2f2d90f6
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// T* polymorphic_allocator<T>::deallocate(T*, size_t size)
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+template <size_t S, size_t Align>
+void testForSizeAndAlign() {
+ using T = typename std::aligned_storage<S, Align>::type;
+
+ TestResource R;
+ ex::polymorphic_allocator<T> a(&R);
+
+ for (int N = 1; N <= 5; ++N) {
+ auto ret = a.allocate(N);
+ assert(R.checkAlloc(ret, N * sizeof(T), alignof(T)));
+
+ a.deallocate(ret, N);
+ assert(R.checkDealloc(ret, N * sizeof(T), alignof(T)));
+
+ R.reset();
+ }
+}
+
+int main()
+{
+ {
+ ex::polymorphic_allocator<int> a;
+ static_assert(
+ std::is_same<decltype(a.deallocate(nullptr, 0)), void>::value, "");
+ }
+ {
+ constexpr std::size_t MA = alignof(std::max_align_t);
+ testForSizeAndAlign<1, 1>();
+ testForSizeAndAlign<1, 2>();
+ testForSizeAndAlign<1, MA>();
+ testForSizeAndAlign<2, 2>();
+ testForSizeAndAlign<73, alignof(void*)>();
+ testForSizeAndAlign<73, MA>();
+ testForSizeAndAlign<13, MA>();
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp
new file mode 100644
index 000000000000..5d907660dce2
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// template <class U>
+// void polymorphic_allocator<T>::destroy(U * ptr);
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <new>
+#include <cassert>
+#include <cstdlib>
+
+namespace ex = std::experimental::pmr;
+
+int count = 0;
+
+struct destroyable
+{
+ destroyable() { ++count; }
+ ~destroyable() { --count; }
+};
+
+int main()
+{
+ typedef ex::polymorphic_allocator<double> A;
+ {
+ A a;
+ static_assert(
+ std::is_same<decltype(a.destroy((destroyable*)nullptr)), void>::value,
+ "");
+ }
+ {
+ destroyable * ptr = ::new (std::malloc(sizeof(destroyable))) destroyable();
+ assert(count == 1);
+ A{}.destroy(ptr);
+ assert(count == 0);
+ std::free(ptr);
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp
new file mode 100644
index 000000000000..b59606b9e80d
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// memory_resource *
+// polymorphic_allocator<T>::resource() const
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef ex::polymorphic_allocator<void> A;
+ {
+ A const a;
+ static_assert(
+ std::is_same<decltype(a.resource()), ex::memory_resource*>::value
+ , ""
+ );
+ }
+ {
+ ex::memory_resource * mptr = (ex::memory_resource*)42;
+ A const a(mptr);
+ assert(a.resource() == mptr);
+ }
+ {
+ A const a(nullptr);
+ assert(a.resource() == nullptr);
+ assert(a.resource() == nullptr);
+ }
+ {
+ A const a;
+ assert(a.resource() == ex::get_default_resource());
+ }
+ {
+ ex::memory_resource * mptr = (ex::memory_resource*)42;
+ ex::set_default_resource(mptr);
+ A const a;
+ assert(a.resource() == mptr);
+ assert(a.resource() == ex::get_default_resource());
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
new file mode 100644
index 000000000000..353fcafed740
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class T> class polymorphic_allocator
+
+// polymorphic_allocator
+// polymorphic_allocator<T>::select_on_container_copy_construction() const
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef ex::polymorphic_allocator<void> A;
+ {
+ A const a;
+ static_assert(
+ std::is_same<decltype(a.select_on_container_copy_construction()), A>::value,
+ "");
+ }
+ {
+ ex::memory_resource * mptr = (ex::memory_resource*)42;
+ A const a(mptr);
+ assert(a.resource() == mptr);
+ A const other = a.select_on_container_copy_construction();
+ assert(other.resource() == ex::get_default_resource());
+ assert(a.resource() == mptr);
+ }
+ {
+ ex::memory_resource * mptr = (ex::memory_resource*)42;
+ ex::set_default_resource(mptr);
+ A const a(nullptr);
+ assert(a.resource() == nullptr);
+ A const other = a.select_on_container_copy_construction();
+ assert(other.resource() == ex::get_default_resource());
+ assert(other.resource() == mptr);
+ assert(a.resource() == nullptr);
+ }
+}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.overview/nothing_to_do.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.overview/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..86bf8cc11bb9
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.overview/nothing_to_do.pass.cpp
@@ -0,0 +1,10 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main () {}
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/nothing_to_do.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..86bf8cc11bb9
--- /dev/null
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/nothing_to_do.pass.cpp
@@ -0,0 +1,10 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main () {}
diff --git a/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_copy.pass.cpp b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_copy.pass.cpp
new file mode 100644
index 000000000000..4de30bccb816
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_copy.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class Alloc> class resource_adaptor_imp;
+
+// resource_adaptor_imp<Alloc>::resource_adaptor_imp(Alloc const &)
+
+#include <experimental/memory_resource>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef CountingAllocator<char> AllocT;
+ typedef ex::resource_adaptor<AllocT> R;
+ {
+ AllocController P;
+ AllocT const a(P);
+ R const r(a);
+ assert(P.copy_constructed == 1);
+ assert(P.move_constructed == 0);
+ assert(r.get_allocator() == a);
+ }
+ {
+ AllocController P;
+ AllocT a(P);
+ R const r(a);
+ assert(P.copy_constructed == 1);
+ assert(P.move_constructed == 0);
+ assert(r.get_allocator() == a);
+ }
+ {
+ AllocController P;
+ AllocT const a(P);
+ R const r(std::move(a));
+ assert(P.copy_constructed == 1);
+ assert(P.move_constructed == 0);
+ assert(r.get_allocator() == a);
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_move.pass.cpp b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_move.pass.cpp
new file mode 100644
index 000000000000..f3ecc98eeaa9
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_move.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class Alloc> class resource_adaptor_imp;
+
+// resource_adaptor_imp<Alloc>::resource_adaptor_imp(Alloc &&)
+
+#include <experimental/memory_resource>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef CountingAllocator<char> AllocT;
+ typedef ex::resource_adaptor<AllocT> R;
+ {
+ AllocController P;
+ AllocT a(P);
+ R const r(std::move(a));
+ assert(P.copy_constructed == 0);
+ assert(P.move_constructed == 1);
+ assert(r.get_allocator() == a);
+ }
+ {
+ AllocController P;
+ R const r(AllocT{P});
+ assert(P.copy_constructed == 0);
+ assert(P.move_constructed == 1);
+ assert(r.get_allocator() == AllocT{P});
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/default.pass.cpp b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/default.pass.cpp
new file mode 100644
index 000000000000..4abc69f0b3d1
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/default.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class Alloc> class resource_adaptor_imp;
+
+// resource_adaptor_imp<Alloc>::resource_adaptor_imp() = default;
+
+#include <experimental/memory_resource>
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ {
+ typedef CountingAllocator<char> AllocT; // Not default constructible
+ typedef ex::resource_adaptor<AllocT> R;
+ static_assert(!std::is_default_constructible<R>::value, "");
+ }
+ {
+ typedef std::allocator<char> AllocT; // Is default constructible
+ typedef ex::resource_adaptor<AllocT> R;
+ static_assert(std::is_default_constructible<R>::value, "");
+ R r; ((void)r);
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp
new file mode 100644
index 000000000000..16b72697593d
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp
@@ -0,0 +1,115 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class Alloc> class resource_adaptor_imp;
+
+// void * do_allocate(size_t size, size_t align)
+// void do_deallocate(void*, size_t, size_t)
+
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <memory>
+#include <exception>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+template <class Alloc>
+void check_allocate_deallocate()
+{
+ typedef ex::resource_adaptor<Alloc> R1;
+ const std::size_t max_align = alignof(std::max_align_t);
+
+ for (std::size_t s = 1; s < 5012; ++s)
+ {
+ for(std::size_t align_req = 1; align_req <= (max_align * 2); align_req *= 2)
+ {
+ const std::size_t align_exp = align_req > max_align
+ ? max_align : align_req;
+ AllocController P;
+ R1 r{Alloc(P)};
+ ex::memory_resource & m1 = r;
+
+ void * const ret = m1.allocate(s, align_req);
+ assert(P.alive == 1);
+ assert(P.alloc_count == 1);
+ assert(P.checkAllocAtLeast(ret, s, align_exp));
+
+ assert(((std::size_t)ret % align_exp) == 0);
+
+ m1.deallocate(ret, s, align_req);
+ assert(P.alive == 0);
+ assert(P.dealloc_count == 1);
+ assert(P.checkDeallocMatchesAlloc());
+ }
+ }
+}
+
+void check_alloc_max_size() {
+ using Alloc = NullAllocator<char>;
+ using R1 = ex::resource_adaptor<Alloc>;
+ const std::size_t max_align = alignof(std::max_align_t);
+
+ auto check = [=](std::size_t s, std::size_t align_req) {
+ const std::size_t align_exp = align_req > max_align
+ ? max_align : align_req;
+ AllocController P;
+ R1 r{Alloc(P)};
+ ex::memory_resource & m1 = r;
+
+ void * const ret = m1.allocate(s, align_req);
+ assert(P.alive == 1);
+ assert(P.alloc_count == 1);
+ assert(P.checkAllocAtLeast(ret, s, align_exp));
+
+ m1.deallocate(ret, s, align_req);
+ assert(P.alive == 0);
+ assert(P.dealloc_count == 1);
+ assert(P.checkDeallocMatchesAlloc());
+ };
+
+ const std::size_t sizeTypeMax = ~0;
+ const std::size_t testSizeStart = sizeTypeMax - (max_align * 3);
+ const std::size_t testSizeEnd = sizeTypeMax - max_align;
+
+ for (std::size_t size = testSizeStart; size <= testSizeEnd; ++size) {
+ for (std::size_t align=1; align <= (max_align * 2); align *= 2) {
+ check(size, align);
+ }
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ for (std::size_t size = sizeTypeMax; size > testSizeEnd; --size) {
+ AllocController P;
+ R1 r{Alloc(P)};
+ ex::memory_resource & m1 = r;
+
+ try {
+ m1.allocate(size);
+ assert(false);
+ } catch (std::exception const&) {
+ }
+ }
+#endif
+}
+
+int main()
+{
+ check_allocate_deallocate<CountingAllocator<char>>();
+ check_allocate_deallocate<MinAlignedAllocator<char>>();
+ check_alloc_max_size();
+}
diff --git a/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_is_equal.pass.cpp b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_is_equal.pass.cpp
new file mode 100644
index 000000000000..ff4b3179a42a
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_is_equal.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class Alloc> class resource_adaptor_imp;
+
+// bool do_is_equal(memory_resource const &) const noexcept;
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <memory>
+#include <cassert>
+#include "test_memory_resource.hpp"
+
+using std::size_t;
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+
+ typedef CountingAllocator<char> Alloc1;
+ typedef CountingAllocator<int> RAlloc1;
+ typedef ex::resource_adaptor<Alloc1> R1;
+ typedef ex::resource_adaptor<RAlloc1> RR1;
+ static_assert(std::is_same<R1, RR1>::value, "");
+
+ typedef std::allocator<char> Alloc2;
+ typedef ex::resource_adaptor<Alloc2> R2;
+ static_assert(!std::is_same<R1, R2>::value, "");
+
+ // equal same type
+ {
+ AllocController C;
+ Alloc1 a1(C);
+ R1 const r1(a1);
+ ex::memory_resource const & m1 = r1;
+
+ Alloc1 a2(C);
+ R1 const r2(a2);
+ ex::memory_resource const & m2 = r2;
+
+ assert(m1.is_equal(m2));
+ assert(m2.is_equal(m1));
+ }
+ // not equal same type
+ {
+ AllocController C;
+ Alloc1 a1(C);
+ R1 const r1(a1);
+ ex::memory_resource const & m1 = r1;
+
+ AllocController C2;
+ Alloc1 a2(C2);
+ R1 const r2(a2);
+ ex::memory_resource const & m2 = r2;
+
+ assert(!m1.is_equal(m2));
+ assert(!m2.is_equal(m1));
+ }
+ // different allocator types
+ {
+ AllocController C;
+ Alloc1 a1(C);
+ R1 const r1(a1);
+ ex::memory_resource const & m1 = r1;
+
+ Alloc2 a2;
+ R2 const r2(a2);
+ ex::memory_resource const & m2 = r2;
+
+ assert(!m1.is_equal(m2));
+ assert(!m2.is_equal(m1));
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp
new file mode 100644
index 000000000000..898543fbce4b
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// template <class Alloc> class resource_adaptor_imp;
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <memory>
+#include <cassert>
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ typedef ex::resource_adaptor<std::allocator<void>> R;
+ typedef ex::resource_adaptor<std::allocator<long>> R2;
+ static_assert(std::is_same<R, R2>::value, "");
+ {
+ static_assert(std::is_base_of<ex::memory_resource, R>::value, "");
+ static_assert(std::is_same<R::allocator_type, std::allocator<char>>::value, "");
+ }
+ {
+ static_assert(std::is_default_constructible<R>::value, "");
+ static_assert(std::is_copy_constructible<R>::value, "");
+ static_assert(std::is_move_constructible<R>::value, "");
+ static_assert(std::is_copy_assignable<R>::value, "");
+ static_assert(std::is_move_assignable<R>::value, "");
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp
new file mode 100644
index 000000000000..5654a785aebb
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/deque>
+
+// namespace std { namespace experimental { namespace pmr {
+// template <class T>
+// using deque =
+// ::std::deque<T, polymorphic_allocator<T>>
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/deque>
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace pmr = std::experimental::pmr;
+
+int main()
+{
+ using StdDeque = std::deque<int, pmr::polymorphic_allocator<int>>;
+ using PmrDeque = pmr::deque<int>;
+ static_assert(std::is_same<StdDeque, PmrDeque>::value, "");
+ PmrDeque d;
+ assert(d.get_allocator().resource() == pmr::get_default_resource());
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp
new file mode 100644
index 000000000000..e834be3912f9
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/forward_list>
+
+// namespace std { namespace experimental { namespace pmr {
+// template <class T>
+// using forward_list =
+// ::std::forward_list<T, polymorphic_allocator<T>>
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/forward_list>
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace pmr = std::experimental::pmr;
+
+int main()
+{
+ using StdForwardList = std::forward_list<int, pmr::polymorphic_allocator<int>>;
+ using PmrForwardList = pmr::forward_list<int>;
+ static_assert(std::is_same<StdForwardList, PmrForwardList>::value, "");
+ PmrForwardList d;
+ assert(d.get_allocator().resource() == pmr::get_default_resource());
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp
new file mode 100644
index 000000000000..a53b528e877e
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/list>
+
+// namespace std { namespace experimental { namespace pmr {
+// template <class T>
+// using list =
+// ::std::list<T, polymorphic_allocator<T>>
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/list>
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace pmr = std::experimental::pmr;
+
+int main()
+{
+ using StdList = std::list<int, pmr::polymorphic_allocator<int>>;
+ using PmrList = pmr::list<int>;
+ static_assert(std::is_same<StdList, PmrList>::value, "");
+ PmrList d;
+ assert(d.get_allocator().resource() == pmr::get_default_resource());
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp
new file mode 100644
index 000000000000..4996d4e6dd25
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp
@@ -0,0 +1,69 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/map>
+
+// namespace std { namespace experimental { namespace pmr {
+// template <class K, class V, class Compare = less<Key> >
+// using map =
+// ::std::map<K, V, Compare, polymorphic_allocator<pair<const K, V>>>
+//
+// template <class K, class V, class Compare = less<Key> >
+// using multimap =
+// ::std::multimap<K, V, Compare, polymorphic_allocator<pair<const K, V>>>
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/map>
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace pmr = std::experimental::pmr;
+
+int main()
+{
+ using K = int;
+ using V = char;
+ using DC = std::less<int>;
+ using OC = std::greater<int>;
+ using P = std::pair<const K, V>;
+ {
+ using StdMap = std::map<K, V, DC, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::map<K, V>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ using StdMap = std::map<K, V, OC, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::map<K, V, OC>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ pmr::map<int, int> m;
+ assert(m.get_allocator().resource() == pmr::get_default_resource());
+ }
+ {
+ using StdMap = std::multimap<K, V, DC, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::multimap<K, V>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ using StdMap = std::multimap<K, V, OC, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::multimap<K, V, OC>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ pmr::multimap<int, int> m;
+ assert(m.get_allocator().resource() == pmr::get_default_resource());
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp
new file mode 100644
index 000000000000..f371c8a52f1d
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/regex>
+
+// namespace std { namespace experimental { namespace pmr {
+//
+// template <class BidirectionalIterator>
+// using match_results =
+// std::match_results<BidirectionalIterator,
+// polymorphic_allocator<sub_match<BidirectionalIterator>>>;
+//
+// typedef match_results<const char*> cmatch;
+// typedef match_results<const wchar_t*> wcmatch;
+// typedef match_results<string::const_iterator> smatch;
+// typedef match_results<wstring::const_iterator> wsmatch;
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/regex>
+#include <type_traits>
+#include <cassert>
+
+namespace pmr = std::experimental::pmr;
+
+template <class Iter, class PmrTypedef>
+void test_match_result_typedef() {
+ using StdMR = std::match_results<Iter, pmr::polymorphic_allocator<std::sub_match<Iter>>>;
+ using PmrMR = pmr::match_results<Iter>;
+ static_assert(std::is_same<StdMR, PmrMR>::value, "");
+ static_assert(std::is_same<PmrMR, PmrTypedef>::value, "");
+}
+
+int main()
+{
+ {
+ test_match_result_typedef<const char*, pmr::cmatch>();
+ test_match_result_typedef<const wchar_t*, pmr::wcmatch>();
+ test_match_result_typedef<pmr::string::const_iterator, pmr::smatch>();
+ test_match_result_typedef<pmr::wstring::const_iterator, pmr::wsmatch>();
+ }
+ {
+ // Check that std::match_results has been included and is complete.
+ pmr::smatch s;
+ assert(s.get_allocator().resource() == pmr::get_default_resource());
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp
new file mode 100644
index 000000000000..3af1d700504e
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/set>
+
+// namespace std { namespace experimental { namespace pmr {
+// template <class V, class Compare = less<V> >
+// using set =
+// ::std::set<V, Compare, polymorphic_allocator<V>>
+//
+// template <class V, class Compare = less<V> >
+// using multiset =
+// ::std::multiset<V, Compare, polymorphic_allocator<V>>
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/set>
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace pmr = std::experimental::pmr;
+
+int main()
+{
+ using V = char;
+ using DC = std::less<V>;
+ using OC = std::greater<V>;
+ {
+ using StdSet = std::set<V, DC, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::set<V>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ using StdSet = std::set<V, OC, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::set<V, OC>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ pmr::set<int> m;
+ assert(m.get_allocator().resource() == pmr::get_default_resource());
+ }
+ {
+ using StdSet = std::multiset<V, DC, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::multiset<V>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ using StdSet = std::multiset<V, OC, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::multiset<V, OC>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ pmr::multiset<int> m;
+ assert(m.get_allocator().resource() == pmr::get_default_resource());
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp
new file mode 100644
index 000000000000..21889c2da3d2
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/string>
+
+// namespace std { namespace experimental { namespace pmr {
+// template <class Char, class Traits = ...>
+// using basic_string =
+// ::std::basic_string<Char, Traits, polymorphic_allocator<Char>>
+//
+// typedef ... string
+// typedef ... u16string
+// typedef ... u32string
+// typedef ... wstring
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/string>
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "constexpr_char_traits.hpp"
+
+namespace pmr = std::experimental::pmr;
+
+template <class Char, class PmrTypedef>
+void test_string_typedef() {
+ using StdStr = std::basic_string<Char, std::char_traits<Char>,
+ pmr::polymorphic_allocator<Char>>;
+ using PmrStr = pmr::basic_string<Char>;
+ static_assert(std::is_same<StdStr, PmrStr>::value, "");
+ static_assert(std::is_same<PmrStr, PmrTypedef>::value, "");
+}
+
+template <class Char, class Traits>
+void test_basic_string_alias() {
+ using StdStr = std::basic_string<Char, Traits,
+ pmr::polymorphic_allocator<Char>>;
+ using PmrStr = pmr::basic_string<Char, Traits>;
+ static_assert(std::is_same<StdStr, PmrStr>::value, "");
+}
+
+int main()
+{
+ {
+ test_string_typedef<char, pmr::string>();
+ test_string_typedef<wchar_t, pmr::wstring>();
+ test_string_typedef<char16_t, pmr::u16string>();
+ test_string_typedef<char32_t, pmr::u32string>();
+ }
+ {
+ test_basic_string_alias<char, constexpr_char_traits<char>>();
+ test_basic_string_alias<wchar_t, constexpr_char_traits<wchar_t>>();
+ test_basic_string_alias<char16_t, constexpr_char_traits<char16_t>>();
+ test_basic_string_alias<char32_t, constexpr_char_traits<char32_t>>();
+ }
+ {
+ // Check that std::basic_string has been included and is complete.
+ pmr::string s;
+ assert(s.get_allocator().resource() == pmr::get_default_resource());
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp
new file mode 100644
index 000000000000..99c928b7a9fd
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/unordered_map>
+
+// namespace std { namespace experimental { namespace pmr {
+// template <class K, class V, class H = hash<K>, class P = equal_to<K> >
+// using unordered_map =
+// ::std::unordered_map<K, V, H, P, polymorphic_allocator<pair<const K, V>>>
+//
+// template <class K, class V, class H = hash<K>, class P = equal_to<K> >
+// using unordered_multimap =
+// ::std::unordered_multimap<K, V, H, P, polymorphic_allocator<pair<const K, V>>>
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/unordered_map>
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace pmr = std::experimental::pmr;
+
+template <class T>
+struct MyHash : std::hash<T> {};
+
+template <class T>
+struct MyPred : std::equal_to<T> {};
+
+int main()
+{
+ using K = int;
+ using V = char;
+ using DH = std::hash<K>;
+ using MH = MyHash<K>;
+ using DP = std::equal_to<K>;
+ using MP = MyPred<K>;
+ using P = std::pair<const K, V>;
+ {
+ using StdMap = std::unordered_map<K, V, DH, DP, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::unordered_map<K, V>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ using StdMap = std::unordered_map<K, V, MH, DP, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::unordered_map<K, V, MH>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ using StdMap = std::unordered_map<K, V, MH, MP, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::unordered_map<K, V, MH, MP>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ pmr::unordered_map<int, int> m;
+ assert(m.get_allocator().resource() == pmr::get_default_resource());
+ }
+ {
+ using StdMap = std::unordered_multimap<K, V, DH, DP, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::unordered_multimap<K, V>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ using StdMap = std::unordered_multimap<K, V, MH, DP, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::unordered_multimap<K, V, MH>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ using StdMap = std::unordered_multimap<K, V, MH, MP, pmr::polymorphic_allocator<P>>;
+ using PmrMap = pmr::unordered_multimap<K, V, MH, MP>;
+ static_assert(std::is_same<StdMap, PmrMap>::value, "");
+ }
+ {
+ pmr::unordered_multimap<int, int> m;
+ assert(m.get_allocator().resource() == pmr::get_default_resource());
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
new file mode 100644
index 000000000000..d427fe7c4ab0
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/unordered_set>
+
+// namespace std { namespace experimental { namespace pmr {
+// template <class V, class H = hash<V>, class P = equal_to<V> >
+// using unordered_set =
+// ::std::unordered_set<V, H, P, polymorphic_allocator<V>>
+//
+// template <class V, class H = hash<V>, class P = equal_to<V> >
+// using unordered_multiset =
+// ::std::unordered_multiset<V, H, P, polymorphic_allocator<V>>
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/unordered_set>
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace pmr = std::experimental::pmr;
+
+template <class T>
+struct MyHash : std::hash<T> {};
+
+template <class T>
+struct MyPred : std::equal_to<T> {};
+
+int main()
+{
+ using V = char;
+ using DH = std::hash<V>;
+ using MH = MyHash<V>;
+ using DP = std::equal_to<V>;
+ using MP = MyPred<V>;
+ {
+ using StdSet = std::unordered_set<V, DH, DP, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::unordered_set<V>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ using StdSet = std::unordered_set<V, MH, DP, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::unordered_set<V, MH>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ using StdSet = std::unordered_set<V, MH, MP, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::unordered_set<V, MH, MP>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ pmr::unordered_set<int> m;
+ assert(m.get_allocator().resource() == pmr::get_default_resource());
+ }
+ {
+ using StdSet = std::unordered_multiset<V, DH, DP, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::unordered_multiset<V>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ using StdSet = std::unordered_multiset<V, MH, DP, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::unordered_multiset<V, MH>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ using StdSet = std::unordered_multiset<V, MH, MP, pmr::polymorphic_allocator<V>>;
+ using PmrSet = pmr::unordered_multiset<V, MH, MP>;
+ static_assert(std::is_same<StdSet, PmrSet>::value, "");
+ }
+ {
+ pmr::unordered_multiset<int> m;
+ assert(m.get_allocator().resource() == pmr::get_default_resource());
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp b/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp
new file mode 100644
index 000000000000..7dfd3b820b36
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/vector>
+
+// namespace std { namespace experimental { namespace pmr {
+// template <class T>
+// using vector =
+// ::std::vector<T, polymorphic_allocator<T>>
+//
+// }}} // namespace std::experimental::pmr
+
+#include <experimental/vector>
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace pmr = std::experimental::pmr;
+
+int main()
+{
+ using StdVector = std::vector<int, pmr::polymorphic_allocator<int>>;
+ using PmrVector = pmr::vector<int>;
+ static_assert(std::is_same<StdVector, PmrVector>::value, "");
+ PmrVector d;
+ assert(d.get_allocator().resource() == pmr::get_default_resource());
+}
diff --git a/test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp b/test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
new file mode 100644
index 000000000000..7aa16ab506fe
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+//-----------------------------------------------------------------------------
+// TESTING memory_resource * get_default_resource() noexcept;
+// memory_resource * set_default_resource(memory_resource*) noexcept;
+//
+// Concerns:
+// A) 'get_default_resource()' returns a non-null memory_resource pointer.
+// B) 'get_default_resource()' returns the value set by the last call to
+// 'set_default_resource(...)' and 'new_delete_resource()' if no call
+// to 'set_default_resource(...)' has occurred.
+// C) 'set_default_resource(...)' returns the previous value of the default
+// resource.
+// D) 'set_default_resource(T* p)' for a non-null 'p' sets the default resource
+// to be 'p'.
+// E) 'set_default_resource(null)' sets the default resource to
+// 'new_delete_resource()'.
+// F) 'get_default_resource' and 'set_default_resource' are noexcept.
+
+
+#include <experimental/memory_resource>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+using namespace std::experimental::pmr;
+
+int main() {
+ TestResource R;
+ { // Test (A) and (B)
+ memory_resource* p = get_default_resource();
+ assert(p != nullptr);
+ assert(p == new_delete_resource());
+ assert(p == get_default_resource());
+ }
+ { // Test (C) and (D)
+ memory_resource *expect = &R;
+ memory_resource *old = set_default_resource(expect);
+ assert(old != nullptr);
+ assert(old == new_delete_resource());
+
+ memory_resource *p = get_default_resource();
+ assert(p != nullptr);
+ assert(p == expect);
+ assert(p == get_default_resource());
+ }
+ { // Test (E)
+ memory_resource* old = set_default_resource(nullptr);
+ assert(old == &R);
+ memory_resource* p = get_default_resource();
+ assert(p != nullptr);
+ assert(p == new_delete_resource());
+ assert(p == get_default_resource());
+ }
+ { // Test (F)
+ static_assert(noexcept(get_default_resource()),
+ "get_default_resource() must be noexcept");
+
+ static_assert(noexcept(set_default_resource(nullptr)),
+ "set_default_resource() must be noexcept");
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp b/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
new file mode 100644
index 000000000000..412e3323d1ba
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// memory_resource * new_delete_resource()
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "count_new.hpp"
+
+namespace ex = std::experimental::pmr;
+
+struct assert_on_compare : public ex::memory_resource
+{
+protected:
+ virtual void * do_allocate(size_t, size_t)
+ { assert(false); }
+
+ virtual void do_deallocate(void *, size_t, size_t)
+ { assert(false); }
+
+ virtual bool do_is_equal(ex::memory_resource const &) const noexcept
+ { assert(false); }
+};
+
+void test_return()
+{
+ {
+ static_assert(std::is_same<
+ decltype(ex::new_delete_resource()), ex::memory_resource*
+ >::value, "");
+ }
+ // assert not null
+ {
+ assert(ex::new_delete_resource());
+ }
+ // assert same return value
+ {
+ assert(ex::new_delete_resource() == ex::new_delete_resource());
+ }
+}
+
+void test_equality()
+{
+ // Same object
+ {
+ ex::memory_resource & r1 = *ex::new_delete_resource();
+ ex::memory_resource & r2 = *ex::new_delete_resource();
+ // check both calls returned the same object
+ assert(&r1 == &r2);
+ // check for proper equality semantics
+ assert(r1 == r2);
+ assert(r2 == r1);
+ assert(!(r1 != r2));
+ assert(!(r2 != r1));
+ }
+ // Different types
+ {
+ ex::memory_resource & r1 = *ex::new_delete_resource();
+ assert_on_compare c;
+ ex::memory_resource & r2 = c;
+ assert(r1 != r2);
+ assert(!(r1 == r2));
+ }
+}
+
+void test_allocate_deallocate()
+{
+ ex::memory_resource & r1 = *ex::new_delete_resource();
+
+ globalMemCounter.reset();
+
+ void *ret = r1.allocate(50);
+ assert(ret);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(globalMemCounter.checkLastNewSizeEq(50));
+
+ r1.deallocate(ret, 1);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(globalMemCounter.checkDeleteCalledEq(1));
+
+}
+
+int main()
+{
+ static_assert(noexcept(ex::new_delete_resource()), "Must be noexcept");
+ test_return();
+ test_equality();
+ test_allocate_deallocate();
+}
diff --git a/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp b/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
new file mode 100644
index 000000000000..f263df30ef4d
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
@@ -0,0 +1,118 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++experimental
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// memory_resource * null_memory_resource()
+
+#include <experimental/memory_resource>
+#include <new>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "count_new.hpp"
+
+namespace ex = std::experimental::pmr;
+
+struct assert_on_compare : public ex::memory_resource
+{
+protected:
+ virtual void * do_allocate(size_t, size_t)
+ { assert(false); }
+
+ virtual void do_deallocate(void *, size_t, size_t)
+ { assert(false); }
+
+ virtual bool do_is_equal(ex::memory_resource const &) const noexcept
+ { assert(false); }
+};
+
+void test_return()
+{
+ {
+ static_assert(std::is_same<
+ decltype(ex::null_memory_resource()), ex::memory_resource*
+ >::value, "");
+ }
+ // Test that the returned value is not null
+ {
+ assert(ex::null_memory_resource());
+ }
+ // Test the same value is returned by repeated calls.
+ {
+ assert(ex::null_memory_resource() == ex::null_memory_resource());
+ }
+}
+
+void test_equality()
+{
+ // Same object
+ {
+ ex::memory_resource & r1 = *ex::null_memory_resource();
+ ex::memory_resource & r2 = *ex::null_memory_resource();
+ // check both calls returned the same object
+ assert(&r1 == &r2);
+ // check for proper equality semantics
+ assert(r1 == r2);
+ assert(r2 == r1);
+ assert(!(r1 != r2));
+ assert(!(r2 != r1));
+ // check the is_equal method
+ assert(r1.is_equal(r2));
+ assert(r2.is_equal(r1));
+ }
+ // Different types
+ {
+ ex::memory_resource & r1 = *ex::null_memory_resource();
+ assert_on_compare c;
+ ex::memory_resource & r2 = c;
+ assert(r1 != r2);
+ assert(!(r1 == r2));
+ assert(!r1.is_equal(r2));
+ }
+}
+
+void test_allocate()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ DisableAllocationGuard g; // null_memory_resource shouldn't allocate.
+ try {
+ ex::null_memory_resource()->allocate(1);
+ assert(false);
+ } catch (std::bad_alloc const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+#endif
+}
+
+void test_deallocate()
+{
+ globalMemCounter.reset();
+
+ int x = 42;
+ ex::null_memory_resource()->deallocate(nullptr, 0);
+ ex::null_memory_resource()->deallocate(&x, 0);
+
+ assert(globalMemCounter.checkDeleteCalledEq(0));
+ assert(globalMemCounter.checkDeleteArrayCalledEq(0));
+}
+
+int main()
+{
+ test_return();
+ test_equality();
+ test_allocate();
+ test_deallocate();
+}
diff --git a/test/std/experimental/memory/memory.resource.synop/nothing_to_do.pass.cpp b/test/std/experimental/memory/memory.resource.synop/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..9a59227abdd9
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource.synop/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/experimental/memory/memory.resource/construct.fail.cpp b/test/std/experimental/memory/memory.resource/construct.fail.cpp
new file mode 100644
index 000000000000..d990714acfd1
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource/construct.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// Check that memory_resource is not constructible
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ ex::memory_resource m; // expected-error {{variable type 'ex::memory_resource' is an abstract class}}
+}
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.eq/equal.pass.cpp b/test/std/experimental/memory/memory.resource/memory.resource.eq/equal.pass.cpp
new file mode 100644
index 000000000000..0ccdeed3c54f
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource/memory.resource.eq/equal.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// bool operator==(memory_resource const &, memory_resource const &) noexcept;
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ // check return types
+ {
+ ex::memory_resource const * mr1(nullptr);
+ ex::memory_resource const * mr2(nullptr);
+ static_assert(std::is_same<decltype(*mr1 == *mr2), bool>::value, "");
+ static_assert(noexcept(*mr1 == *mr2), "");
+ }
+ // equal
+ {
+ TestResource r1(1);
+ TestResource r2(1);
+ ex::memory_resource const & mr1 = r1;
+ ex::memory_resource const & mr2 = r2;
+
+ assert(mr1 == mr2);
+ assert(r1.checkIsEqualCalledEq(1));
+ assert(r2.checkIsEqualCalledEq(0));
+
+ assert(mr2 == mr1);
+ assert(r1.checkIsEqualCalledEq(1));
+ assert(r2.checkIsEqualCalledEq(1));
+ }
+ // equal same object
+ {
+ TestResource r1(1);
+ ex::memory_resource const & mr1 = r1;
+ ex::memory_resource const & mr2 = r1;
+
+ assert(mr1 == mr2);
+ assert(r1.checkIsEqualCalledEq(0));
+
+ assert(mr2 == mr1);
+ assert(r1.checkIsEqualCalledEq(0));
+ }
+ // not equal
+ {
+ TestResource r1(1);
+ TestResource r2(2);
+ ex::memory_resource const & mr1 = r1;
+ ex::memory_resource const & mr2 = r2;
+
+ assert(!(mr1 == mr2));
+ assert(r1.checkIsEqualCalledEq(1));
+ assert(r2.checkIsEqualCalledEq(0));
+
+ assert(!(mr2 == mr1));
+ assert(r1.checkIsEqualCalledEq(1));
+ assert(r2.checkIsEqualCalledEq(1));
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.eq/not_equal.pass.cpp b/test/std/experimental/memory/memory.resource/memory.resource.eq/not_equal.pass.cpp
new file mode 100644
index 000000000000..ede1bfdf9bac
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource/memory.resource.eq/not_equal.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// bool operator!=(memory_resource const &, memory_resource const &) noexcept;
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+namespace ex = std::experimental::pmr;
+
+int main()
+{
+ // check return types
+ {
+ ex::memory_resource const * mr1(nullptr);
+ ex::memory_resource const * mr2(nullptr);
+ static_assert(std::is_same<decltype(*mr1 != *mr2), bool>::value, "");
+ static_assert(noexcept(*mr1 != *mr2), "");
+ }
+ // not equal
+ {
+ TestResource r1(1);
+ TestResource r2(2);
+ ex::memory_resource const & mr1 = r1;
+ ex::memory_resource const & mr2 = r2;
+
+ assert(mr1 != mr2);
+ assert(r1.checkIsEqualCalledEq(1));
+ assert(r2.checkIsEqualCalledEq(0));
+
+ assert(mr2 != mr1);
+ assert(r1.checkIsEqualCalledEq(1));
+ assert(r2.checkIsEqualCalledEq(1));
+ }
+ // equal
+ {
+ TestResource r1(1);
+ TestResource r2(1);
+ ex::memory_resource const & mr1 = r1;
+ ex::memory_resource const & mr2 = r2;
+
+ assert(!(mr1 != mr2));
+ assert(r1.checkIsEqualCalledEq(1));
+ assert(r2.checkIsEqualCalledEq(0));
+
+ assert(!(mr2 != mr1));
+ assert(r1.checkIsEqualCalledEq(1));
+ assert(r2.checkIsEqualCalledEq(1));
+ }
+ // equal same object
+ {
+ TestResource r1(1);
+ ex::memory_resource const & mr1 = r1;
+ ex::memory_resource const & mr2 = r1;
+
+ assert(!(mr1 != mr2));
+ assert(r1.checkIsEqualCalledEq(0));
+
+ assert(!(mr2 != mr1));
+ assert(r1.checkIsEqualCalledEq(0));
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.overview/nothing_to_do.pass.cpp b/test/std/experimental/memory/memory.resource/memory.resource.overview/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..86bf8cc11bb9
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource/memory.resource.overview/nothing_to_do.pass.cpp
@@ -0,0 +1,10 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main () {}
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp b/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp
new file mode 100644
index 000000000000..eddfede29630
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+// memory_resource::do_allocate(size_t, size_t); /* protected */
+// memory_resource::do_deallocate(void*, size_t, size_t); /* protected */
+// memory_resource::do_is_equal(memory_resource const&); /* protected */
+
+#include <experimental/memory_resource>
+
+namespace ex = std::experimental::pmr;
+
+int main() {
+ ex::memory_resource *m = ex::new_delete_resource();
+ m->do_allocate(0, 0); // expected-error{{'do_allocate' is a protected member}}
+ m->do_deallocate(nullptr, 0, 0); // expected-error{{'do_deallocate' is a protected member}}
+ m->do_is_equal(*m); // expected-error{{'do_is_equal' is a protected member}}
+} \ No newline at end of file
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp b/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
new file mode 100644
index 000000000000..26cf903fe0d8
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/memory_resource>
+
+// UNSUPPORTED: c++98, c++03
+
+//------------------------------------------------------------------------------
+// TESTING void * memory_resource::allocate(size_t, size_t = max_align)
+//
+// Concerns:
+// A) 'memory_resource' contains a member 'allocate' with the required
+// signature, including the default alignment parameter.
+// B) The return type of 'allocate' is 'void*'.
+// C) 'allocate' is not marked as 'noexcept'.
+// D) Invoking 'allocate' invokes 'do_allocate' with the same arguments.
+// E) If 'do_allocate' throws then 'allocate' propagates that exception.
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cstddef>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
+
+using std::experimental::pmr::memory_resource;
+
+int main()
+{
+ TestResource R(42);
+ auto& P = R.getController();
+ memory_resource& M = R;
+ {
+ static_assert(
+ std::is_same<decltype(M.allocate(0, 0)), void*>::value
+ , "Must be void*"
+ );
+ static_assert(
+ std::is_same<decltype(M.allocate(0)), void*>::value
+ , "Must be void*"
+ );
+ }
+ {
+ static_assert(
+ ! noexcept(M.allocate(0, 0))
+ , "Must not be noexcept."
+ );
+ static_assert(
+ ! noexcept(M.allocate(0))
+ , "Must not be noexcept."
+ );
+ }
+ {
+ int s = 42;
+ int a = 64;
+ void* p = M.allocate(s, a);
+ assert(P.alloc_count == 1);
+ assert(P.checkAlloc(p, s, a));
+
+ s = 128;
+ a = MaxAlignV;
+ p = M.allocate(s);
+ assert(P.alloc_count == 2);
+ assert(P.checkAlloc(p, s, a));
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ TestResource R2;
+ auto& P = R2.getController();
+ P.throw_on_alloc = true;
+ memory_resource& M2 = R2;
+ try {
+ M2.allocate(42);
+ assert(false);
+ } catch (TestException const&) {
+ // do nothing.
+ } catch (...) {
+ assert(false);
+ }
+ }
+#endif
+}
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.public/deallocate.pass.cpp b/test/std/experimental/memory/memory.resource/memory.resource.public/deallocate.pass.cpp
new file mode 100644
index 000000000000..d1a4ab2b8196
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource/memory.resource.public/deallocate.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/memory_resource>
+
+// UNSUPPORTED: c++98, c++03
+
+//------------------------------------------------------------------------------
+// TESTING void * memory_resource::deallocate(void *, size_t, size_t = max_align)
+//
+// Concerns:
+// A) 'memory_resource' contains a member 'deallocate' with the required
+// signature, including the default alignment parameter.
+// B) The return type of 'deallocate' is 'void'.
+// C) 'deallocate' is not marked as 'noexcept'.
+// D) Invoking 'deallocate' invokes 'do_deallocate' with the same arguments.
+
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cstddef>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+using std::experimental::pmr::memory_resource;
+
+int main()
+{
+ NullResource R(42);
+ auto& P = R.getController();
+ memory_resource& M = R;
+ {
+ static_assert(
+ std::is_same<decltype(M.deallocate(nullptr, 0, 0)), void>::value
+ , "Must be void"
+ );
+ static_assert(
+ std::is_same<decltype(M.deallocate(nullptr, 0)), void>::value
+ , "Must be void"
+ );
+ }
+ {
+ static_assert(
+ ! noexcept(M.deallocate(nullptr, 0, 0))
+ , "Must not be noexcept."
+ );
+ static_assert(
+ ! noexcept(M.deallocate(nullptr, 0))
+ , "Must not be noexcept."
+ );
+ }
+ {
+ int s = 100;
+ int a = 64;
+ void* p = reinterpret_cast<void*>(640);
+ M.deallocate(p, s, a);
+ assert(P.dealloc_count == 1);
+ assert(P.checkDealloc(p, s, a));
+
+ s = 128;
+ a = alignof(std::max_align_t);
+ p = reinterpret_cast<void*>(12800);
+ M.deallocate(p, s);
+ assert(P.dealloc_count == 2);
+ assert(P.checkDealloc(p, s, a));
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.public/dtor.pass.cpp b/test/std/experimental/memory/memory.resource/memory.resource.public/dtor.pass.cpp
new file mode 100644
index 000000000000..9e1d28618f92
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource/memory.resource.public/dtor.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+//------------------------------------------------------------------------------
+// TESTING virtual ~memory_resource()
+//
+// Concerns:
+// A) 'memory_resource' is destructible.
+// B) The destructor is implicitly marked noexcept.
+// C) The destructor is marked virtual.
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+
+#include "test_memory_resource.hpp"
+
+using std::experimental::pmr::memory_resource;
+
+int main()
+{
+ static_assert(
+ std::has_virtual_destructor<memory_resource>::value
+ , "Must have virtual destructor"
+ );
+ static_assert(
+ std::is_nothrow_destructible<memory_resource>::value,
+ "Must be nothrow destructible"
+ );
+ static_assert(
+ std::is_abstract<memory_resource>::value
+ , "Must be abstract"
+ );
+ // Check that the destructor of `TestResource` is called when
+ // it is deleted as a pointer to `memory_resource`
+ {
+ using TR = TestResource;
+ memory_resource* M = new TR(42);
+ assert(TR::resource_alive == 1);
+ assert(TR::resource_constructed == 1);
+ assert(TR::resource_destructed == 0);
+
+ delete M;
+
+ assert(TR::resource_alive == 0);
+ assert(TR::resource_constructed == 1);
+ assert(TR::resource_destructed == 1);
+ }
+}
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.public/is_equal.pass.cpp b/test/std/experimental/memory/memory.resource/memory.resource.public/is_equal.pass.cpp
new file mode 100644
index 000000000000..32792cf867a6
--- /dev/null
+++ b/test/std/experimental/memory/memory.resource/memory.resource.public/is_equal.pass.cpp
@@ -0,0 +1,93 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/memory_resource>
+
+//------------------------------------------------------------------------------
+// TESTING virtual bool is_equal(memory_resource const &) const noexcept
+//
+// Concerns:
+// A) 'memory_resource' provides a function 'is_equal' with the required
+// signature.
+// B) 'is_equal' is noexcept.
+// C) 'do_is_equal' is called using the same arguments passed to 'is_equal'
+// and the resulting value is returned.
+// D) 'do_is_equal' is called on the LHS object and not the RHS object.
+
+#include <experimental/memory_resource>
+#include <type_traits>
+#include <cassert>
+#include "test_memory_resource.hpp"
+
+using std::experimental::pmr::memory_resource;
+
+int main()
+{
+ {
+ memory_resource const* r1 = nullptr;
+ memory_resource const* r2 = nullptr;
+ static_assert(
+ noexcept(r1->is_equal(*r2))
+ , "is_equal must be noexcept"
+ );
+ }
+ {
+ TestResource1 R1(1);
+ auto& P1 = R1.getController();
+ memory_resource const& M1 = R1;
+
+ TestResource2 R2(1);
+ auto& P2 = R2.getController();
+ memory_resource const& M2 = R2;
+
+ assert(M1.is_equal(M2) == false);
+ assert(P1.checkIsEqualCalledEq(1));
+ assert(P2.checkIsEqualCalledEq(0));
+
+ assert(M2.is_equal(M1) == false);
+ assert(P2.checkIsEqualCalledEq(1));
+ assert(P1.checkIsEqualCalledEq(1));
+ }
+ {
+ TestResource1 R1(1);
+ auto& P1 = R1.getController();
+ memory_resource const& M1 = R1;
+
+ TestResource1 R2(2);
+ auto& P2 = R2.getController();
+ memory_resource const& M2 = R2;
+
+ assert(M1.is_equal(M2) == false);
+ assert(P1.checkIsEqualCalledEq(1));
+ assert(P2.checkIsEqualCalledEq(0));
+
+ assert(M2.is_equal(M1) == false);
+ assert(P2.checkIsEqualCalledEq(1));
+ assert(P1.checkIsEqualCalledEq(1));
+ }
+ {
+ TestResource1 R1(1);
+ auto& P1 = R1.getController();
+ memory_resource const& M1 = R1;
+
+ TestResource1 R2(1);
+ auto& P2 = R2.getController();
+ memory_resource const& M2 = R2;
+
+ assert(M1.is_equal(M2) == true);
+ assert(P1.checkIsEqualCalledEq(1));
+ assert(P2.checkIsEqualCalledEq(0));
+
+ assert(M2.is_equal(M1) == true);
+ assert(P2.checkIsEqualCalledEq(1));
+ assert(P1.checkIsEqualCalledEq(1));
+ }
+}
diff --git a/test/std/experimental/memory/nothing_to_do.pass.cpp b/test/std/experimental/memory/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..9a59227abdd9
--- /dev/null
+++ b/test/std/experimental/memory/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp b/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp
index cecf98a3518b..c166bb72a837 100644
--- a/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp
+++ b/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
+
// <optional>
// class bad_optional_access is default constructible
@@ -16,8 +18,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::bad_optional_access;
bad_optional_access ex;
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp b/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp
index c13d6603990a..4630165f0708 100644
--- a/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp
+++ b/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp
@@ -7,19 +7,19 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
+
// <optional>
-// class bad_optional_access : public logic_error
+// class bad_optional_access : public logic_error
#include <experimental/optional>
#include <type_traits>
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::bad_optional_access;
static_assert(std::is_base_of<std::logic_error, bad_optional_access>::value, "");
static_assert(std::is_convertible<bad_optional_access*, std::logic_error*>::value, "");
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp
index e796723cc097..749fa7dcf0a1 100644
--- a/test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp
+++ b/test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator==(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,16 +26,13 @@ struct X
constexpr bool operator == ( const X &lhs, const X &rhs )
{ return lhs.i_ == rhs.i_ ; }
-
-#endif
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef X T;
typedef optional<T> O;
-
+
constexpr T val(2);
constexpr O o1; // disengaged
constexpr O o2{1}; // engaged
@@ -47,12 +43,11 @@ int main()
static_assert ( !(o3 == T(1)), "" );
static_assert ( (o3 == T(2)), "" );
static_assert ( (o3 == val), "" );
-
+
static_assert ( !(T(1) == o1), "" );
static_assert ( (T(1) == o2), "" );
static_assert ( !(T(1) == o3), "" );
static_assert ( (T(2) == o3), "" );
static_assert ( (val == o3), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp
index cf3923bb4fb0..c4d95a1c878f 100644
--- a/test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp
+++ b/test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator>(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,13 +26,9 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; }
-
-#endif
int main()
{
-#if _LIBCPP_STD_VER > 11
-
{
typedef X T;
typedef optional<T> O;
@@ -57,5 +52,4 @@ int main()
static_assert ( !(val > o3), "" ); // equal
static_assert ( (T(3) > o3), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp
index 85fea1377b3c..ce1cd9f98481 100644
--- a/test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator>=(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,13 +26,9 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; }
-
-#endif
int main()
{
-#if _LIBCPP_STD_VER > 11
-
{
typedef X T;
typedef optional<T> O;
@@ -57,5 +52,4 @@ int main()
static_assert ( (val >= o3), "" ); // equal
static_assert ( (T(3) >= o3), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp
index 333f7cdea219..c519bde1e9f2 100644
--- a/test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator<=(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,13 +26,9 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; }
-
-#endif
int main()
{
-#if _LIBCPP_STD_VER > 11
-
{
typedef X T;
typedef optional<T> O;
@@ -57,5 +52,4 @@ int main()
static_assert ( (val <= o3), "" ); // equal
static_assert ( !(T(3) <= o3), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp
index e35df21bbabb..ee1e98f2b8c9 100644
--- a/test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp
+++ b/test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator<(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,13 +26,9 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; }
-
-#endif
int main()
{
-#if _LIBCPP_STD_VER > 11
-
{
typedef X T;
typedef optional<T> O;
@@ -57,5 +52,4 @@ int main()
static_assert ( !(val < o3), "" ); // equal
static_assert ( !(T(3) < o3), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp b/test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp
index 0dad68d38635..a3daa02d5dbb 100644
--- a/test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator!=(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,16 +26,13 @@ struct X
constexpr bool operator == ( const X &lhs, const X &rhs )
{ return lhs.i_ == rhs.i_ ; }
-
-#endif
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef X T;
typedef optional<T> O;
-
+
constexpr T val(2);
constexpr O o1; // disengaged
constexpr O o2{1}; // engaged
@@ -47,12 +43,11 @@ int main()
static_assert ( (o3 != T(1)), "" );
static_assert ( !(o3 != T(2)), "" );
static_assert ( !(o3 != val), "" );
-
+
static_assert ( (T(1) != o1), "" );
static_assert ( !(T(1) != o2), "" );
static_assert ( (T(1) != o3), "" );
static_assert ( !(T(2) != o3), "" );
static_assert ( !(val != o3), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.hash/hash.pass.cpp b/test/std/experimental/optional/optional.hash/hash.pass.cpp
index 9e5fb55c833f..21126740bf86 100644
--- a/test/std/experimental/optional/optional.hash/hash.pass.cpp
+++ b/test/std/experimental/optional/optional.hash/hash.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> struct hash<optional<T>>;
@@ -19,7 +20,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
{
@@ -43,5 +43,4 @@ int main()
opt = std::unique_ptr<int>(new int(3));
assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp b/test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp
index 360b9d91671e..b63977bb69ff 100644
--- a/test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp
+++ b/test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// struct in_place_t{};
@@ -15,8 +16,6 @@
#include <experimental/optional>
#include <type_traits>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
@@ -28,15 +27,10 @@ test(const in_place_t&)
return 3;
}
-#endif
-
int main()
{
-#if _LIBCPP_STD_VER > 11
-
static_assert((std::is_class<in_place_t>::value), "");
static_assert((std::is_empty<in_place_t>::value), "");
-
+
static_assert(test(in_place) == 3, "");
-#endif
}
diff --git a/test/std/experimental/optional/optional.nullops/equal.pass.cpp b/test/std/experimental/optional/optional.nullops/equal.pass.cpp
index 931db6144256..79a5a7e06fa4 100644
--- a/test/std/experimental/optional/optional.nullops/equal.pass.cpp
+++ b/test/std/experimental/optional/optional.nullops/equal.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept;
@@ -17,15 +17,14 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
-
+
{
typedef int T;
typedef optional<T> O;
-
+
constexpr O o1; // disengaged
constexpr O o2{1}; // engaged
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt == o1), "");
static_assert (noexcept(o1 == nullopt), "");
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.nullops/greater.pass.cpp b/test/std/experimental/optional/optional.nullops/greater.pass.cpp
index b72a4d3f1a6a..15b22005b830 100644
--- a/test/std/experimental/optional/optional.nullops/greater.pass.cpp
+++ b/test/std/experimental/optional/optional.nullops/greater.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept;
@@ -17,7 +17,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
@@ -25,7 +24,7 @@ int main()
{
typedef int T;
typedef optional<T> O;
-
+
constexpr O o1; // disengaged
constexpr O o2{1}; // engaged
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt > o1), "");
static_assert (noexcept(o1 > nullopt), "");
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp b/test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp
index 86c8743b5558..313770ff408e 100644
--- a/test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator>=(const optional<T>& x, nullopt_t) noexcept;
@@ -17,7 +17,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
@@ -25,7 +24,7 @@ int main()
{
typedef int T;
typedef optional<T> O;
-
+
constexpr O o1; // disengaged
constexpr O o2{1}; // engaged
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt >= o1), "");
static_assert (noexcept(o1 >= nullopt), "");
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp b/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
index 3e8444bc73f0..cddb27e93a6a 100644
--- a/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
@@ -25,7 +25,7 @@ int main()
{
typedef int T;
typedef optional<T> O;
-
+
constexpr O o1; // disengaged
constexpr O o2{1}; // engaged
diff --git a/test/std/experimental/optional/optional.nullops/less_than.pass.cpp b/test/std/experimental/optional/optional.nullops/less_than.pass.cpp
index 149c809b0403..fdb400700d83 100644
--- a/test/std/experimental/optional/optional.nullops/less_than.pass.cpp
+++ b/test/std/experimental/optional/optional.nullops/less_than.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator<(const optional<T>& x, nullopt_t) noexcept;
@@ -17,7 +17,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
@@ -25,7 +24,7 @@ int main()
{
typedef int T;
typedef optional<T> O;
-
+
constexpr O o1; // disengaged
constexpr O o2{1}; // engaged
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt < o1), "");
static_assert (noexcept(o1 < nullopt), "");
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.nullops/not_equal.pass.cpp b/test/std/experimental/optional/optional.nullops/not_equal.pass.cpp
index 6f28edf6d266..70ae0f1d885c 100644
--- a/test/std/experimental/optional/optional.nullops/not_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.nullops/not_equal.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator!=(const optional<T>& x, nullopt_t) noexcept;
@@ -17,15 +17,14 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
-
+
{
typedef int T;
typedef optional<T> O;
-
+
constexpr O o1; // disengaged
constexpr O o2{1}; // engaged
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt != o1), "");
static_assert (noexcept(o1 != nullopt), "");
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp b/test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp
index de1e83b653ce..8ad49c7485d0 100644
--- a/test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp
+++ b/test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// struct nullopt_t{see below};
@@ -15,8 +16,6 @@
#include <experimental/optional>
#include <type_traits>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
@@ -28,16 +27,12 @@ test(const nullopt_t&)
return 3;
}
-#endif
-
int main()
{
-#if _LIBCPP_STD_VER > 11
static_assert((std::is_class<nullopt_t>::value), "");
static_assert((std::is_empty<nullopt_t>::value), "");
static_assert((std::is_literal_type<nullopt_t>::value), "");
static_assert((!std::is_default_constructible<nullopt_t>::value), "");
-
+
static_assert(test(nullopt) == 3, "");
-#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
index e256a098f1ac..3d0d2e03158b 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class U> optional<T>& operator=(U&& v);
@@ -16,19 +17,14 @@
#include <cassert>
#include <memory>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
{
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
static_assert(std::is_assignable<optional<int>, int>::value, "");
static_assert(std::is_assignable<optional<int>, int&>::value, "");
static_assert(std::is_assignable<optional<int>&, int>::value, "");
@@ -68,5 +64,4 @@ int main()
assert(static_cast<bool>(opt) == true);
assert(**opt == 3);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
index 999d03d3a885..89ea345029c2 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -16,8 +17,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -34,11 +33,8 @@ struct X
bool X::throw_now = false;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
optional<int> opt;
constexpr optional<int> opt2;
@@ -87,5 +83,4 @@ int main()
assert(static_cast<bool>(opt) == false);
}
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
index ec98ef449153..94f2bb21a475 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -17,8 +18,6 @@
#include <cassert>
#include <memory>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
class X
@@ -55,11 +54,8 @@ public:
bool Z::dtor_called = false;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
optional<int> opt;
opt.emplace();
@@ -145,5 +141,4 @@ int main()
assert(Z::dtor_called == true);
}
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
index aada0f4ec535..fec37408e43b 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -18,8 +19,6 @@
#include <cassert>
#include <vector>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
class X
@@ -60,7 +59,7 @@ public:
static bool dtor_called;
constexpr Z() : i_(0) {}
constexpr Z(int i) : i_(i) {}
- constexpr Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
+ Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
{throw 6;}
~Z() {dtor_called = true;}
@@ -70,11 +69,8 @@ public:
bool Z::dtor_called = false;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
X x;
{
@@ -113,5 +109,4 @@ int main()
assert(Z::dtor_called == true);
}
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
index 3e084e5b7dc2..fa00f5602c7f 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -18,8 +19,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -42,11 +41,8 @@ struct Y {};
bool X::throw_now = false;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
static_assert(std::is_nothrow_move_assignable<optional<int>>::value, "");
optional<int> opt;
@@ -100,5 +96,4 @@ int main()
{
static_assert(std::is_nothrow_move_assignable<optional<Y>>::value, "");
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp
index 7f39744f0557..b1d851b32f4c 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// optional<T>& operator=(nullopt_t) noexcept;
@@ -15,8 +16,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
@@ -29,11 +28,8 @@ struct X
bool X::dtor_called = false;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
optional<int> opt;
static_assert(noexcept(opt = nullopt) == true, "");
@@ -63,5 +59,4 @@ int main()
assert(static_cast<bool>(opt) == false);
}
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
index 7d401de1d978..144af2e3a7dc 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -16,8 +17,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
template <class T>
@@ -76,11 +75,8 @@ public:
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef int T;
optional<T> rhs;
@@ -121,5 +117,4 @@ int main()
optional<T> rhs(Z(3));
test(rhs, true);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp
index 6a1763de22bd..d24a1ac69b86 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// constexpr optional() noexcept;
@@ -15,8 +16,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
template <class Opt>
@@ -55,13 +54,9 @@ struct X
X();
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
test_constexpr<optional<int>>();
test_constexpr<optional<int*>>();
test<optional<X>>();
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
index 014ee859e8a9..dc1666b10362 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
@@ -69,7 +69,7 @@ int main()
struct test_constexpr_ctor
: public optional<int>
{
- constexpr test_constexpr_ctor(in_place_t, int i)
+ constexpr test_constexpr_ctor(in_place_t, int i)
: optional<int>(in_place, i) {}
};
@@ -97,7 +97,7 @@ int main()
struct test_constexpr_ctor
: public optional<Y>
{
- constexpr test_constexpr_ctor(in_place_t)
+ constexpr test_constexpr_ctor(in_place_t)
: optional<Y>(in_place) {}
};
@@ -110,7 +110,7 @@ int main()
struct test_constexpr_ctor
: public optional<Y>
{
- constexpr test_constexpr_ctor(in_place_t, int i)
+ constexpr test_constexpr_ctor(in_place_t, int i)
: optional<Y>(in_place, i) {}
};
@@ -123,7 +123,7 @@ int main()
struct test_constexpr_ctor
: public optional<Y>
{
- constexpr test_constexpr_ctor(in_place_t, int i, int j)
+ constexpr test_constexpr_ctor(in_place_t, int i, int j)
: optional<Y>(in_place, i, j) {}
};
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
index 7a98e0bf31f3..9bd6b18989fc 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -19,8 +20,6 @@
#include <vector>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
@@ -60,19 +59,15 @@ class Z
public:
constexpr Z() : i_(0) {}
constexpr Z(int i) : i_(i) {}
- constexpr Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
+ Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
{throw 6;}
friend constexpr bool operator==(const Z& x, const Z& y)
{return x.i_ == y.i_ && x.j_ == y.j_;}
};
-
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
static_assert(!std::is_constructible<X, std::initializer_list<int>&>::value, "");
static_assert(!std::is_constructible<optional<X>, std::initializer_list<int>&>::value, "");
@@ -98,10 +93,12 @@ int main()
struct test_constexpr_ctor
: public optional<Y>
{
- constexpr test_constexpr_ctor(in_place_t, std::initializer_list<int> i)
+ constexpr test_constexpr_ctor(in_place_t, std::initializer_list<int> i)
: optional<Y>(in_place, i) {}
};
+ constexpr test_constexpr_ctor dopt(in_place, {42, 101, -1});
+ static_assert(*dopt == Y{42, 101, -1}, "");
}
{
static_assert(std::is_constructible<optional<Z>, std::initializer_list<int>&>::value, "");
@@ -114,14 +111,5 @@ int main()
{
assert(i == 6);
}
-
- struct test_constexpr_ctor
- : public optional<Z>
- {
- constexpr test_constexpr_ctor(in_place_t, std::initializer_list<int> i)
- : optional<Z>(in_place, i) {}
- };
-
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
index 40d55f918993..851157f960f9 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -16,8 +17,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
template <class T>
@@ -75,12 +74,8 @@ public:
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
};
-
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef int T;
optional<T> rhs;
@@ -121,5 +116,4 @@ int main()
optional<T> rhs(Z(3));
test(rhs, true);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp
index c307a2e1e258..40c96581ed84 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// constexpr optional(nullopt_t) noexcept;
@@ -15,8 +16,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
@@ -56,13 +55,9 @@ struct X
X();
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
test_constexpr<optional<int>>();
test_constexpr<optional<int*>>();
test<optional<X>>();
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp
index 2697799f0e5e..2bec19e6b4f4 100644
--- a/test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// ~optional();
@@ -15,8 +16,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
class X
@@ -29,11 +28,8 @@ public:
bool X::dtor_called = false;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef int T;
static_assert(std::is_trivially_destructible<T>::value, "");
@@ -55,5 +51,4 @@ int main()
}
assert(X::dtor_called == true);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp
index a3724375cf4d..a5bfae240073 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// constexpr explicit optional<T>::operator bool() const noexcept;
@@ -17,7 +18,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
{
@@ -28,5 +28,4 @@ int main()
constexpr optional<int> opt(0);
static_assert(opt, "");
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp
index 98e5dac9719e..faba8d256067 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// T& optional<T>::operator*();
@@ -19,8 +20,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -29,11 +28,8 @@ struct X
int test() {return 4;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
optional<X> opt(X{});
assert((*opt).test() == 4);
@@ -45,5 +41,4 @@ int main()
assert(false);
}
#endif // _LIBCPP_DEBUG
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
index c72a57852a32..f1bdc36424da 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// constexpr const T& optional<T>::operator*() const;
@@ -19,8 +20,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -33,11 +32,8 @@ struct Y
int test() const {return 2;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
constexpr optional<X> opt(X{});
static_assert((*opt).test() == 3, "");
@@ -53,5 +49,4 @@ int main()
assert(false);
}
#endif // _LIBCPP_DEBUG
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
index b17fcf8d3050..954ccd71ff53 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// constexpr T* optional<T>::operator->();
@@ -19,8 +20,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -28,11 +27,8 @@ struct X
constexpr int test() const {return 3;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
constexpr optional<X> opt(X{});
static_assert(opt->test() == 3, "");
@@ -44,5 +40,4 @@ int main()
assert(false);
}
#endif // _LIBCPP_DEBUG
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
index e813dd992a5b..cf900d7029e1 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// constexpr const T* optional<T>::operator->() const;
@@ -19,8 +20,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -39,11 +38,8 @@ struct Z
constexpr int test() const {return 1;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
constexpr optional<X> opt(X{});
static_assert(opt->test() == 3, "");
@@ -63,5 +59,4 @@ int main()
assert(false);
}
#endif // _LIBCPP_DEBUG
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
index 85f9be6998a0..b998f3067f4f 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -16,8 +17,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
using std::experimental::bad_optional_access;
@@ -29,11 +28,8 @@ struct X
int test() {return 4;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
optional<X> opt;
opt.emplace();
@@ -50,5 +46,4 @@ int main()
{
}
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp
index f0f8af6da45d..baad3b47f3ec 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// constexpr const T& optional<T>::value() const;
@@ -15,8 +16,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -25,16 +24,10 @@ struct X
int test() {return 4;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
constexpr optional<X> opt;
static_assert(opt.value().test() == 3, "");
}
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
index c99baab8b6e4..a38b1f930c72 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -16,8 +17,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
@@ -31,11 +30,8 @@ struct X
int test() {return 4;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
constexpr optional<X> opt(in_place);
static_assert(opt.value().test() == 3, "");
@@ -55,5 +51,4 @@ int main()
{
}
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp
index 6118c44bb5ba..6fca8c82cebd 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class U> T optional<T>::value_or(U&& v) &&;
@@ -15,8 +16,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
@@ -40,11 +39,8 @@ struct X
{return x.i_ == y.i_;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
optional<X> opt(in_place, 2);
Y y(3);
@@ -67,5 +63,4 @@ int main()
assert(std::move(opt).value_or(Y(3)) == 4);
assert(!opt);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp
index d51f18abbd28..4a008dce2386 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class U> constexpr T optional<T>::value_or(U&& v) const&;
@@ -15,8 +16,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct Y
@@ -37,11 +36,8 @@ struct X
{return x.i_ == y.i_;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
constexpr optional<X> opt(2);
constexpr Y y(3);
@@ -78,5 +74,4 @@ int main()
const optional<X> opt;
assert(opt.value_or(Y(3)) == 4);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
index d24a2d06b9d5..620dda19e3ff 100644
--- a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -18,8 +19,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
class X
@@ -63,12 +62,8 @@ public:
friend void swap(Z& x, Z& y) {throw 6;}
};
-
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
optional<int> opt1;
optional<int> opt2;
@@ -303,5 +298,4 @@ int main()
assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 2);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional_const_void.fail.cpp b/test/std/experimental/optional/optional.object/optional_const_void.fail.cpp
index 6999cf2451f1..02c0a3a63a5e 100644
--- a/test/std/experimental/optional/optional.object/optional_const_void.fail.cpp
+++ b/test/std/experimental/optional/optional.object/optional_const_void.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// T shall be an object type and shall satisfy the requirements of Destructible
@@ -15,11 +16,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
optional<const void> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp b/test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp
index 61470af01195..da8bd05f2c9b 100644
--- a/test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp
+++ b/test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// T shall be an object type and shall satisfy the requirements of Destructible
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -23,13 +22,7 @@ private:
~X() {}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
optional<X> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp b/test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp
index eaee02014c2f..7aa179afeaf6 100644
--- a/test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp
+++ b/test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// T shall be an object type and shall satisfy the requirements of Destructible
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -22,13 +21,7 @@ struct X
~X() noexcept(false) {}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
optional<X> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional_void.fail.cpp b/test/std/experimental/optional/optional.object/optional_void.fail.cpp
index f911e9a2d6d4..73f689c56720 100644
--- a/test/std/experimental/optional/optional.object/optional_void.fail.cpp
+++ b/test/std/experimental/optional/optional.object/optional_void.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// T shall be an object type and shall satisfy the requirements of Destructible
@@ -15,11 +16,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
optional<void> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/types.pass.cpp b/test/std/experimental/optional/optional.object/types.pass.cpp
index 8b9ad2e19570..af8da2df8fd5 100644
--- a/test/std/experimental/optional/optional.object/types.pass.cpp
+++ b/test/std/experimental/optional/optional.object/types.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T>
@@ -19,8 +20,6 @@
#include <experimental/optional>
#include <type_traits>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
template <class Opt, class T>
@@ -30,14 +29,10 @@ test()
static_assert(std::is_same<typename Opt::value_type, T>::value, "");
}
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
test<optional<int>, int>();
test<optional<const int>, const int>();
test<optional<double>, double>();
test<optional<const double>, const double>();
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.relops/equal.pass.cpp b/test/std/experimental/optional/optional.relops/equal.pass.cpp
index 03b9d3fda5cf..413e7c8b3780 100644
--- a/test/std/experimental/optional/optional.relops/equal.pass.cpp
+++ b/test/std/experimental/optional/optional.relops/equal.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y);
@@ -15,8 +16,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -28,16 +27,13 @@ struct X
constexpr bool operator == ( const X &lhs, const X &rhs )
{ return lhs.i_ == rhs.i_ ; }
-
-#endif
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef X T;
typedef optional<T> O;
-
+
constexpr O o1; // disengaged
constexpr O o2; // disengaged
constexpr O o3{1}; // engaged
@@ -75,5 +71,4 @@ int main()
static_assert ( o5 == o5 , "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.relops/greater_equal.pass.cpp b/test/std/experimental/optional/optional.relops/greater_equal.pass.cpp
index 98d6855f9313..c0739dda6b83 100644
--- a/test/std/experimental/optional/optional.relops/greater_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.relops/greater_equal.pass.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator>= (const optional<T>& x, const optional<T>& y);
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,20 +26,17 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; }
-#endif
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef optional<X> O;
-
+
constexpr O o1; // disengaged
constexpr O o2; // disengaged
constexpr O o3{1}; // engaged
constexpr O o4{2}; // engaged
constexpr O o5{1}; // engaged
-
+
static_assert ( (o1 >= o1), "" );
static_assert ( (o1 >= o2), "" );
static_assert ( !(o1 >= o3), "" );
@@ -71,5 +67,4 @@ int main()
static_assert ( !(o5 >= o4), "" );
static_assert ( (o5 >= o5), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.relops/greater_than.pass.cpp b/test/std/experimental/optional/optional.relops/greater_than.pass.cpp
index d51bd4f2ac46..df7dbb64717f 100644
--- a/test/std/experimental/optional/optional.relops/greater_than.pass.cpp
+++ b/test/std/experimental/optional/optional.relops/greater_than.pass.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator> (const optional<T>& x, const optional<T>& y);
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,20 +26,17 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; }
-#endif
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef optional<X> O;
-
+
constexpr O o1; // disengaged
constexpr O o2; // disengaged
constexpr O o3{1}; // engaged
constexpr O o4{2}; // engaged
constexpr O o5{1}; // engaged
-
+
static_assert ( !(o1 > o1), "" );
static_assert ( !(o1 > o2), "" );
static_assert ( !(o1 > o3), "" );
@@ -71,5 +67,4 @@ int main()
static_assert ( !(o5 > o4), "" );
static_assert ( !(o5 > o5), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.relops/less_equal.pass.cpp b/test/std/experimental/optional/optional.relops/less_equal.pass.cpp
index 326f3a896493..d4874d17b240 100644
--- a/test/std/experimental/optional/optional.relops/less_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.relops/less_equal.pass.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator<= (const optional<T>& x, const optional<T>& y);
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,20 +26,17 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; }
-#endif
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef optional<X> O;
-
+
constexpr O o1; // disengaged
constexpr O o2; // disengaged
constexpr O o3{1}; // engaged
constexpr O o4{2}; // engaged
constexpr O o5{1}; // engaged
-
+
static_assert ( (o1 <= o1), "" );
static_assert ( (o1 <= o2), "" );
static_assert ( (o1 <= o3), "" );
@@ -71,5 +67,4 @@ int main()
static_assert ( (o5 <= o4), "" );
static_assert ( (o5 <= o5), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.relops/less_than.pass.cpp b/test/std/experimental/optional/optional.relops/less_than.pass.cpp
index 37f7e1942982..4113408268e8 100644
--- a/test/std/experimental/optional/optional.relops/less_than.pass.cpp
+++ b/test/std/experimental/optional/optional.relops/less_than.pass.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator< (const optional<T>& x, const optional<T>& y);
#include <experimental/optional>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -27,20 +26,17 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; }
-#endif
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef optional<X> O;
-
+
constexpr O o1; // disengaged
constexpr O o2; // disengaged
constexpr O o3{1}; // engaged
constexpr O o4{2}; // engaged
constexpr O o5{1}; // engaged
-
+
static_assert ( !(o1 < o1), "" );
static_assert ( !(o1 < o2), "" );
static_assert ( (o1 < o3), "" );
@@ -71,5 +67,4 @@ int main()
static_assert ( (o5 < o4), "" );
static_assert ( !(o5 < o5), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.relops/not_equal.pass.cpp b/test/std/experimental/optional/optional.relops/not_equal.pass.cpp
index f386c7e361ec..19a196317d4f 100644
--- a/test/std/experimental/optional/optional.relops/not_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.relops/not_equal.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y);
@@ -15,8 +16,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
struct X
@@ -28,16 +27,13 @@ struct X
constexpr bool operator == ( const X &lhs, const X &rhs )
{ return lhs.i_ == rhs.i_ ; }
-
-#endif
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef X T;
typedef optional<T> O;
-
+
constexpr O o1; // disengaged
constexpr O o2; // disengaged
constexpr O o3{1}; // engaged
@@ -75,5 +71,4 @@ int main()
static_assert ( !(o5 != o5), "" );
}
-#endif
}
diff --git a/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp b/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp
index cc95e6110e8d..9abd87bd4051 100644
--- a/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp
+++ b/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// template <class T>
@@ -19,9 +20,10 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::make_optional;
@@ -38,7 +40,7 @@ int main()
std::string s("123");
optional<std::string> opt = make_optional(std::move(s));
assert(*opt == "123");
- assert(s.empty());
+ LIBCPP_ASSERT(s.empty());
}
{
std::unique_ptr<int> s(new int(3));
@@ -46,5 +48,4 @@ int main()
assert(**opt == 3);
assert(s == nullptr);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.specalg/swap.pass.cpp b/test/std/experimental/optional/optional.specalg/swap.pass.cpp
index 6c5f7b0e860c..d339c53c1f77 100644
--- a/test/std/experimental/optional/optional.specalg/swap.pass.cpp
+++ b/test/std/experimental/optional/optional.specalg/swap.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions
// <optional>
@@ -17,8 +18,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
class X
@@ -62,12 +61,8 @@ public:
friend void swap(Z& x, Z& y) {throw 6;}
};
-
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
optional<int> opt1;
optional<int> opt2;
@@ -302,5 +297,4 @@ int main()
assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 2);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp b/test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp
index 60836ae2396e..bdf01eba406f 100644
--- a/test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp
+++ b/test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// A program that necessitates the instantiation of template optional for
@@ -16,13 +17,9 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
optional<const in_place_t> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp b/test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp
index 9a4ba1a027a1..61393c105e95 100644
--- a/test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp
+++ b/test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// A program that necessitates the instantiation of template optional for a
@@ -16,11 +17,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
optional<const int&> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp b/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp
index f6220bda69c4..89c207306aba 100644
--- a/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp
+++ b/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp
@@ -7,22 +7,19 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// A program that necessitates the instantiation of template optional for
-// (possibly cv-qualified) null_opt_t is ill-formed.
+// (possibly cv-qualified) nullopt_t is ill-formed.
#include <experimental/optional>
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
optional<const nullopt_t> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp b/test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp
index 12f291fcd228..47c2be7da0d0 100644
--- a/test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp
+++ b/test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// A program that necessitates the instantiation of template optional for
@@ -16,13 +17,9 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
optional<in_place_t> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp b/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp
index 7e6697ff6e50..8cf11b553e74 100644
--- a/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp
+++ b/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// #include <initializer_list>
@@ -15,9 +16,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
std::initializer_list<int> list;
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp b/test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp
index 850df342aef0..de2f18991b24 100644
--- a/test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp
+++ b/test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// A program that necessitates the instantiation of template optional for a
@@ -16,11 +17,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
optional<int&> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp b/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp
index 20955ace834a..3d276d642022 100644
--- a/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp
+++ b/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp
@@ -7,22 +7,19 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// A program that necessitates the instantiation of template optional for
-// (possibly cv-qualified) null_opt_t is ill-formed.
+// (possibly cv-qualified) nullopt_t is ill-formed.
#include <experimental/optional>
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
optional<nullopt_t> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp b/test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp
index d773e993df22..fd6da18e8c16 100644
--- a/test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp
+++ b/test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <optional>
// A program that necessitates the instantiation of template optional for a
@@ -16,11 +17,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
optional<int&&> opt;
-#else
-#error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/string.view/string.view.access/at.pass.cpp b/test/std/experimental/string.view/string.view.access/at.pass.cpp
index 46804d4df3af..7ceaf5ab3d9f 100644
--- a/test/std/experimental/string.view/string.view.access/at.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/at.pass.cpp
@@ -10,7 +10,7 @@
// NOTE: Older versions of clang have a bug where they fail to evalute
// string_view::at as a constant expression.
// XFAIL: clang-3.4, clang-3.3
-// XFAIL: libcpp-no-exceptions
+
// <string_view>
@@ -20,6 +20,8 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
+
template <typename CharT>
void test ( const CharT *s, size_t len ) {
std::experimental::basic_string_view<CharT> sv ( s, len );
@@ -27,12 +29,14 @@ void test ( const CharT *s, size_t len ) {
for ( size_t i = 0; i < len; ++i ) {
assert ( sv.at(i) == s[i] );
assert ( &sv.at(i) == s + i );
- }
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
try { sv.at(len); } catch ( const std::out_of_range & ) { return ; }
assert ( false );
- }
-
+#endif
+}
+
int main () {
test ( "ABCDE", 5 );
test ( "a", 1 );
@@ -40,7 +44,7 @@ int main () {
test ( L"ABCDE", 5 );
test ( L"a", 1 );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
test ( u"a", 1 );
@@ -48,7 +52,7 @@ int main () {
test ( U"a", 1 );
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
constexpr std::experimental::basic_string_view<char> sv ( "ABC", 2 );
static_assert ( sv.length() == 2, "" );
diff --git a/test/std/experimental/string.view/string.view.access/back.pass.cpp b/test/std/experimental/string.view/string.view.access/back.pass.cpp
index 093a858a4805..09f7950341a8 100644
--- a/test/std/experimental/string.view/string.view.access/back.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/back.pass.cpp
@@ -15,6 +15,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template <typename CharT>
bool test ( const CharT *s, size_t len ) {
std::experimental::basic_string_view<CharT> sv ( s, len );
@@ -22,7 +24,7 @@ bool test ( const CharT *s, size_t len ) {
assert ( sv.back() == s[len-1] );
return &sv.back() == s + len - 1;
}
-
+
int main () {
assert ( test ( "ABCDE", 5 ));
assert ( test ( "a", 1 ));
@@ -30,7 +32,7 @@ int main () {
assert ( test ( L"ABCDE", 5 ));
assert ( test ( L"a", 1 ));
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert ( test ( u"ABCDE", 5 ));
assert ( test ( u"a", 1 ));
@@ -38,7 +40,7 @@ int main () {
assert ( test ( U"a", 1 ));
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
constexpr std::experimental::basic_string_view<char> sv ( "ABC", 2 );
static_assert ( sv.length() == 2, "" );
diff --git a/test/std/experimental/string.view/string.view.access/data.pass.cpp b/test/std/experimental/string.view/string.view.access/data.pass.cpp
index 562a765f50ce..53e95ddaea31 100644
--- a/test/std/experimental/string.view/string.view.access/data.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/data.pass.cpp
@@ -15,13 +15,15 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template <typename CharT>
void test ( const CharT *s, size_t len ) {
std::experimental::basic_string_view<CharT> sv ( s, len );
assert ( sv.length() == len );
assert ( sv.data() == s );
}
-
+
int main () {
test ( "ABCDE", 5 );
test ( "a", 1 );
@@ -29,7 +31,7 @@ int main () {
test ( L"ABCDE", 5 );
test ( L"a", 1 );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
test ( u"a", 1 );
diff --git a/test/std/experimental/string.view/string.view.access/front.pass.cpp b/test/std/experimental/string.view/string.view.access/front.pass.cpp
index e9df44b19b1a..acb00a46a2e5 100644
--- a/test/std/experimental/string.view/string.view.access/front.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/front.pass.cpp
@@ -15,6 +15,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template <typename CharT>
bool test ( const CharT *s, size_t len ) {
std::experimental::basic_string_view<CharT> sv ( s, len );
@@ -22,7 +24,7 @@ bool test ( const CharT *s, size_t len ) {
assert ( sv.front() == s[0] );
return &sv.front() == s;
}
-
+
int main () {
assert ( test ( "ABCDE", 5 ));
assert ( test ( "a", 1 ));
@@ -30,7 +32,7 @@ int main () {
assert ( test ( L"ABCDE", 5 ));
assert ( test ( L"a", 1 ));
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert ( test ( u"ABCDE", 5 ));
assert ( test ( u"a", 1 ));
@@ -38,7 +40,7 @@ int main () {
assert ( test ( U"a", 1 ));
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
constexpr std::experimental::basic_string_view<char> sv ( "ABC", 2 );
static_assert ( sv.length() == 2, "" );
diff --git a/test/std/experimental/string.view/string.view.access/index.pass.cpp b/test/std/experimental/string.view/string.view.access/index.pass.cpp
index 4491207cbb85..2c1bd1dc91cb 100644
--- a/test/std/experimental/string.view/string.view.access/index.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/index.pass.cpp
@@ -15,6 +15,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template <typename CharT>
void test ( const CharT *s, size_t len ) {
std::experimental::basic_string_view<CharT> sv ( s, len );
@@ -24,7 +26,7 @@ void test ( const CharT *s, size_t len ) {
assert ( &sv[i] == s + i );
}
}
-
+
int main () {
test ( "ABCDE", 5 );
test ( "a", 1 );
@@ -32,7 +34,7 @@ int main () {
test ( L"ABCDE", 5 );
test ( L"a", 1 );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
test ( u"a", 1 );
diff --git a/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp b/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp
index eb802165930d..9f5d86f2f82b 100644
--- a/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp
+++ b/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp
@@ -19,6 +19,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template<typename SV>
void test1 () {
#if _LIBCPP_STD_VER > 11
@@ -30,7 +32,7 @@ void test1 () {
static_assert ( sv1.max_size() > sv1.size(), "");
}
#endif
-
+
{
SV sv1;
assert ( sv1.size() == 0 );
@@ -73,7 +75,7 @@ int main () {
test2 ( L"a", 1 );
test2 ( L"", 0 );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test2 ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 );
test2 ( u"ABCDE", 5 );
test2 ( u"a", 1 );
diff --git a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
index 148dc18d7ec8..0df37a6ffd9f 100644
--- a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
@@ -58,7 +58,7 @@ int main()
static_assert ( "" == sv1, "" );
static_assert (!(sv1 == "abcde"), "" );
static_assert (!("abcde" == sv1), "" );
-
+
static_assert ( sv2 == "abcde", "" );
static_assert ( "abcde" == sv2, "" );
static_assert (!(sv2 == "abcde0"), "" );
diff --git a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string.pass.cpp
index 23a2aef242d7..1fd72d7964b6 100644
--- a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string.pass.cpp
@@ -17,8 +17,6 @@
#include <experimental/string_view>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
template <class S>
void
test(const std::string &lhs, S rhs, bool x)
@@ -49,6 +47,4 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true);
}
}
-#else
-int main () {}
-#endif
+
diff --git a/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
index f02459b01c49..f5bcb7e97b73 100644
--- a/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
@@ -59,7 +59,7 @@ int main()
static_assert ( "" >= sv1, "" );
static_assert (!(sv1 >= "abcde"), "" );
static_assert ( "abcde" >= sv1, "" );
-
+
static_assert ( sv2 >= "", "" );
static_assert (!("" >= sv2), "" );
static_assert ( sv2 >= "abcde", "" );
diff --git a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
index 48703cac612f..63002a5c415c 100644
--- a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
@@ -59,7 +59,7 @@ int main()
static_assert (!("" > sv1), "" );
static_assert (!(sv1 > "abcde"), "" );
static_assert ( "abcde" > sv1, "" );
-
+
static_assert ( sv2 > "", "" );
static_assert (!("" > sv2), "" );
static_assert (!(sv2 > "abcde"), "" );
diff --git a/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
index 539f5fa5402e..c542efea99a7 100644
--- a/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
@@ -59,7 +59,7 @@ int main()
static_assert ( "" <= sv1, "" );
static_assert ( sv1 <= "abcde", "" );
static_assert (!("abcde" <= sv1), "" );
-
+
static_assert (!(sv2 <= ""), "" );
static_assert ( "" <= sv2, "" );
static_assert ( sv2 <= "abcde", "" );
diff --git a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
index a1013e4d8152..2c0461481e78 100644
--- a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
@@ -59,7 +59,7 @@ int main()
static_assert (!("" < sv1), "" );
static_assert ( sv1 < "abcde", "" );
static_assert (!("abcde" < sv1), "" );
-
+
static_assert (!(sv2 < ""), "" );
static_assert ( "" < sv2, "" );
static_assert (!(sv2 < "abcde"), "" );
diff --git a/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
index 299be934a811..1deee9ac7fc6 100644
--- a/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
@@ -59,7 +59,7 @@ int main()
static_assert (!("" != sv1), "" );
static_assert ( sv1 != "abcde", "" );
static_assert ( "abcde" != sv1, "" );
-
+
static_assert (!(sv2 != "abcde"), "" );
static_assert (!("abcde" != sv2), "" );
static_assert ( sv2 != "abcde0", "" );
diff --git a/test/std/experimental/string.view/string.view.cons/default.pass.cpp b/test/std/experimental/string.view/string.view.cons/default.pass.cpp
index e1d69f4a3dfe..e817bfffb89d 100644
--- a/test/std/experimental/string.view/string.view.cons/default.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/default.pass.cpp
@@ -24,7 +24,7 @@ void test () {
static_assert ( sv1.empty(), "");
}
#endif
-
+
{
T sv1;
assert ( sv1.size() == 0 );
diff --git a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp
index 82d0d7954149..9de3a3039523 100644
--- a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp
@@ -40,12 +40,12 @@ int main () {
test ( "QBCDE" );
test ( "A" );
test ( "" );
-
+
test ( L"QBCDE" );
test ( L"A" );
test ( L"" );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"QBCDE" );
test ( u"A" );
test ( u"" );
diff --git a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp
index 1038d0484f8c..663d25e954f9 100644
--- a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp
@@ -18,6 +18,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
template<typename CharT>
void test ( const CharT *s, size_t sz ) {
{
@@ -53,7 +55,7 @@ int main () {
}
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"QBCDE", 5 );
test ( u"QBCDE", 2 );
test ( u"", 0 );
diff --git a/test/std/experimental/string.view/string.view.cons/from_string.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_string.pass.cpp
index 670c033a653f..4ecd2cdff9ba 100644
--- a/test/std/experimental/string.view/string.view.cons/from_string.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/from_string.pass.cpp
@@ -18,6 +18,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
struct dummy_char_traits : public std::char_traits<char> {};
template<typename CharT, typename Traits>
@@ -32,12 +34,12 @@ int main () {
test ( std::string("QBCDE") );
test ( std::string("") );
test ( std::string() );
-
+
test ( std::wstring(L"QBCDE") );
test ( std::wstring(L"") );
test ( std::wstring() );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( std::u16string{u"QBCDE"} );
test ( std::u16string{u""} );
test ( std::u16string{} );
@@ -46,7 +48,7 @@ int main () {
test ( std::u32string{U""} );
test ( std::u32string{} );
#endif
-
+
test ( std::basic_string<char, dummy_char_traits>("QBCDE") );
test ( std::basic_string<char, dummy_char_traits>("") );
test ( std::basic_string<char, dummy_char_traits>() );
diff --git a/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp b/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp
index 6ef4b9669bf4..b2ffa61c29d9 100644
--- a/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp
+++ b/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp
@@ -22,7 +22,7 @@ struct dummy_char_traits : public std::char_traits<char> {};
int main () {
using string_view = std::experimental::basic_string_view<char>;
using string = std:: basic_string <char, dummy_char_traits>;
-
+
{
string s{"QBCDE"};
string_view sv1 ( s );
diff --git a/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp b/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp
index 6c77a3f99a2b..a14e131c85aa 100644
--- a/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp
+++ b/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp
@@ -22,7 +22,7 @@ struct dummy_char_traits : public std::char_traits<char> {};
int main () {
using string_view = std::experimental::basic_string_view<char, dummy_char_traits>;
using string = std:: basic_string <char>;
-
+
{
string s{"QBCDE"};
string_view sv1 ( s );
diff --git a/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp b/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp
index 07f3b36e1d2b..8040b81d4efe 100644
--- a/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp
@@ -14,6 +14,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template <class S>
void
test(S s)
@@ -30,7 +32,7 @@ test(S s)
assert(&*cb1 == &s[0]);
assert( *cb2 == s[0]);
assert(&*cb2 == &s[0]);
-
+
}
assert( b == cb1);
assert( b == cb2);
@@ -51,7 +53,7 @@ int main()
test(wstring_view ());
test(string_view ( "123"));
test(wstring_view (L"123"));
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test(u16string_view{u"123"});
test(u32string_view{U"123"});
#endif
@@ -62,7 +64,7 @@ int main()
constexpr u16string_view u16sv {u"123", 3 };
constexpr u32string_view u32sv {U"123", 3 };
constexpr wstring_view wsv {L"123", 3 };
-
+
static_assert ( *sv.begin() == sv[0], "" );
static_assert ( *u16sv.begin() == u16sv[0], "" );
static_assert ( *u32sv.begin() == u32sv[0], "" );
diff --git a/test/std/experimental/string.view/string.view.iterators/end.pass.cpp b/test/std/experimental/string.view/string.view.iterators/end.pass.cpp
index 2ed52b8de947..3a1091e9983c 100644
--- a/test/std/experimental/string.view/string.view.iterators/end.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/end.pass.cpp
@@ -14,6 +14,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template <class S>
void
test(S s)
@@ -35,7 +37,7 @@ test(S s)
assert(ce1 != cs.begin());
assert(ce2 != s.begin());
}
-
+
assert( e - s.begin() == s.size());
assert(ce1 - cs.begin() == cs.size());
assert(ce2 - s.cbegin() == s.size());
@@ -59,7 +61,7 @@ int main()
test(wstring_view ());
test(string_view ( "123"));
test(wstring_view (L"123"));
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test(u16string_view{u"123"});
test(u32string_view{U"123"});
#endif
@@ -70,7 +72,7 @@ int main()
constexpr u16string_view u16sv {u"123", 3 };
constexpr u32string_view u32sv {U"123", 3 };
constexpr wstring_view wsv {L"123", 3 };
-
+
static_assert ( sv.begin() != sv.end(), "" );
static_assert ( u16sv.begin() != u16sv.end(), "" );
static_assert ( u32sv.begin() != u32sv.end(), "" );
diff --git a/test/std/experimental/string.view/string.view.iterators/rbegin.pass.cpp b/test/std/experimental/string.view/string.view.iterators/rbegin.pass.cpp
index 7d1c7003eaf4..068557e39863 100644
--- a/test/std/experimental/string.view/string.view.iterators/rbegin.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/rbegin.pass.cpp
@@ -14,6 +14,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template <class S>
void
test(S s)
@@ -31,7 +33,7 @@ test(S s)
assert(&*cb1 == &s[last]);
assert( *cb2 == s[last]);
assert(&*cb2 == &s[last]);
-
+
}
assert( b == cb1);
assert( b == cb2);
@@ -52,7 +54,7 @@ int main()
test(wstring_view ());
test(string_view ( "123"));
test(wstring_view (L"123"));
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test(u16string_view{u"123"});
test(u32string_view{U"123"});
#endif
diff --git a/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp b/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp
index 57002f30518f..55e28a266948 100644
--- a/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp
@@ -14,6 +14,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template <class S>
void
test(S s)
@@ -35,7 +37,7 @@ test(S s)
assert(ce1 != cs.rbegin());
assert(ce2 != s.rbegin());
}
-
+
assert( e - s.rbegin() == s.size());
assert(ce1 - cs.rbegin() == cs.size());
assert(ce2 - s.crbegin() == s.size());
@@ -52,14 +54,14 @@ int main()
typedef std::experimental::u16string_view u16string_view;
typedef std::experimental::u32string_view u32string_view;
typedef std::experimental::wstring_view wstring_view;
-
+
test(string_view ());
test(u16string_view());
test(u32string_view());
test(wstring_view ());
test(string_view ( "123"));
test(wstring_view (L"123"));
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test(u16string_view{u"123"});
test(u32string_view{U"123"});
#endif
diff --git a/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp
index 6a9982e0d3a5..9a4891c8f259 100644
--- a/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp
@@ -15,6 +15,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template<typename CharT>
void test ( const CharT *s, size_t len ) {
typedef std::experimental::basic_string_view<CharT> SV;
@@ -48,7 +50,7 @@ int main () {
test ( L"a", 1 );
test ( L"", 0 );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
test ( u"a", 1 );
test ( u"", 0 );
diff --git a/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
index 0a2dd6d9329c..4a31486afaa0 100644
--- a/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
@@ -16,6 +16,8 @@
#include <cassert>
#include <iostream>
+#include "test_macros.h"
+
template<typename CharT>
void test ( const CharT *s, size_t len ) {
typedef std::experimental::basic_string_view<CharT> SV;
@@ -30,10 +32,10 @@ void test ( const CharT *s, size_t len ) {
assert ( sv1.data() == (s + 1));
sv1.remove_prefix ( len - 1 );
}
-
+
assert ( sv1.size() == 0 );
sv1.remove_prefix ( 0 );
- assert ( sv1.size() == 0 );
+ assert ( sv1.size() == 0 );
}
}
@@ -55,7 +57,7 @@ int main () {
test ( L"a", 1 );
test ( L"", 0 );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
test ( u"a", 1 );
test ( u"", 0 );
diff --git a/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
index 9dd59882cce6..9ddc6de84bf3 100644
--- a/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
@@ -15,6 +15,8 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template<typename CharT>
void test ( const CharT *s, size_t len ) {
typedef std::experimental::basic_string_view<CharT> SV;
@@ -29,10 +31,10 @@ void test ( const CharT *s, size_t len ) {
assert ( sv1.data() == s);
sv1.remove_suffix ( len - 1 );
}
-
+
assert ( sv1.size() == 0 );
sv1.remove_suffix ( 0 );
- assert ( sv1.size() == 0 );
+ assert ( sv1.size() == 0 );
}
}
@@ -55,7 +57,7 @@ int main () {
test ( L"a", 1 );
test ( L"", 0 );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
test ( u"a", 1 );
test ( u"", 0 );
diff --git a/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp
index cacb8ed40b88..d747def8549e 100644
--- a/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp
@@ -15,13 +15,15 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template<typename CharT>
void test ( const CharT *s, size_t len ) {
typedef std::experimental::basic_string_view<CharT> SV;
{
SV sv1(s);
SV sv2;
-
+
assert ( sv1.size() == len );
assert ( sv1.data() == s );
assert ( sv2.size() == 0 );
@@ -54,7 +56,7 @@ int main () {
test ( L"a", 1 );
test ( L"", 0 );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
test ( u"a", 1 );
test ( u"", 0 );
diff --git a/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp b/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp
index c86e9619f193..6ba03212d42b 100644
--- a/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp
+++ b/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp
@@ -103,7 +103,7 @@ void round_trip ( const wchar_t *p ) {
assert ( s == sv );
assert ( skippingws == is_skipws ( &ss ));
}
-
+
void round_trip_ws ( const wchar_t *p ) {
std::wstringstream ss;
@@ -165,31 +165,31 @@ int main()
round_trip_ws ( "" );
round_trip_d ( "", 'q' );
round_trip_e ( "", 'q' );
-
+
round_trip ( L"" );
round_trip_ws ( L"" );
round_trip_d ( L"", 'q' );
round_trip_e ( L"", 'q' );
-
+
round_trip ( "Hi" );
round_trip_ws ( "Hi" );
round_trip_d ( "Hi", '!' );
round_trip_e ( "Hi", '!' );
assert ( quote ( "Hi", '!' ) == "!Hi!" );
assert ( quote ( "Hi!", '!' ) == R"(!Hi\!!)" );
-
+
round_trip ( L"Hi" );
round_trip_ws ( L"Hi" );
round_trip_d ( L"Hi", '!' );
round_trip_e ( L"Hi", '!' );
assert ( quote ( L"Hi", '!' ) == L"!Hi!" );
assert ( quote ( L"Hi!", '!' ) == LR"(!Hi\!!)" );
-
+
round_trip ( "Hi Mom" );
round_trip_ws ( "Hi Mom" );
round_trip ( L"Hi Mom" );
round_trip_ws ( L"Hi Mom" );
-
+
assert ( quote ( "" ) == "\"\"" );
assert ( quote ( L"" ) == L"\"\"" );
assert ( quote ( "a" ) == "\"a\"" );
@@ -198,7 +198,7 @@ int main()
// missing end quote - must not hang
assert ( unquote ( "\"abc" ) == "abc" );
assert ( unquote ( L"\"abc" ) == L"abc" );
-
+
assert ( unquote ( "abc" ) == "abc" ); // no delimiter
assert ( unquote ( L"abc" ) == L"abc" ); // no delimiter
assert ( unquote ( "abc def" ) == "abc" ); // no delimiter
diff --git a/test/std/experimental/string.view/string.view.ops/basic_string.pass.cpp b/test/std/experimental/string.view/string.view.ops/basic_string.pass.cpp
index 29f5064d81dc..a29bb15f5ac9 100644
--- a/test/std/experimental/string.view/string.view.ops/basic_string.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/basic_string.pass.cpp
@@ -16,11 +16,13 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template<typename CharT>
void test ( const CharT *s ) {
typedef std::experimental::basic_string_view<CharT> string_view_t;
typedef std::basic_string<CharT> string_t;
-
+
{
string_view_t sv1 ( s );
string_t str = (string_t) sv1;
@@ -49,7 +51,7 @@ int main () {
test ( L"a" );
test ( L"" );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
test ( u"ABCDE" );
test ( u"a" );
diff --git a/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp
index 6ccec9b3729a..583395451fd4 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp
@@ -72,7 +72,7 @@ int main()
test(L"abcdefghijklmnopqrst", L"abcdefghijklmnopqrst", 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
test(U"", U"", 0);
test(U"", U"abcde", -5);
diff --git a/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp
index 7ccbd528c7fc..cfe35fcb4719 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
@@ -15,18 +14,27 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
template<typename CharT>
-void test1 ( std::experimental::basic_string_view<CharT> sv1,
+void test1 ( std::experimental::basic_string_view<CharT> sv1,
size_t pos1, size_t n1, const CharT *s, int expected ) {
- try {
+ if (pos1 > sv1.size()) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ sv1.compare(pos1, n1, s);
+ assert(false);
+ } catch (const std::out_of_range&) {
+ } catch (...) {
+ assert(false);
+ }
+#endif
+ } else {
assert(sign(sv1.compare(pos1, n1, s)) == sign(expected));
- assert(pos1 <= sv1.size());
}
- catch (const std::out_of_range&) { assert(pos1 > sv1.size()); }
}
template<typename CharT>
@@ -391,7 +399,7 @@ int main()
test(L"abcdefghijklmnopqrst", 0, -1, L"abcdefghijklmnopqrst", 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
test(U"", 0, 0, U"", 0);
test(U"", 0, 0, U"abcde", -5);
@@ -410,7 +418,7 @@ int main()
test(U"abcdefghijklmnopqrst", 0, 12, U"abcdefghij", 10);
test(U"abcdefghijklmnopqrst", 0, -1, U"abcdefghijklmnopqrst", 0);
}
-
+
{
test(u"", 0, 0, u"", 0);
test(u"", 0, 0, u"abcde", -5);
@@ -431,7 +439,7 @@ int main()
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp
index 244de9eb5104..2684d903405e 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-
-// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr int compare(size_type pos1, size_type n1, basic_string_view str) const;
@@ -16,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
@@ -24,19 +23,25 @@ template<typename CharT>
void test1 ( std::experimental::basic_string_view<CharT> sv1, size_t pos1, size_t n1,
std::experimental::basic_string_view<CharT> sv2, int expected ) {
- try
- {
+ if (pos1 > sv1.size()) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ sv1.compare(pos1, n1, sv2);
+ assert(false);
+ } catch (const std::out_of_range&) {
+ } catch (...) {
+ assert(false);
+ }
+#endif
+ } else {
assert ( sign( sv1.compare(pos1, n1, sv2)) == sign(expected));
- assert(pos1 <= sv1.size());
}
- catch (const std::out_of_range&) { assert(pos1 > sv1.size()); }
}
template<typename CharT>
void test ( const CharT *s1, size_t pos1, size_t n1, const CharT *s2, int expected ) {
typedef std::experimental::basic_string_view<CharT> string_view_t;
-
string_view_t sv1 ( s1 );
string_view_t sv2 ( s2 );
test1(sv1, pos1, n1, sv2, expected);
@@ -355,7 +360,7 @@ int main () {
test0();
test1();
test2();
-
+
{
test("abcde", 5, 1, "", 0);
test("abcde", 2, 4, "", 3);
@@ -370,7 +375,7 @@ int main () {
test(L"ABCde", 2, 4, L"abcde", -1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
test(u"abcde", 5, 1, u"", 0);
test(u"abcde", 2, 4, u"", 3);
@@ -386,7 +391,7 @@ int main () {
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1 { "abcde", 5 };
diff --git a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
index 1c3bc089a656..69de6335fb5c 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-
-// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr int compare(size_type pos1, size_type n1,
@@ -17,6 +15,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
@@ -25,22 +24,29 @@ template<typename CharT>
void test1 ( std::experimental::basic_string_view<CharT> sv1, size_t pos1, size_t n1,
const CharT *s2, size_t n2,
int expected ) {
-
- try
- {
- assert ( sign( sv1.compare(pos1, n1, s2, n2)) == sign(expected));
- assert(pos1 <= sv1.size());
+ if (pos1 > sv1.size()) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ sv1.compare(pos1, n1, s2, n2);
+ assert(false);
+ } catch (const std::out_of_range&) {
+ return;
+ } catch (...) {
+ assert(false);
+ }
+#endif
+ } else {
+ assert(sign(sv1.compare(pos1, n1, s2, n2)) == sign(expected));
}
- catch (const std::out_of_range&) { assert(pos1 > sv1.size()); }
+
}
template<typename CharT>
-void test ( const CharT *s1, size_t pos1, size_t n1,
- const CharT *s2, size_t n2,
+void test ( const CharT *s1, size_t pos1, size_t n1,
+ const CharT *s2, size_t n2,
int expected ) {
typedef std::experimental::basic_string_view<CharT> string_view_t;
-
string_view_t sv1 ( s1 );
test1 (sv1, pos1, n1, s2, n2, expected);
}
@@ -1302,7 +1308,7 @@ int main () {
test9();
test10();
test11();
-
+
{
test("", 0, 0, "abcde", 0, 0);
test("", 0, 0, "abcde", 1, -1);
@@ -1319,7 +1325,7 @@ int main () {
test(L"abcdefghijklmnopqrst", 10, 0, L"abcdefghij", 10, -10);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
test(U"", 0, 0, U"abcde", 0, 0);
test(U"", 0, 0, U"abcde", 1, -1);
@@ -1337,7 +1343,7 @@ int main () {
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
index c7a6f1e1eb66..5d5ccc5b5d59 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-
-// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr int compare(size_type pos1, size_type n1, basic_string_view str,
@@ -17,6 +15,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
@@ -26,22 +25,28 @@ void test1 ( std::experimental::basic_string_view<CharT> sv1, size_t pos1, size_
std::experimental::basic_string_view<CharT> sv2, size_t pos2, size_t n2,
int expected ) {
- try
- {
- assert ( sign( sv1.compare(pos1, n1, sv2, pos2, n2)) == sign(expected));
- assert(pos1 <= sv1.size());
- assert(pos2 <= sv2.size());
+ if (pos1 > sv1.size() || pos2 > sv2.size()) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ sv1.compare(pos1, n1, sv2, pos2, n2);
+ assert(false);
+ } catch (const std::out_of_range&) {
+ } catch (...) {
+ assert(false);
+ }
+#endif
+ } else {
+ assert (sign( sv1.compare(pos1, n1, sv2, pos2, n2)) == sign(expected));
}
- catch (const std::out_of_range&) { assert(pos1 > sv1.size() || pos2 > sv2.size()); }
}
template<typename CharT>
-void test ( const CharT *s1, size_t pos1, size_t n1,
- const CharT *s2, size_t pos2, size_t n2,
+void test ( const CharT *s1, size_t pos1, size_t n1,
+ const CharT *s2, size_t pos2, size_t n2,
int expected ) {
typedef std::experimental::basic_string_view<CharT> string_view_t;
-
+
string_view_t sv1 ( s1 );
string_view_t sv2 ( s2 );
test1(sv1, pos1, n1, sv2, pos2, n2, expected);
@@ -5801,7 +5806,7 @@ int main () {
test53();
test54();
-
+
{
test("abcde", 5, 1, "", 0, 0, 0);
test("abcde", 2, 4, "", 0, 0, 3);
@@ -5816,7 +5821,7 @@ int main () {
test(L"ABCde", 2, 4, L"abcde", 2, 4, -1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
test(u"abcde", 5, 1, u"", 0, 0, 0);
test(u"abcde", 2, 4, u"", 0, 0, 3);
@@ -5832,7 +5837,7 @@ int main () {
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1 { "abcde", 5 };
diff --git a/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp
index 3f686697ba40..4364ab063543 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp
@@ -19,7 +19,7 @@
int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
template<typename CharT>
-void test1 ( std::experimental::basic_string_view<CharT> sv1,
+void test1 ( std::experimental::basic_string_view<CharT> sv1,
std::experimental::basic_string_view<CharT> sv2, int expected ) {
assert ( sign( sv1.compare(sv2)) == sign(expected));
}
@@ -28,7 +28,7 @@ void test1 ( std::experimental::basic_string_view<CharT> sv1,
template<typename CharT>
void test ( const CharT *s1, const CharT *s2, int expected ) {
typedef std::experimental::basic_string_view<CharT> string_view_t;
-
+
string_view_t sv1 ( s1 );
string_view_t sv2 ( s2 );
test1(sv1, sv2, expected);
@@ -70,7 +70,7 @@ int main () {
test(L"abcdefghijklmnopqrst", L"abcdefghij", 10);
test(L"abcdefghijklmnopqrst", L"abcdefghijklmnopqrst", 0);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test(u"", u"", 0);
test(u"", u"abcde", -5);
test(u"", u"abcdefghij", -10);
@@ -105,7 +105,7 @@ int main () {
test(U"abcdefghijklmnopqrst", U"abcdefghij", 10);
test(U"abcdefghijklmnopqrst", U"abcdefghijklmnopqrst", 0);
#endif
-
+
#if _LIBCPP_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
@@ -117,5 +117,5 @@ int main () {
static_assert ( sv3.compare(sv2) > 0, "" );
static_assert ( sv2.compare(sv3) < 0, "" );
}
-#endif
+#endif
}
diff --git a/test/std/experimental/string.view/string.view.ops/copy.pass.cpp b/test/std/experimental/string.view/string.view.ops/copy.pass.cpp
index 0e4eb9e50bb0..0acd5bda4011 100644
--- a/test/std/experimental/string.view/string.view.ops/copy.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/copy.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-
-// XFAIL: libcpp-no-exceptions
// <string_view>
// size_type copy(charT* s, size_type n, size_type pos = 0) const;
@@ -23,30 +21,40 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template<typename CharT>
void test1 ( std::experimental::basic_string_view<CharT> sv, size_t n, size_t pos ) {
const size_t rlen = std::min ( n, sv.size() - pos );
CharT *dest1 = new CharT [rlen + 1]; dest1[rlen] = 0;
CharT *dest2 = new CharT [rlen + 1]; dest2[rlen] = 0;
-
- try {
+
+ if (pos > sv.size()) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ sv.copy(dest1, n, pos);
+ assert(false);
+ } catch (const std::out_of_range&) {
+ } catch (...) {
+ assert(false);
+ }
+#endif
+ } else {
sv.copy(dest1, n, pos);
std::copy_n(sv.begin() + pos, rlen, dest2);
-
for ( size_t i = 0; i <= rlen; ++i )
assert ( dest1[i] == dest2[i] );
- }
- catch ( const std::out_of_range & ) { assert ( pos > sv.size()); }
+ }
delete [] dest1;
- delete [] dest2;
+ delete [] dest2;
}
template<typename CharT>
void test ( const CharT *s ) {
typedef std::experimental::basic_string_view<CharT> string_view_t;
-
+
string_view_t sv1 ( s );
test1(sv1, 0, 0);
@@ -54,7 +62,7 @@ void test ( const CharT *s ) {
test1(sv1, 20, 0);
test1(sv1, sv1.size(), 0);
test1(sv1, 20, string_view_t::npos);
-
+
test1(sv1, 0, 3);
test1(sv1, 2, 3);
test1(sv1, 100, 3);
@@ -79,7 +87,7 @@ int main () {
test ( L"a" );
test ( L"" );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
test ( u"ABCDE" );
test ( u"a" );
diff --git a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp b/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
index c80e90a04788..a651010d4b27 100644
--- a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-
-// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
@@ -20,30 +18,42 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template<typename CharT>
void test1 ( std::experimental::basic_string_view<CharT> sv, size_t n, size_t pos ) {
- try {
+ if (pos > sv.size()) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ std::experimental::basic_string_view<CharT> sv1 = sv.substr(pos, n);
+ assert(false);
+ } catch (const std::out_of_range&) {
+ return;
+ } catch (...) {
+ assert(false);
+ }
+#endif
+ } else {
std::experimental::basic_string_view<CharT> sv1 = sv.substr(pos, n);
const size_t rlen = std::min ( n, sv.size() - pos );
assert ( sv1.size() == rlen );
for ( size_t i = 0; i <= rlen; ++i )
assert ( sv[pos+i] == sv1[i] );
- }
- catch ( const std::out_of_range & ) { assert ( pos > sv.size()); }
+ }
}
template<typename CharT>
void test ( const CharT *s ) {
typedef std::experimental::basic_string_view<CharT> string_view_t;
-
+
string_view_t sv1 ( s );
test1(sv1, 0, 0);
test1(sv1, 1, 0);
test1(sv1, 20, 0);
test1(sv1, sv1.size(), 0);
-
+
test1(sv1, 0, 3);
test1(sv1, 2, 3);
test1(sv1, 100, 3);
@@ -68,7 +78,7 @@ int main () {
test ( L"a" );
test ( L"" );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
test ( u"ABCDE" );
test ( u"a" );
@@ -79,8 +89,8 @@ int main () {
test ( U"a" );
test ( U"" );
#endif
-
-#if _LIBCPP_STD_VER > 11
+
+#if TEST_STD_VER > 11
{
constexpr std::experimental::string_view sv1 { "ABCDE", 5 };
@@ -91,7 +101,7 @@ int main () {
static_assert ( sv2[1] == 'B', "" );
static_assert ( sv2[2] == 'C', "" );
}
-
+
{
constexpr std::experimental::string_view sv2 = sv1.substr ( 3, 0 );
static_assert ( sv2.size() == 0, "" );
diff --git a/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp b/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp
index a180ab257bf5..a32a2684c548 100644
--- a/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp
@@ -26,11 +26,11 @@ void test ( const CharT *s ) {
{
const std::experimental::basic_string_view<CharT> sv1 ( s );
String str1 = (String) sv1;
-
+
assert ( sv1.size() == str1.size ());
assert ( std::char_traits<CharT>::compare ( sv1.data(), str1.data(), sv1.size()) == 0 );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
auto str2 = sv1.to_string(min_allocator<CharT>());
assert ( sv1.size() == str2.size ());
assert ( std::char_traits<CharT>::compare ( sv1.data(), str2.data(), sv1.size()) == 0 );
@@ -44,7 +44,7 @@ void test ( const CharT *s ) {
assert ( sv1.size() == 0);
assert ( sv1.size() == str1.size ());
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
auto str2 = sv1.to_string(min_allocator<CharT>());
assert ( sv1.size() == str2.size ());
#endif
@@ -62,7 +62,7 @@ int main () {
test ( L"a" );
test ( L"" );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
test ( u"ABCDE" );
test ( u"a" );
diff --git a/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp
index 2c90dd641813..ddc82cb5482f 100644
--- a/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp
+++ b/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp
@@ -7,14 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits>
#include <experimental/type_traits>
-#if _LIBCPP_STD_VER > 11
-# ifndef _LIBCPP_TYPE_TRAITS
-# error "<experimental/type_traits> must include <type_traits>"
-# endif
+#ifndef _LIBCPP_TYPE_TRAITS
+# error "<experimental/type_traits> must include <type_traits>"
#endif
int main()
diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp
index 96af4b676181..8edc917303ac 100644
--- a/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp
+++ b/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp
@@ -7,12 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits>
#include <experimental/type_traits>
-#if _LIBCPP_STD_VER > 11
-
namespace ex = std::experimental;
struct base_type {};
@@ -60,6 +59,4 @@ int main()
static_assert(ex::is_convertible_v<T, U> == std::is_convertible<T, U>::value, "");
}
}
-#else /* _LIBCPP_STD_VER <= 11 */
-int main() {}
-#endif /* _LIBCPP_STD_VER > 11 */
+
diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp
index 2d1e706f67d2..a4a91c136927 100644
--- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp
+++ b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp
@@ -7,12 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits>
#include <experimental/type_traits>
-#if _LIBCPP_STD_VER > 11
-
namespace ex = std::experimental;
struct class_type {};
@@ -176,6 +175,4 @@ int main()
static_assert(ex::is_function_v<T> == std::is_function<T>::value, "");
}
}
-#else /* _LIBCPP_STD_VER <= 11 */
-int main() {}
-#endif /* _LIBCPP_STD_VER > 11 */
+
diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp
index 814f450f4e07..b3927b120951 100644
--- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp
+++ b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp
@@ -7,12 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits>
#include <experimental/type_traits>
-#if _LIBCPP_STD_VER > 11
-
namespace ex = std::experimental;
struct class_type {};
@@ -97,6 +96,4 @@ int main()
static_assert(ex::is_member_pointer_v<T> == std::is_member_pointer<T>::value, "");
}
}
-#else /* _LIBCPP_STD_VER <= 11 */
-int main() {}
-#endif /* _LIBCPP_STD_VER > 11 */
+
diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp
index 41cb27fced37..e267c6833ab9 100644
--- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp
+++ b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp
@@ -7,12 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits>
#include <experimental/type_traits>
-#if _LIBCPP_STD_VER > 11
-
namespace ex = std::experimental;
struct non_literal_type { non_literal_type() {} };
@@ -484,6 +483,4 @@ int main()
static_assert(ex::has_virtual_destructor_v<T> == std::has_virtual_destructor<T>::value, "");
}
}
-#else /* _LIBCPP_STD_VER <= 11 */
-int main() {}
-#endif /* _LIBCPP_STD_VER > 11 */
+
diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp
index aedd369e5ac8..f91667da523c 100644
--- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp
+++ b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp
@@ -7,12 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits>
#include <experimental/type_traits>
-#if _LIBCPP_STD_VER > 11
-
namespace ex = std::experimental;
int main()
@@ -61,6 +60,3 @@ int main()
static_assert(ex::extent_v<T, 0> == std::extent<T, 0>::value, "");
}
}
-#else /* _LIBCPP_STD_VER <= 11 */
-int main() {}
-#endif /* _LIBCPP_STD_VER > 11 */
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign.pass.cpp
new file mode 100644
index 000000000000..33826383d127
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(const propagate_const<U>&)=delete;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+int main() { static_assert(!std::is_assignable<P, const P &>::value, ""); }
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_element_type.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_element_type.pass.cpp
new file mode 100644
index 000000000000..6de6c63d6104
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_element_type.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(U&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<CopyConstructibleFromX> PY;
+
+ X x1(1);
+ PY p(2);
+
+ assert(*p==2);
+
+ p = x1;
+
+ assert(*p==1);
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_propagate_const.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_propagate_const.pass.cpp
new file mode 100644
index 000000000000..ae6ef08d3cf0
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_propagate_const.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const& operator=(U&& u); // won't bind to propagate_const
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> PX;
+typedef propagate_const<CopyConstructibleFromX> PY;
+
+int main() { static_assert(!std::is_assignable<PY, const PX &>::value, ""); }
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_element_type.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_element_type.pass.cpp
new file mode 100644
index 000000000000..e4051325f1c1
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_element_type.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(U&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ X x1(1);
+ P p(2);
+
+ assert(*p==2);
+
+ p = x1;
+
+ assert(*p==1);
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign.pass.cpp
new file mode 100644
index 000000000000..b112b078d821
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(propagate_const<U>&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1(1);
+ P p2(2);
+
+ p2=std::move(p1);
+
+ assert(*p2==1);
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible.pass.cpp
new file mode 100644
index 000000000000..282f0aee6153
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(propagate_const<U>&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> PX;
+ typedef propagate_const<MoveConstructibleFromX> PY;
+
+ PX px2(2);
+ PY py1(1);
+
+ py1=std::move(px2);
+
+ assert(*py1==2);
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible_propagate_const.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible_propagate_const.pass.cpp
new file mode 100644
index 000000000000..743fc8eacbfa
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible_propagate_const.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const& operator=(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> PX;
+ typedef propagate_const<MoveConstructibleFromX> PY;
+
+ PX px2(2);
+ PY py1(1);
+
+ py1=std::move(px2);
+
+ assert(*py1==2);
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.explicit.ctor.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.explicit.ctor.pass.cpp
new file mode 100644
index 000000000000..10b0dd896280
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.explicit.ctor.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const& operator=(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<ExplicitCopyConstructibleFromX> P;
+
+int main() {
+ static_assert(!std::is_convertible<P, X>::value, "");
+ static_assert(std::is_constructible<P, X>::value, "");
+}
+
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.non-explicit.ctor.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.non-explicit.ctor.pass.cpp
new file mode 100644
index 000000000000..8ba5261de5e3
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.non-explicit.ctor.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<CopyConstructibleFromX> P;
+
+void f(const P& p)
+{
+ assert(*p==2);
+}
+
+int main() {
+ f(X(2));
+}
+
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.copy_ctor.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.copy_ctor.pass.cpp
new file mode 100644
index 000000000000..ca65f3c47fff
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.copy_ctor.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const& operator(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> PX;
+typedef propagate_const<CopyConstructibleFromX> PY;
+
+int main() { static_assert(!std::is_constructible<PX, PY>::value, ""); }
+
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.explicit.move_ctor.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.explicit.move_ctor.pass.cpp
new file mode 100644
index 000000000000..b021cbd5e5e1
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.explicit.move_ctor.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> PX;
+typedef propagate_const<ExplicitMoveConstructibleFromX> PY;
+
+int main() {
+ static_assert(!std::is_convertible<PY, PX &&>::value, "");
+ static_assert(std::is_constructible<PY, PX &&>::value, "");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.move_ctor.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.move_ctor.pass.cpp
new file mode 100644
index 000000000000..ee104a5250ea
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.move_ctor.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<MoveConstructibleFromX> PY;
+typedef propagate_const<X> PX;
+
+int main() {
+ PX px(1);
+ PY py(std::move(px));
+
+ assert(*py==1);
+}
+
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/copy_ctor.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/copy_ctor.pass.cpp
new file mode 100644
index 000000000000..daefdf320e3a
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/copy_ctor.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const(const propagate_const&)=delete;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+int main() { static_assert(!std::is_constructible<P, const P &>::value, ""); }
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.explicit.ctor.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.explicit.ctor.pass.cpp
new file mode 100644
index 000000000000..6a7289b2f1a6
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.explicit.ctor.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const(U&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<ExplicitX> P;
+
+int main() {
+ static_assert(!std::is_convertible<P, int>::value, "");
+ static_assert(std::is_constructible<P, int>::value, "");
+}
+
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type1.fail.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.non-explicit.ctor.pass.cpp
index 85c32ca6d495..9c6ed89f6757 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type1.fail.cpp
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.non-explicit.ctor.pass.cpp
@@ -9,19 +9,20 @@
// UNSUPPORTED: c++98, c++03, c++11
-#include <tuple>
-#include <string>
-#include <complex>
+// <propagate_const>
+// template <class U> propagate_const(U&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
#include <cassert>
-int main()
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+void f(const P&)
{
-#if _LIBCPP_STD_VER > 11
- typedef std::complex<float> cf;
- auto t1 = std::make_tuple<int, std::string> ( 42, "Hi" );
- assert (( std::get<cf>(t1) == cf {1,2} )); // no such type
-#else
-#error
-#endif
}
+
+int main() { f(2); }
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type2.fail.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
index 0a8d5829d02b..a5adf2d1f7f0 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type2.fail.cpp
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
@@ -9,19 +9,20 @@
// UNSUPPORTED: c++98, c++03, c++11
-#include <tuple>
-#include <string>
-#include <complex>
+// <propagate_const>
+// propagate_const(propagate_const&&)=default;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
#include <cassert>
-int main()
-{
-#if _LIBCPP_STD_VER > 11
- typedef std::complex<float> cf;
- auto t1 = std::make_tuple<int, int, std::string, cf> ( 42, 21, "Hi", { 1,2 } );
- assert ( std::get<int>(t1) == 42 ); // two ints here
-#else
-#error
-#endif
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1(2);
+ P p2(std::move(p1));
}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/dereference.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/dereference.pass.cpp
new file mode 100644
index 000000000000..5e9e0434fed7
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/dereference.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// element_type& propagate_const::operator*();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+constexpr P f()
+{
+ P p(1);
+ *p = 2;
+ return p;
+}
+
+int main() {
+ constexpr P p = f();
+ static_assert(*p==2,"");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/explicit_operator_element_type_ptr.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/explicit_operator_element_type_ptr.pass.cpp
new file mode 100644
index 000000000000..808eda0e3cc3
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/explicit_operator_element_type_ptr.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const::operator element_type*();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+int main() { static_assert(!std::is_convertible<P, int *>::value, ""); }
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/get.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/get.pass.cpp
new file mode 100644
index 000000000000..298389b7b59d
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/get.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// element_type* propagate_const::get();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+constexpr P f()
+{
+ P p(1);
+ *p.get() = 2;
+ return p;
+}
+
+int main() {
+ constexpr P p = f();
+ static_assert(*(p.get())==2,"");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/op_arrow.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/op_arrow.pass.cpp
new file mode 100644
index 000000000000..810e86eea172
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/op_arrow.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// element_type* propagate_const::operator->();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+constexpr P f()
+{
+ P p(1);
+ *(p.operator->()) = 2;
+ return p;
+}
+
+int main() {
+ constexpr P p = f();
+ static_assert(*(p.operator->())==2,"");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/operator_element_type_ptr.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/operator_element_type_ptr.pass.cpp
new file mode 100644
index 000000000000..6bdf76c92e99
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/operator_element_type_ptr.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const::operator element_type*();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<XWithImplicitIntStarConversion> P;
+
+ P p(1);
+
+ int* ptr_1 = p;
+
+ assert(*ptr_1==1);
+
+ *ptr_1 = 2;
+
+ assert(*ptr_1==2);
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/dereference.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/dereference.pass.cpp
new file mode 100644
index 000000000000..292335449649
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/dereference.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// const element_type& propagate_const::operator*() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ constexpr P p(1);
+
+ static_assert(*p==1,"");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/explicit_operator_element_type_ptr.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/explicit_operator_element_type_ptr.pass.cpp
new file mode 100644
index 000000000000..b9b6b3f90f23
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/explicit_operator_element_type_ptr.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const::operator const element_type*() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+int main() {
+ static_assert(!std::is_convertible<const P, const int *>::value, "");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/get.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/get.pass.cpp
new file mode 100644
index 000000000000..8029ff47475e
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/get.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// const element_type* propagate_const::get() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ constexpr P p(1);
+
+ static_assert(*(p.get())==1, "");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/op_arrow.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/op_arrow.pass.cpp
new file mode 100644
index 000000000000..4ceea8a1d781
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/op_arrow.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// const element_type* propagate_const::operator->() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ constexpr P p(1);
+
+ static_assert(*(p.operator->())==1,"");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/operator_element_type_ptr.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/operator_element_type_ptr.pass.cpp
new file mode 100644
index 000000000000..1ac6d254a342
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/operator_element_type_ptr.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const::operator const element_type*() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<XWithImplicitConstIntStarConversion> P;
+
+constexpr P p(1);
+
+constexpr const int *ptr_1 = p;
+
+int main() { assert(*ptr_1 == 1); }
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/swap.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/swap.pass.cpp
new file mode 100644
index 000000000000..c5c832bbe0c2
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/swap.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr void propagate_const::swap(propagate_const<T>& x);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+bool swap_called = false;
+void swap(X &, X &) { swap_called = true; }
+
+int main() {
+ typedef propagate_const<X> P;
+ P p1(1);
+ P p2(2);
+ p1.swap(p2);
+ assert(swap_called);
+}
+
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
new file mode 100644
index 000000000000..8cf670a25402
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+namespace std {
+template <> struct hash<X>
+{
+ typedef X first_argument_type;
+
+ size_t operator()(const first_argument_type& x1) const
+ {
+ return 99;
+ }
+
+};
+} // namespace std
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p(1);
+
+ auto h = std::hash<P>();
+
+ assert(h(p)==99);
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp
new file mode 100644
index 000000000000..d54222a97a1c
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct equal_to<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator==(const X &x1, const X &x2) { return x1.i_ == x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::equal_to<P>();
+
+ assert(c(p1_1,p2_1));
+ assert(!c(p1_1,p3_2));
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater.pass.cpp
new file mode 100644
index 000000000000..fb8e1282f214
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct greater<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator>(const X &x1, const X &x2) { return x1.i_ > x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::greater<P>();
+
+ assert(!c(p1_1,p2_1));
+ assert(!c(p2_1,p1_1));
+ assert(!c(p1_1,p3_2));
+ assert(c(p3_2,p1_1));
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater_equal.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater_equal.pass.cpp
new file mode 100644
index 000000000000..29a1868d6471
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater_equal.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct greater_equal<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator>=(const X &x1, const X &x2) { return x1.i_ >= x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::greater_equal<P>();
+
+ assert(c(p1_1,p2_1));
+ assert(c(p2_1,p1_1));
+ assert(!c(p1_1,p3_2));
+ assert(c(p3_2,p1_1));
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less.pass.cpp
new file mode 100644
index 000000000000..074a3914a51c
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct less<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator<(const X &x1, const X &x2) { return x1.i_ < x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::less<P>();
+
+ assert(!c(p1_1,p2_1));
+ assert(!c(p2_1,p1_1));
+ assert(c(p1_1,p3_2));
+ assert(!c(p3_2,p1_1));
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less_equal.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less_equal.pass.cpp
new file mode 100644
index 000000000000..a2082ec5cb31
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less_equal.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct less_equal<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator<=(const X &x1, const X &x2) { return x1.i_ <= x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::less_equal<P>();
+
+ assert(c(p1_1,p2_1));
+ assert(c(p2_1,p1_1));
+ assert(c(p1_1,p3_2));
+ assert(!c(p3_2,p1_1));
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/not_equal_to.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/not_equal_to.pass.cpp
new file mode 100644
index 000000000000..20756d984e94
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/not_equal_to.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct not_equal_to<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator!=(const X &x1, const X &x2) { return x1.i_ != x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::not_equal_to<P>();
+
+ assert(!c(p1_1,p2_1));
+ assert(c(p1_1,p3_2));
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/equal.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/equal.pass.cpp
new file mode 100644
index 000000000000..a4a28b48a545
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/equal.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator==(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator==(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator==(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+using std::nullptr_t;
+
+constexpr bool operator==(const X &lhs, const X &rhs) {
+ return lhs.i_ == rhs.i_;
+}
+
+constexpr bool operator==(const X &, const nullptr_t &) {
+ return false;
+}
+
+constexpr bool operator==(const nullptr_t &, const X &) {
+ return false;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(x1_1 == x1_1, "");
+ static_assert(x1_1 == x2_1, "");
+ static_assert(!(x1_1 == x3_2), "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(p1_1 == p1_1, "");
+ static_assert(p1_1 == p2_1, "");
+ static_assert(!(p1_1 == p3_2), "");
+
+ static_assert(x1_1 == p1_1, "");
+ static_assert(!(x1_1 == p3_2), "");
+
+ static_assert(p1_1 == x1_1, "");
+ static_assert(!(p1_1 == x3_2), "");
+
+ static_assert(!(p1_1==nullptr),"");
+ static_assert(!(nullptr==p1_1),"");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_equal.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_equal.pass.cpp
new file mode 100644
index 000000000000..4b5b42467c09
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_equal.pass.cpp
@@ -0,0 +1,54 @@
+//>==---------------------------------------------------------------------->==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//>==---------------------------------------------------------------------->==//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator>=(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator>=(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator>=(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator>=(const X &lhs, const X &rhs) {
+ return lhs.i_ >= rhs.i_;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(x1_1 >= x2_1, "");
+ static_assert(!(x1_1 >= x3_2), "");
+ static_assert(x3_2 >= x1_1, "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(p1_1 >= p2_1, "");
+ static_assert(!(p1_1 >= p3_2), "");
+ static_assert(p3_2 >= p1_1, "");
+
+ static_assert(p1_1 >= x2_1, "");
+ static_assert(!(p1_1 >= x3_2), "");
+ static_assert(p3_2 >= x1_1, "");
+
+ static_assert(x1_1 >= p2_1, "");
+ static_assert(!(x1_1 >= p3_2), "");
+ static_assert(x3_2 >= p1_1, "");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_than.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_than.pass.cpp
new file mode 100644
index 000000000000..3865b9370727
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_than.pass.cpp
@@ -0,0 +1,50 @@
+//>=---------------------------------------------------------------------->=//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//>=---------------------------------------------------------------------->=//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator>(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator>(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator>(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator>(const X &lhs, const X &rhs) {
+ return lhs.i_ > rhs.i_;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(!(x1_1 > x2_1), "");
+ static_assert(x3_2 > x1_1, "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(!(p1_1 > p2_1), "");
+ static_assert(p3_2 > p1_1, "");
+
+ static_assert(!(p1_1 > x2_1), "");
+ static_assert(p3_2 > x1_1, "");
+
+ static_assert(!(x1_1 > p2_1), "");
+ static_assert(x3_2 > p1_1, "");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_equal.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_equal.pass.cpp
new file mode 100644
index 000000000000..3ac12c27f8bb
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_equal.pass.cpp
@@ -0,0 +1,55 @@
+//<==----------------------------------------------------------------------<==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//<==----------------------------------------------------------------------<==//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator<=(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator<=(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator<=(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator<=(const X &lhs, const X &rhs) {
+ return lhs.i_ <= rhs.i_;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(x1_1 <= x2_1, "");
+ static_assert(x1_1 <= x3_2, "");
+ static_assert(!(x3_2 <= x1_1), "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(p1_1 <= p2_1, "");
+ static_assert(p1_1 <= p3_2, "");
+ static_assert(!(p3_2 <= p1_1), "");
+
+ static_assert(p1_1 <= x2_1, "");
+ static_assert(p1_1 <= x3_2, "");
+ static_assert(!(p3_2 <= x1_1), "");
+
+ static_assert(x1_1 <= p2_1, "");
+ static_assert(x1_1 <= p3_2, "");
+ static_assert(!(x3_2 <= p1_1), "");
+
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_than.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_than.pass.cpp
new file mode 100644
index 000000000000..42b2730c58cc
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_than.pass.cpp
@@ -0,0 +1,50 @@
+//<=----------------------------------------------------------------------<=//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//<=----------------------------------------------------------------------<=//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator<(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator<(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator<(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator<(const X &lhs, const X &rhs) {
+ return lhs.i_ < rhs.i_;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(!(x1_1 < x2_1), "");
+ static_assert(x1_1 < x3_2, "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(!(p1_1 < p2_1), "");
+ static_assert(p1_1 < p3_2, "");
+
+ static_assert(!(x1_1 < p1_1), "");
+ static_assert(x1_1 < p3_2, "");
+
+ static_assert(!(p1_1 < x1_1), "");
+ static_assert(p1_1 < x3_2, "");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/not_equal.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/not_equal.pass.cpp
new file mode 100644
index 000000000000..1104abdecb6d
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/not_equal.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator!=(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator!=(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator!=(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+using std::nullptr_t;
+
+constexpr bool operator!=(const X &lhs, const X &rhs) {
+ return lhs.i_ != rhs.i_;
+}
+
+constexpr bool operator!=(const X &, const nullptr_t &) {
+ return true;
+}
+
+constexpr bool operator!=(const nullptr_t &, const X &) {
+ return true;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(!(x1_1 != x2_1), "");
+ static_assert(x1_1 != x3_2, "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(!(p1_1 != p2_1), "");
+ static_assert(p1_1 != p3_2, "");
+
+ static_assert(!(x1_1 != p1_1), "");
+ static_assert(x1_1 != p3_2, "");
+
+ static_assert(!(p1_1 != x1_1), "");
+ static_assert(p1_1 != x3_2, "");
+
+ static_assert(p1_1!=nullptr,"");
+ static_assert(nullptr!=p1_1,"");
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/swap.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/swap.pass.cpp
new file mode 100644
index 000000000000..6c3b60948965
--- /dev/null
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/swap.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr void swap(propagate_const<T>& x, propagate_const<T>& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+bool swap_called = false;
+void swap(X &, X &) { swap_called = true; }
+
+int main() {
+ typedef propagate_const<X> P;
+ P p1(1);
+ P p2(2);
+ swap(p1, p2);
+ assert(swap_called);
+}
diff --git a/test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp
index 2d700486f26b..5b8a8f09d1ee 100644
--- a/test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp
+++ b/test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp
@@ -9,11 +9,6 @@
// UNSUPPORTED: c++98, c++03, c++11
-// TODO(ericwf)
-// constexpr support temporarily reverted due to bug:
-// https://llvm.org/bugs/show_bug.cgi?id=23141
-// XFAIL: *
-
// <experimental/tuple>
// template <class F, class T> constexpr decltype(auto) apply(F &&, T &&)
diff --git a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
index 1ec38da5c043..314d2783f7ec 100644
--- a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
+++ b/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
@@ -25,30 +25,27 @@ template <int N> struct index {};
void f(index<0>) {}
int f(index<1>) { return 0; }
-int const f(index<2>) { return 0; }
-int volatile f(index<3>) { return 0; }
-int const volatile f(index<4>) { return 0; }
-int & f(index<5>) { return static_cast<int &>(my_int); }
-int const & f(index<6>) { return static_cast<int const &>(my_int); }
-int volatile & f(index<7>) { return static_cast<int volatile &>(my_int); }
-int const volatile & f(index<8>) { return static_cast<int const volatile &>(my_int); }
+int & f(index<2>) { return static_cast<int &>(my_int); }
+int const & f(index<3>) { return static_cast<int const &>(my_int); }
+int volatile & f(index<4>) { return static_cast<int volatile &>(my_int); }
+int const volatile & f(index<5>) { return static_cast<int const volatile &>(my_int); }
-int && f(index<9>) { return static_cast<int &&>(my_int); }
-int const && f(index<10>) { return static_cast<int const &&>(my_int); }
-int volatile && f(index<11>) { return static_cast<int volatile &&>(my_int); }
-int const volatile && f(index<12>) { return static_cast<int const volatile &&>(my_int); }
+int && f(index<6>) { return static_cast<int &&>(my_int); }
+int const && f(index<7>) { return static_cast<int const &&>(my_int); }
+int volatile && f(index<8>) { return static_cast<int volatile &&>(my_int); }
+int const volatile && f(index<9>) { return static_cast<int const volatile &&>(my_int); }
-int * f(index<13>) { return static_cast<int *>(&my_int); }
-int const * f(index<14>) { return static_cast<int const *>(&my_int); }
-int volatile * f(index<15>) { return static_cast<int volatile *>(&my_int); }
-int const volatile * f(index<16>) { return static_cast<int const volatile *>(&my_int); }
+int * f(index<10>) { return static_cast<int *>(&my_int); }
+int const * f(index<11>) { return static_cast<int const *>(&my_int); }
+int volatile * f(index<12>) { return static_cast<int volatile *>(&my_int); }
+int const volatile * f(index<13>) { return static_cast<int const volatile *>(&my_int); }
template <int Func, class Expect>
void test()
{
- using F = decltype((f(index<Func>{})));
+ using F = decltype(f(index<Func>{}));
static_assert(std::is_same<F, Expect>::value, "");
}
@@ -58,19 +55,16 @@ int main()
{
test<0, void>();
test<1, int>();
- //test<2, int const>();
- //test<3, int volatile>();
- //test<4, int const volatile>();
- test<5, int &>();
- test<6, int const &>();
- test<7, int volatile &>();
- test<8, int const volatile &>();
- test<9, int &&>();
- test<10, int const &&>();
- test<11, int volatile &&>();
- test<12, int const volatile &&>();
- test<13, int *>();
- test<14, int const *>();
- test<15, int volatile *>();
- test<16, int const volatile *>();
+ test<2, int &>();
+ test<3, int const &>();
+ test<4, int volatile &>();
+ test<5, int const volatile &>();
+ test<6, int &&>();
+ test<7, int const &&>();
+ test<8, int volatile &&>();
+ test<9, int const volatile &&>();
+ test<10, int *>();
+ test<11, int const *>();
+ test<12, int volatile *>();
+ test<13, int const volatile *>();
}
diff --git a/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp b/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
index 4cb2c4c2f448..8937950522c8 100644
--- a/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
+++ b/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
@@ -917,7 +917,7 @@ int main()
std::uintmax_t i4 = 0;
}
{
- std::imaxdiv_t i1 = {0};
+ std::imaxdiv_t i1 = {};
}
std::intmax_t i = 0;
static_assert((std::is_same<decltype(std::imaxabs(i)), std::intmax_t>::value), "");
diff --git a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
index a06f0443d701..4c2be7d4aa9e 100644
--- a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
+++ b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
@@ -78,17 +78,24 @@
#include <cstdarg>
+#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-zero-length"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
int main()
{
std::FILE* fp = 0;
- std::fpos_t fpos = {0};
+ std::fpos_t fpos = {};
std::size_t s = 0;
char* cp = 0;
std::va_list va;
+ ((void)fp); // Prevent unused warning
+ ((void)fpos); // Prevent unused warning
+ ((void)s); // Prevent unused warning
+ ((void)cp); // Prevent unused warning
+ ((void)va); // Prevent unused warning
static_assert((std::is_same<decltype(std::fclose(fp)), int>::value), "");
static_assert((std::is_same<decltype(std::fflush(fp)), int>::value), "");
static_assert((std::is_same<decltype(std::setbuf(fp,cp)), void>::value), "");
diff --git a/test/std/input.output/file.streams/c.files/gets.fail.cpp b/test/std/input.output/file.streams/c.files/gets.fail.cpp
index 4250e23c11c2..064d72cd9e4a 100644
--- a/test/std/input.output/file.streams/c.files/gets.fail.cpp
+++ b/test/std/input.output/file.streams/c.files/gets.fail.cpp
@@ -7,17 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// test <cstdio>
-// gets
+// gets
#include <cstdio>
int main()
{
-#if _LIBCPP_STD_VER > 11
(void) std::gets((char *) NULL);
-#else
-#error
-#endif
}
diff --git a/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp b/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
index a8b82a62bb6b..553c2b2eb3a0 100644
--- a/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
+++ b/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
@@ -44,7 +44,7 @@ int main()
testbuf<char> sb(" Sat Dec 31 23:55:59 2061");
std::istream is(&sb);
is.imbue(std::locale(LOCALE_en_US_UTF_8));
- std::tm t = {0};
+ std::tm t = {};
is >> std::get_time(&t, "%a %b %d %H:%M:%S %Y");
assert(t.tm_sec == 59);
assert(t.tm_min == 55);
@@ -60,7 +60,7 @@ int main()
testbuf<wchar_t> sb(L" Sat Dec 31 23:55:59 2061");
std::wistream is(&sb);
is.imbue(std::locale(LOCALE_en_US_UTF_8));
- std::tm t = {0};
+ std::tm t = {};
is >> std::get_time(&t, L"%a %b %d %H:%M:%S %Y");
assert(t.tm_sec == 59);
assert(t.tm_min == 55);
diff --git a/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
index f4e3ded1745c..e907708d0f22 100644
--- a/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
+++ b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
@@ -56,7 +56,7 @@ int main()
testbuf<char> sb;
std::ostream os(&sb);
os.imbue(std::locale(LOCALE_en_US_UTF_8));
- std::tm t = {0};
+ std::tm t = {};
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;
@@ -72,7 +72,7 @@ int main()
testbuf<wchar_t> sb;
std::wostream os(&sb);
os.imbue(std::locale(LOCALE_en_US_UTF_8));
- std::tm t = {0};
+ std::tm t = {};
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
index ccc3545483e7..e498172aa8b1 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
@@ -21,10 +21,10 @@ int main()
{
int bad=-1;
std::ostringstream os;
- os << "aaaabbbb" << static_cast<char>(bad)
+ os << "aaaabbbb" << static_cast<char>(bad)
<< "ccccdddd" << std::endl;
std::string s=os.str();
-
+
std::istringstream is(s);
const unsigned int ignoreLen=10;
size_t a=is.tellg();
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
index 3cedf9192808..818d42c26212 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
@@ -40,7 +40,7 @@ public:
CharT* egptr() const {return base::egptr();}
protected:
typename base::pos_type seekoff(typename base::off_type off,
- std::ios_base::seekdir way,
+ std::ios_base::seekdir,
std::ios_base::openmode which)
{
assert(which == std::ios_base::in);
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
index 27b8cfd85c96..47e257a18684 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
@@ -21,8 +21,10 @@
// Testing to make sure that the max length values are correctly inserted
-#include <iostream>
#include <sstream>
+#include <ios>
+#include <cctype>
+#include <cstdint>
#include <cassert>
template <typename T>
@@ -30,7 +32,6 @@ void test_octal(const char *expected)
{
std::stringstream ss;
ss << std::oct << static_cast<T>(-1);
-
assert(ss.str() == expected);
}
@@ -39,8 +40,6 @@ void test_dec(const char *expected)
{
std::stringstream ss;
ss << std::dec << static_cast<T>(-1);
-
-// std::cout << ss.str() << " " << expected << std::endl;
assert(ss.str() == expected);
}
@@ -49,22 +48,32 @@ void test_hex(const char *expected)
{
std::stringstream ss;
ss << std::hex << static_cast<T>(-1);
-
+
std::string str = ss.str();
for (size_t i = 0; i < str.size(); ++i )
str[i] = std::toupper(str[i]);
-
+
assert(str == expected);
}
-int main(int argc, char* argv[])
+int main()
{
+
test_octal<uint16_t>( "177777");
test_octal< int16_t>( "177777");
test_octal<uint32_t>( "37777777777");
test_octal< int32_t>( "37777777777");
test_octal<uint64_t>("1777777777777777777777");
test_octal< int64_t>("1777777777777777777777");
+ test_octal<uint64_t>("1777777777777777777777");
+ if (sizeof(long) == sizeof(int64_t)) {
+ test_octal< unsigned long>("1777777777777777777777");
+ test_octal< long>("1777777777777777777777");
+ }
+ if (sizeof(long long) == sizeof(int64_t)) {
+ test_octal< unsigned long long>("1777777777777777777777");
+ test_octal< long long>("1777777777777777777777");
+ }
test_dec<uint16_t>( "65535");
test_dec< int16_t>( "-1");
@@ -72,6 +81,14 @@ int main(int argc, char* argv[])
test_dec< int32_t>( "-1");
test_dec<uint64_t>("18446744073709551615");
test_dec< int64_t>( "-1");
+ if (sizeof(long) == sizeof(int64_t)) {
+ test_dec<unsigned long>("18446744073709551615");
+ test_dec< long>( "-1");
+ }
+ if (sizeof(long long) == sizeof(int64_t)) {
+ test_dec<unsigned long long>("18446744073709551615");
+ test_dec< long long>( "-1");
+ }
test_hex<uint16_t>( "FFFF");
test_hex< int16_t>( "FFFF");
@@ -79,6 +96,12 @@ int main(int argc, char* argv[])
test_hex< int32_t>( "FFFFFFFF");
test_hex<uint64_t>("FFFFFFFFFFFFFFFF");
test_hex< int64_t>("FFFFFFFFFFFFFFFF");
-
- return 0;
+ if (sizeof(long) == sizeof(int64_t)) {
+ test_hex<unsigned long>("FFFFFFFFFFFFFFFF");
+ test_hex< long>("FFFFFFFFFFFFFFFF");
+ }
+ if (sizeof(long long) == sizeof(int64_t)) {
+ test_hex<unsigned long long>("FFFFFFFFFFFFFFFF");
+ test_hex< long long>("FFFFFFFFFFFFFFFF");
+ }
}
diff --git a/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp b/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
index d09b3cae4f66..ee9aabcb6ac8 100644
--- a/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
+++ b/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
@@ -16,79 +16,95 @@
#include <string>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
-bool is_skipws ( const std::istream *is ) {
- return ( is->flags() & std::ios_base::skipws ) != 0;
- }
+#include "test_macros.h"
+#if TEST_STD_VER > 11
-bool is_skipws ( const std::wistream *is ) {
- return ( is->flags() & std::ios_base::skipws ) != 0;
+template <class CharT, class Traits>
+bool is_skipws ( const std::basic_istream<CharT, Traits>& is ) {
+ return ( is.flags() & std::ios_base::skipws ) != 0;
}
-void both_ways ( const char *p ) {
- std::string str(p);
+template <class CharT, class Traits = std::char_traits<CharT>>
+void both_ways ( const CharT *p ) {
+ std::basic_string<CharT, Traits> str(p);
auto q = std::quoted(str);
- std::stringstream ss;
- bool skippingws = is_skipws ( &ss );
+ std::basic_stringstream<CharT, Traits> ss;
+ bool skippingws = is_skipws ( ss );
ss << q;
ss >> q;
}
-void round_trip ( const char *p ) {
- std::stringstream ss;
- bool skippingws = is_skipws ( &ss );
+template <class CharT, class Traits = std::char_traits<CharT>>
+void round_trip ( const CharT *p ) {
+ std::basic_stringstream<CharT, Traits> ss;
+ bool skippingws = is_skipws ( ss );
+
ss << std::quoted(p);
- std::string s;
+ std::basic_string<CharT, Traits> s;
ss >> std::quoted(s);
assert ( s == p );
- assert ( skippingws == is_skipws ( &ss ));
+ assert ( skippingws == is_skipws ( ss ));
}
-void round_trip_ws ( const char *p ) {
- std::stringstream ss;
+
+template <class CharT, class Traits = std::char_traits<CharT>>
+void round_trip_ws ( const CharT *p ) {
+ std::basic_stringstream<CharT, Traits> ss;
std::noskipws ( ss );
- bool skippingws = is_skipws ( &ss );
+ bool skippingws = is_skipws ( ss );
+
ss << std::quoted(p);
- std::string s;
+ std::basic_string<CharT, Traits> s;
ss >> std::quoted(s);
assert ( s == p );
- assert ( skippingws == is_skipws ( &ss ));
+ assert ( skippingws == is_skipws ( ss ));
}
-void round_trip_d ( const char *p, char delim ) {
- std::stringstream ss;
- ss << std::quoted(p, delim);
- std::string s;
- ss >> std::quoted(s, delim);
+template <class CharT, class Traits = std::char_traits<CharT>>
+void round_trip_d ( const CharT *p, char delim ) {
+ std::basic_stringstream<CharT, Traits> ss;
+ CharT d(delim);
+
+ ss << std::quoted(p, d);
+ std::basic_string<CharT, Traits> s;
+ ss >> std::quoted(s, d);
assert ( s == p );
}
-void round_trip_e ( const char *p, char escape ) {
- std::stringstream ss;
- ss << std::quoted(p, '"', escape );
- std::string s;
- ss >> std::quoted(s, '"', escape );
+template <class CharT, class Traits = std::char_traits<CharT>>
+void round_trip_e ( const CharT *p, char escape ) {
+ std::basic_stringstream<CharT, Traits> ss;
+ CharT e(escape);
+
+ ss << std::quoted(p, CharT('"'), e );
+ std::basic_string<CharT, Traits> s;
+ ss >> std::quoted(s, CharT('"'), e );
assert ( s == p );
}
-
-std::string quote ( const char *p, char delim='"', char escape='\\' ) {
- std::stringstream ss;
- ss << std::quoted(p, delim, escape);
- std::string s;
+template <class CharT, class Traits = std::char_traits<CharT>>
+std::basic_string<CharT, Traits> quote ( const CharT *p, char delim='"', char escape='\\' ) {
+ std::basic_stringstream<CharT, Traits> ss;
+ CharT d(delim);
+ CharT e(escape);
+ ss << std::quoted(p, d, e);
+ std::basic_string<CharT, Traits> s;
ss >> s; // no quote
return s;
}
-std::string unquote ( const char *p, char delim='"', char escape='\\' ) {
- std::stringstream ss;
+template <class CharT, class Traits = std::char_traits<CharT>>
+std::basic_string<CharT, Traits> unquote ( const CharT *p, char delim='"', char escape='\\' ) {
+ std::basic_stringstream<CharT, Traits> ss;
ss << p;
- std::string s;
- ss >> std::quoted(s, delim, escape);
+
+ CharT d(delim);
+ CharT e(escape);
+ std::basic_string<CharT, Traits> s;
+ ss >> std::quoted(s, d, e);
return s;
}
@@ -98,7 +114,7 @@ void test_padding () {
ss << std::left << std::setw(10) << std::setfill('!') << std::quoted("abc", '`');
assert ( ss.str() == "`abc`!!!!!" );
}
-
+
{
std::stringstream ss;
ss << std::right << std::setw(10) << std::setfill('!') << std::quoted("abc", '`');
@@ -107,61 +123,6 @@ void test_padding () {
}
-void round_trip ( const wchar_t *p ) {
- std::wstringstream ss;
- bool skippingws = is_skipws ( &ss );
- ss << std::quoted(p);
- std::wstring s;
- ss >> std::quoted(s);
- assert ( s == p );
- assert ( skippingws == is_skipws ( &ss ));
- }
-
-
-void round_trip_ws ( const wchar_t *p ) {
- std::wstringstream ss;
- std::noskipws ( ss );
- bool skippingws = is_skipws ( &ss );
- ss << std::quoted(p);
- std::wstring s;
- ss >> std::quoted(s);
- assert ( s == p );
- assert ( skippingws == is_skipws ( &ss ));
- }
-
-void round_trip_d ( const wchar_t *p, wchar_t delim ) {
- std::wstringstream ss;
- ss << std::quoted(p, delim);
- std::wstring s;
- ss >> std::quoted(s, delim);
- assert ( s == p );
- }
-
-void round_trip_e ( const wchar_t *p, wchar_t escape ) {
- std::wstringstream ss;
- ss << std::quoted(p, wchar_t('"'), escape );
- std::wstring s;
- ss >> std::quoted(s, wchar_t('"'), escape );
- assert ( s == p );
- }
-
-
-std::wstring quote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) {
- std::wstringstream ss;
- ss << std::quoted(p, delim, escape);
- std::wstring s;
- ss >> s; // no quote
- return s;
-}
-
-std::wstring unquote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) {
- std::wstringstream ss;
- ss << p;
- std::wstring s;
- ss >> std::quoted(s, delim, escape);
- return s;
-}
-
int main()
{
both_ways ( "" ); // This is a compilation check
@@ -170,31 +131,31 @@ int main()
round_trip_ws ( "" );
round_trip_d ( "", 'q' );
round_trip_e ( "", 'q' );
-
+
round_trip ( L"" );
round_trip_ws ( L"" );
round_trip_d ( L"", 'q' );
round_trip_e ( L"", 'q' );
-
+
round_trip ( "Hi" );
round_trip_ws ( "Hi" );
round_trip_d ( "Hi", '!' );
round_trip_e ( "Hi", '!' );
assert ( quote ( "Hi", '!' ) == "!Hi!" );
assert ( quote ( "Hi!", '!' ) == R"(!Hi\!!)" );
-
+
round_trip ( L"Hi" );
round_trip_ws ( L"Hi" );
round_trip_d ( L"Hi", '!' );
round_trip_e ( L"Hi", '!' );
assert ( quote ( L"Hi", '!' ) == L"!Hi!" );
assert ( quote ( L"Hi!", '!' ) == LR"(!Hi\!!)" );
-
+
round_trip ( "Hi Mom" );
round_trip_ws ( "Hi Mom" );
round_trip ( L"Hi Mom" );
round_trip_ws ( L"Hi Mom" );
-
+
assert ( quote ( "" ) == "\"\"" );
assert ( quote ( L"" ) == L"\"\"" );
assert ( quote ( "a" ) == "\"a\"" );
@@ -203,7 +164,7 @@ int main()
// missing end quote - must not hang
assert ( unquote ( "\"abc" ) == "abc" );
assert ( unquote ( L"\"abc" ) == L"abc" );
-
+
assert ( unquote ( "abc" ) == "abc" ); // no delimiter
assert ( unquote ( L"abc" ) == L"abc" ); // no delimiter
assert ( unquote ( "abc def" ) == "abc" ); // no delimiter
diff --git a/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp b/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp
index 2f516f8fbc91..c9fccea2c7d0 100644
--- a/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp
+++ b/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp
@@ -16,7 +16,11 @@
#include <string>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
+#include "test_macros.h"
+
+// Test that mismatches between strings and wides streams are diagnosed
+
+#if TEST_STD_VER > 11
void round_trip ( const char *p ) {
std::wstringstream ss;
@@ -29,7 +33,7 @@ void round_trip ( const char *p ) {
int main()
{
- round_trip ( "Hi Mom" );
+ round_trip ( "Hi Mom" );
}
#else
#error
diff --git a/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp b/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp
index bdd362df19c9..109674d1660d 100644
--- a/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp
+++ b/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp
@@ -16,7 +16,11 @@
#include <string>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
+#include "test_macros.h"
+
+#if TEST_STD_VER > 11
+
+// Test that mismatches in the traits between the quoted object and the dest string are diagnosed.
template <class charT>
struct test_traits
@@ -35,7 +39,7 @@ void round_trip ( const char *p ) {
int main()
{
- round_trip ( "Hi Mom" );
+ round_trip ( "Hi Mom" );
}
#else
#error
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp
index 509b836686c5..0b068e0d4a9f 100644
--- a/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp
@@ -41,17 +41,17 @@ bool g1_called = false;
bool g2_called = false;
bool g3_called = false;
-void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+void f1(std::ios_base::event, std::ios_base&, int)
{
f1_called = true;
}
-void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+void f2(std::ios_base::event, std::ios_base&, int)
{
f2_called = true;
}
-void g1(std::ios_base::event ev, std::ios_base& stream, int index)
+void g1(std::ios_base::event ev, std::ios_base&, int index)
{
if (ev == std::ios_base::imbue_event)
{
@@ -60,7 +60,7 @@ void g1(std::ios_base::event ev, std::ios_base& stream, int index)
}
}
-void g2(std::ios_base::event ev, std::ios_base& stream, int index)
+void g2(std::ios_base::event ev, std::ios_base&, int index)
{
if (ev == std::ios_base::imbue_event)
{
@@ -69,7 +69,7 @@ void g2(std::ios_base::event ev, std::ios_base& stream, int index)
}
}
-void g3(std::ios_base::event ev, std::ios_base& stream, int index)
+void g3(std::ios_base::event ev, std::ios_base&, int index)
{
if (ev == std::ios_base::imbue_event)
{
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp
index bf865e68149d..bf865e68149d 100644
--- a/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp
index e44f4b32512c..2887ca100c99 100644
--- a/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp
@@ -41,31 +41,31 @@ bool g1_called = false;
bool g2_called = false;
bool g3_called = false;
-void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+void f1(std::ios_base::event, std::ios_base&, int index)
{
assert(index == 4);
f1_called = true;
}
-void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+void f2(std::ios_base::event, std::ios_base&, int index)
{
assert(index == 5);
f2_called = true;
}
-void g1(std::ios_base::event ev, std::ios_base& stream, int index)
+void g1(std::ios_base::event, std::ios_base&, int index)
{
assert(index == 7);
g1_called = true;
}
-void g2(std::ios_base::event ev, std::ios_base& stream, int index)
+void g2(std::ios_base::event, std::ios_base&, int index)
{
assert(index == 8);
g2_called = true;
}
-void g3(std::ios_base::event ev, std::ios_base& stream, int index)
+void g3(std::ios_base::event, std::ios_base&, int index)
{
assert(index == 9);
g3_called = true;
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp
index 730cedeea76c..1935308dea0f 100644
--- a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp
@@ -25,7 +25,7 @@ struct test
test() {}
protected:
- std::streamsize xsgetn(char_type* s, std::streamsize n)
+ std::streamsize xsgetn(char_type*, std::streamsize)
{
++xsgetn_called;
return 10;
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp
index 34a2a2dda372..2f4aad051079 100644
--- a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp
@@ -32,7 +32,7 @@ struct test
}
protected:
- int_type pbackfail(int_type c = traits_type::eof())
+ int_type pbackfail(int_type = traits_type::eof())
{
++pbackfail_called;
return 'a';
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp
index 4c68fada07a8..36a19da85fe0 100644
--- a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp
@@ -32,7 +32,7 @@ struct test
}
protected:
- int_type pbackfail(int_type c = traits_type::eof())
+ int_type pbackfail(int_type = traits_type::eof())
{
++pbackfail_called;
return 'a';
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp
index b04b8b0acc91..5ea48c18d793 100644
--- a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp
@@ -36,7 +36,7 @@ struct test
}
protected:
- int_type overflow(int_type c = traits_type::eof())
+ int_type overflow(int_type = traits_type::eof())
{
++overflow_called;
return 'a';
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp
index e03e8e0cbda3..4ced690a2652 100644
--- a/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp
@@ -25,7 +25,7 @@ struct test
test() {}
protected:
- std::streamsize xsputn(const char_type* s, std::streamsize n)
+ std::streamsize xsputn(const char_type*, std::streamsize)
{
++xsputn_called;
return 5;
diff --git a/test/std/iterators/iterator.container/data.pass.cpp b/test/std/iterators/iterator.container/data.pass.cpp
index 3d1fa33358db..a7a17480235a 100644
--- a/test/std/iterators/iterator.container/data.pass.cpp
+++ b/test/std/iterators/iterator.container/data.pass.cpp
@@ -13,7 +13,9 @@
// template <class T, size_t N> constexpr T* data(T (&array)[N]) noexcept; // C++17
// template <class E> constexpr const E* data(initializer_list<E> il) noexcept; // C++17
-#if __cplusplus <= 201402L
+#include "test_macros.h"
+
+#if TEST_STD_VER <= 14
int main () {}
#else
@@ -40,7 +42,7 @@ void test_container( C& c )
{
assert ( std::data(c) == c.data());
}
-
+
template<typename T>
void test_container( std::initializer_list<T>& c)
{
@@ -58,7 +60,7 @@ int main()
std::vector<int> v; v.push_back(1);
std::array<int, 1> a; a[0] = 3;
std::initializer_list<int> il = { 4 };
-
+
test_container ( v );
test_container ( a );
test_container ( il );
@@ -66,7 +68,7 @@ int main()
test_const_container ( v );
test_const_container ( a );
test_const_container ( il );
-
+
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
}
diff --git a/test/std/iterators/iterator.container/empty.pass.cpp b/test/std/iterators/iterator.container/empty.pass.cpp
index f26cb98e1aed..f9b8b94a89f9 100644
--- a/test/std/iterators/iterator.container/empty.pass.cpp
+++ b/test/std/iterators/iterator.container/empty.pass.cpp
@@ -12,7 +12,9 @@
// template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept; // C++17
// template <class E> constexpr bool empty(initializer_list<E> il) noexcept; // C++17
-#if __cplusplus <= 201402L
+#include "test_macros.h"
+
+#if TEST_STD_VER <= 14
int main () {}
#else
@@ -40,7 +42,7 @@ void test_container( C& c )
{
assert ( std::empty(c) == c.empty());
}
-
+
template<typename T>
void test_container( std::initializer_list<T>& c )
{
@@ -59,7 +61,7 @@ int main()
std::list<int> l; l.push_back(2);
std::array<int, 1> a; a[0] = 3;
std::initializer_list<int> il = { 4 };
-
+
test_container ( v );
test_container ( l );
test_container ( a );
@@ -69,7 +71,7 @@ int main()
test_const_container ( l );
test_const_container ( a );
test_const_container ( il );
-
+
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
}
diff --git a/test/std/iterators/iterator.container/size.pass.cpp b/test/std/iterators/iterator.container/size.pass.cpp
index 705fb40e1926..87b0ef897072 100644
--- a/test/std/iterators/iterator.container/size.pass.cpp
+++ b/test/std/iterators/iterator.container/size.pass.cpp
@@ -11,7 +11,9 @@
// template <class C> constexpr auto size(const C& c) -> decltype(c.size()); // C++17
// template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
-#if __cplusplus <= 201402L
+#include "test_macros.h"
+
+#if TEST_STD_VER <= 14
int main () {}
#else
@@ -39,7 +41,7 @@ void test_container( C& c)
{
assert ( std::size(c) == c.size());
}
-
+
template<typename T>
void test_container( std::initializer_list<T>& c )
{
@@ -58,7 +60,7 @@ int main()
std::list<int> l; l.push_back(2);
std::array<int, 1> a; a[0] = 3;
std::initializer_list<int> il = { 4 };
-
+
test_container ( v );
test_container ( l );
test_container ( a );
@@ -68,7 +70,7 @@ int main()
test_const_container ( l );
test_const_container ( a );
test_const_container ( il );
-
+
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
}
diff --git a/test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp b/test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp
index 0f368c3b765f..ecda1d146949 100644
--- a/test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp
+++ b/test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp
@@ -17,6 +17,7 @@
int main()
{
std::bidirectional_iterator_tag tag;
+ ((void)tag); // Prevent unused warning
static_assert((std::is_base_of<std::forward_iterator_tag,
std::bidirectional_iterator_tag>::value), "");
static_assert((!std::is_base_of<std::output_iterator_tag,
diff --git a/test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp b/test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp
index 0936595c85d6..e11b8e9ba7ac 100644
--- a/test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp
+++ b/test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp
@@ -17,6 +17,7 @@
int main()
{
std::forward_iterator_tag tag;
+ ((void)tag); // Prevent unused warning
static_assert((std::is_base_of<std::input_iterator_tag,
std::forward_iterator_tag>::value), "");
static_assert((!std::is_base_of<std::output_iterator_tag,
diff --git a/test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp b/test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp
index afeac3e91cae..19b517c328e7 100644
--- a/test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp
+++ b/test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp
@@ -17,6 +17,7 @@
int main()
{
std::input_iterator_tag tag;
+ ((void)tag); // Prevent unused warning
static_assert((!std::is_base_of<std::output_iterator_tag,
std::input_iterator_tag>::value), "");
}
diff --git a/test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp b/test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp
index 7f7f66a98f4a..e315b2724f82 100644
--- a/test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp
+++ b/test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp
@@ -17,6 +17,7 @@
int main()
{
std::output_iterator_tag tag;
+ ((void)tag); // Prevent unused warning
static_assert((!std::is_base_of<std::input_iterator_tag,
std::output_iterator_tag>::value), "");
}
diff --git a/test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp b/test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp
index 04f830bc3109..f16a3b74c53f 100644
--- a/test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp
+++ b/test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp
@@ -17,6 +17,7 @@
int main()
{
std::random_access_iterator_tag tag;
+ ((void)tag); // Prevent unused warning
static_assert((std::is_base_of<std::bidirectional_iterator_tag,
std::random_access_iterator_tag>::value), "");
static_assert((!std::is_base_of<std::output_iterator_tag,
diff --git a/test/std/iterators/iterator.range/begin-end.pass.cpp b/test/std/iterators/iterator.range/begin-end.pass.cpp
index bd7e0aa90fbc..ec3f61789b27 100644
--- a/test/std/iterators/iterator.range/begin-end.pass.cpp
+++ b/test/std/iterators/iterator.range/begin-end.pass.cpp
@@ -15,7 +15,9 @@
// template <class E> reverse_iterator<const E*> rbegin(initializer_list<E> il);
// template <class E> reverse_iterator<const E*> rend(initializer_list<E> il);
-#if __cplusplus >= 201103L
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
#include <iterator>
#include <cassert>
#include <vector>
@@ -81,7 +83,7 @@ void test_container( C & c, typename C::value_type val ) {
assert ( std::crend(c) == c.crend());
#endif
}
-
+
template<typename T>
void test_container( std::initializer_list<T> & c, T val ) {
assert ( std::begin(c) == c.begin());
@@ -121,7 +123,7 @@ int main(){
std::list<int> l; l.push_back(2);
std::array<int, 1> a; a[0] = 3;
std::initializer_list<int> il = { 4 };
-
+
test_container ( v, 1 );
test_container ( l, 2 );
test_container ( a, 3 );
@@ -131,7 +133,7 @@ int main(){
test_const_container ( l, 2 );
test_const_container ( a, 3 );
test_const_container ( il, 4 );
-
+
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
#if _LIBCPP_STD_VER > 11
diff --git a/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp b/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp
index 2611c9a4b0cc..7aa7f3443aa4 100644
--- a/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp
+++ b/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp
@@ -21,7 +21,7 @@
// typedef Cont container_type;
// typedef void value_type;
// typedef void difference_type;
-// typedef back_insert_iterator<Cont>& reference;
+// typedef void reference;
// typedef void pointer;
// };
@@ -48,7 +48,7 @@ test()
static_assert((std::is_same<typename R::container_type, C>::value), "");
static_assert((std::is_same<typename R::value_type, void>::value), "");
static_assert((std::is_same<typename R::difference_type, void>::value), "");
- static_assert((std::is_same<typename R::reference, R&>::value), "");
+ static_assert((std::is_same<typename R::reference, void>::value), "");
static_assert((std::is_same<typename R::pointer, void>::value), "");
static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
}
diff --git a/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp b/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp
index 755133a91948..7a7c678edaaf 100644
--- a/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp
+++ b/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp
@@ -21,7 +21,7 @@
// typedef Container container_type;
// typedef void value_type;
// typedef void difference_type;
-// typedef front_insert_iterator<Cont>& reference;
+// typedef void reference;
// typedef void pointer;
// typedef output_iterator_tag iterator_category;
// };
@@ -49,7 +49,7 @@ test()
static_assert((std::is_same<typename R::container_type, C>::value), "");
static_assert((std::is_same<typename R::value_type, void>::value), "");
static_assert((std::is_same<typename R::difference_type, void>::value), "");
- static_assert((std::is_same<typename R::reference, R&>::value), "");
+ static_assert((std::is_same<typename R::reference, void>::value), "");
static_assert((std::is_same<typename R::pointer, void>::value), "");
static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
}
diff --git a/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp b/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp
index cf63df63e89b..5b61a3895132 100644
--- a/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp
+++ b/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp
@@ -22,7 +22,7 @@
// typedef Cont container_type;
// typedef void value_type;
// typedef void difference_type;
-// typedef insert_iterator<Cont>& reference;
+// typedef void reference;
// typedef void pointer;
// };
@@ -53,7 +53,7 @@ test()
static_assert((std::is_same<typename R::container_type, C>::value), "");
static_assert((std::is_same<typename R::value_type, void>::value), "");
static_assert((std::is_same<typename R::difference_type, void>::value), "");
- static_assert((std::is_same<typename R::reference, R&>::value), "");
+ static_assert((std::is_same<typename R::reference, void>::value), "");
static_assert((std::is_same<typename R::pointer, void>::value), "");
static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
index 9bdf7215e9ee..a6d4d61e13ce 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
@@ -18,7 +18,7 @@
// public:
// typedef Iter iterator_type;
// typedef Iter::difference_type difference_type;
-// typedef Iterator pointer;
+// typedef Iter pointer;
// typedef Iter::value_type value_type;
// typedef value_type&& reference;
// };
@@ -26,8 +26,18 @@
#include <iterator>
#include <type_traits>
+#include "test_macros.h"
#include "test_iterators.h"
+template <class ValueType, class Reference>
+struct DummyIt {
+ typedef std::forward_iterator_tag iterator_category;
+ typedef ValueType value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef ValueType* pointer;
+ typedef Reference reference;
+};
+
template <class It>
void
test()
@@ -36,9 +46,9 @@ test()
typedef std::iterator_traits<It> T;
static_assert((std::is_same<typename R::iterator_type, It>::value), "");
static_assert((std::is_same<typename R::difference_type, typename T::difference_type>::value), "");
- static_assert((std::is_same<typename R::pointer, typename T::pointer>::value), "");
+ static_assert((std::is_same<typename R::pointer, It>::value), "");
static_assert((std::is_same<typename R::value_type, typename T::value_type>::value), "");
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
static_assert((std::is_same<typename R::reference, typename R::value_type&&>::value), "");
#else
static_assert((std::is_same<typename R::reference, typename T::reference>::value), "");
@@ -53,4 +63,33 @@ int main()
test<bidirectional_iterator<char*> >();
test<random_access_iterator<char*> >();
test<char*>();
+#if TEST_STD_VER >= 11
+ {
+ typedef DummyIt<int, int> T;
+ typedef std::move_iterator<T> It;
+ static_assert(std::is_same<It::reference, int>::value, "");
+ }
+ {
+ typedef DummyIt<int, std::reference_wrapper<int> > T;
+ typedef std::move_iterator<T> It;
+ static_assert(std::is_same<It::reference, std::reference_wrapper<int> >::value, "");
+ }
+ {
+ // Check that move_iterator uses whatever reference type it's given
+ // when it's not a reference.
+ typedef DummyIt<int, long > T;
+ typedef std::move_iterator<T> It;
+ static_assert(std::is_same<It::reference, long>::value, "");
+ }
+ {
+ typedef DummyIt<int, int&> T;
+ typedef std::move_iterator<T> It;
+ static_assert(std::is_same<It::reference, int&&>::value, "");
+ }
+ {
+ typedef DummyIt<int, int&&> T;
+ typedef std::move_iterator<T> It;
+ static_assert(std::is_same<It::reference, int&&>::value, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp
index 98b7331cd386..7ec287e5cd37 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <iterator>
// reverse_iterator
@@ -19,8 +20,6 @@
#include "test_iterators.h"
-#if _LIBCPP_STD_VER > 11
-
template <class It>
void
test(It i)
@@ -37,6 +36,4 @@ int main()
while ( b != e )
test ( b++ );
}
-#else
-int main () {}
-#endif
+
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
index efbdf1406c96..404e8fbf19bf 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
@@ -63,13 +63,13 @@ int main()
{
A a;
test(&a+1, A());
-
+
{
std::list<B> l;
l.push_back(B(0));
l.push_back(B(1));
l.push_back(B(2));
-
+
{
std::list<B>::const_iterator i = l.begin();
assert ( i->get() == 0 ); ++i;
@@ -77,7 +77,7 @@ int main()
assert ( i->get() == 2 ); ++i;
assert ( i == l.end ());
}
-
+
{
std::list<B>::const_reverse_iterator ri = l.rbegin();
assert ( ri->get() == 2 ); ++ri;
diff --git a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.fail.cpp b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.fail.cpp
index 5e6cc5455998..452049677c75 100644
--- a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.fail.cpp
+++ b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.fail.cpp
@@ -16,11 +16,13 @@
#include <iterator>
#include <cassert>
-struct S { S(); }; // not constexpr
+#include "test_macros.h"
+
+struct S { S(); }; // not constexpr
int main()
{
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
constexpr std::istream_iterator<S> it;
}
diff --git a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp
index bea07ec2272e..c1924e4b9272 100644
--- a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp
+++ b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp
@@ -16,15 +16,17 @@
#include <iterator>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
typedef std::istream_iterator<int> T;
T it;
assert(it == T());
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
constexpr T it2;
#endif
}
-
+
}
diff --git a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/arrow.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/arrow.pass.cpp
index 5c4ddcad32ea..30057a227c99 100644
--- a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/arrow.pass.cpp
+++ b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/arrow.pass.cpp
@@ -23,6 +23,8 @@ struct A
int i_;
};
+void operator&(A const&) {}
+
std::istream& operator>>(std::istream& is, A& a)
{
return is >> a.d_ >> a.i_;
diff --git a/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp
index 85a70a017976..1250e364d35e 100644
--- a/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp
+++ b/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp
@@ -9,6 +9,9 @@
// <iterator>
+// Test fails due to use of is_trivially_* trait.
+// XFAIL: gcc-4.9
+
// template <class T, class charT = char, class traits = char_traits<charT>,
// class Distance = ptrdiff_t>
// class istream_iterator
diff --git a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp
index 46ac390d931f..74aa6f2ab517 100644
--- a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp
+++ b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp
@@ -13,20 +13,22 @@
//
// istreambuf_iterator() throw();
//
-// All specializations of istreambuf_iterator shall have a trivial copy constructor,
+// All specializations of istreambuf_iterator shall have a trivial copy constructor,
// a constexpr default constructor and a trivial destructor.
#include <iterator>
#include <sstream>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
typedef std::istreambuf_iterator<char> T;
T it;
assert(it == T());
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
constexpr T it2;
#endif
}
@@ -34,7 +36,7 @@ int main()
typedef std::istreambuf_iterator<wchar_t> T;
T it;
assert(it == T());
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
constexpr T it2;
#endif
}
diff --git a/test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp b/test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp
index 2ad927cf952c..c974e2cd091d 100644
--- a/test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp
+++ b/test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp
@@ -9,6 +9,9 @@
// <iterator>
+// Test fails due to use of is_trivially_* trait.
+// XFAIL: gcc-4.9
+
// template<class charT, class traits = char_traits<charT> >
// class istreambuf_iterator
// : public iterator<input_iterator_tag, charT,
@@ -23,19 +26,23 @@
// typedef basic_istream<charT,traits> istream_type;
// ...
//
-// All specializations of istreambuf_iterator shall have a trivial copy constructor,
+// All specializations of istreambuf_iterator shall have a trivial copy constructor,
// a constexpr default constructor and a trivial destructor.
#include <iterator>
#include <string>
#include <type_traits>
+#include "test_macros.h"
+
int main()
{
typedef std::istreambuf_iterator<char> I1;
- static_assert((std::is_convertible<I1,
- std::iterator<std::input_iterator_tag, char, std::char_traits<char>::off_type,
- char*, char> >::value), "");
+ static_assert((std::is_same<I1::iterator_category, std::input_iterator_tag>::value), "");
+ static_assert((std::is_same<I1::value_type, char>::value), "");
+ static_assert((std::is_same<I1::difference_type, std::char_traits<char>::off_type>::value), "");
+ LIBCPP_STATIC_ASSERT((std::is_same<I1::pointer, char*>::value), "");
+ static_assert((std::is_same<I1::reference, char>::value), "");
static_assert((std::is_same<I1::char_type, char>::value), "");
static_assert((std::is_same<I1::traits_type, std::char_traits<char> >::value), "");
static_assert((std::is_same<I1::int_type, I1::traits_type::int_type>::value), "");
@@ -46,9 +53,11 @@ int main()
static_assert((std::is_trivially_destructible<I1>::value), "" );
typedef std::istreambuf_iterator<wchar_t> I2;
- static_assert((std::is_convertible<I2,
- std::iterator<std::input_iterator_tag, wchar_t, std::char_traits<wchar_t>::off_type,
- wchar_t*, wchar_t> >::value), "");
+ static_assert((std::is_same<I2::iterator_category, std::input_iterator_tag>::value), "");
+ static_assert((std::is_same<I2::value_type, wchar_t>::value), "");
+ static_assert((std::is_same<I2::difference_type, std::char_traits<wchar_t>::off_type>::value), "");
+ LIBCPP_STATIC_ASSERT((std::is_same<I2::pointer, wchar_t*>::value), "");
+ static_assert((std::is_same<I2::reference, wchar_t>::value), "");
static_assert((std::is_same<I2::char_type, wchar_t>::value), "");
static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), "");
static_assert((std::is_same<I2::int_type, I2::traits_type::int_type>::value), "");
diff --git a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp
index 321cfbdb82c8..6366355cc108 100644
--- a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp
+++ b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp
@@ -17,9 +17,23 @@
#include <sstream>
#include <cassert>
+struct MyTraits : std::char_traits<char> {};
+
+typedef std::basic_ostringstream<char, MyTraits> StringStream;
+typedef std::basic_ostream<char, MyTraits> BasicStream;
+
+void operator&(BasicStream const&) {}
+
int main()
{
- std::ostringstream outf;
- std::ostream_iterator<int> i(outf);
- assert(outf.good());
+ {
+ std::ostringstream outf;
+ std::ostream_iterator<int> i(outf);
+ assert(outf.good());
+ }
+ {
+ StringStream outf;
+ std::ostream_iterator<int, char, MyTraits> i(outf);
+ assert(outf.good());
+ }
}
diff --git a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delim.pass.cpp
index 8e5c771a4ab4..69c2dfc9b5f2 100644
--- a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp
+++ b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delim.pass.cpp
@@ -17,6 +17,14 @@
#include <sstream>
#include <cassert>
+
+struct MyTraits : std::char_traits<char> {};
+
+typedef std::basic_ostringstream<char, MyTraits> StringStream;
+typedef std::basic_ostream<char, MyTraits> BasicStream;
+
+void operator&(BasicStream const&) {}
+
int main()
{
{
@@ -29,4 +37,9 @@ int main()
std::ostream_iterator<double, wchar_t> i(outf, L", ");
assert(outf.good());
}
+ {
+ StringStream outf;
+ std::ostream_iterator<int, char, MyTraits> i(outf, ", ");
+ assert(outf.good());
+ }
}
diff --git a/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp b/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp
index 23cf8b66bcb1..20ae6e620753 100644
--- a/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp
+++ b/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp
@@ -172,8 +172,8 @@ int main()
// INTN_MIN
static_assert(INT8_MIN == -128, "INT8_MIN == -128");
static_assert(INT16_MIN == -32768, "INT16_MIN == -32768");
- static_assert(INT32_MIN == -2147483648U, "INT32_MIN == -2147483648");
- static_assert(INT64_MIN == -9223372036854775808ULL, "INT64_MIN == -9223372036854775808LL");
+ static_assert(INT32_MIN == -2147483647 - 1, "INT32_MIN == -2147483648");
+ static_assert(INT64_MIN == -9223372036854775807LL - 1, "INT64_MIN == -9223372036854775808LL");
// INTN_MAX
static_assert(INT8_MAX == 127, "INT8_MAX == 127");
@@ -190,8 +190,8 @@ int main()
// INT_FASTN_MIN
static_assert(INT_FAST8_MIN <= -128, "INT_FAST8_MIN <= -128");
static_assert(INT_FAST16_MIN <= -32768, "INT_FAST16_MIN <= -32768");
- static_assert(INT_FAST32_MIN <= -2147483648U, "INT_FAST32_MIN <= -2147483648");
- static_assert(INT_FAST64_MIN <= -9223372036854775808ULL, "INT_FAST64_MIN <= -9223372036854775808LL");
+ static_assert(INT_FAST32_MIN <= -2147483647 - 1, "INT_FAST32_MIN <= -2147483648");
+ static_assert(INT_FAST64_MIN <= -9223372036854775807LL - 1, "INT_FAST64_MIN <= -9223372036854775808LL");
// INT_FASTN_MAX
static_assert(INT_FAST8_MAX >= 127, "INT_FAST8_MAX >= 127");
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
index 105c7a93f210..5887bb0bdf30 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
@@ -11,6 +11,10 @@
// UNSUPPORTED: sanitizer-new-delete
+// TODO Investigate why UBSAN prevents new from calling our replacement.
+// XFAIL: ubsan
+
+
#include <new>
#include <cstddef>
#include <cstdlib>
@@ -22,7 +26,9 @@ int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
- return std::malloc(s);
+ void* ret = std::malloc(s);
+ if (!ret) std::abort(); // placate MSVC's unchecked malloc warning
+ return ret;
}
void operator delete(void* p) throw()
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
index 92bd7b952dcb..1e78ea8fe267 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
@@ -11,6 +11,10 @@
// UNSUPPORTED: sanitizer-new-delete
+// TODO Investigate why UBSAN prevents new from calling our replacement.
+// XFAIL: ubsan
+
+
#include <new>
#include <cstddef>
#include <cstdlib>
@@ -22,7 +26,9 @@ volatile int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
- return std::malloc(s);
+ void* ret = std::malloc(s);
+ if (!ret) std::abort(); // placate MSVC's unchecked malloc warning
+ return ret;
}
void operator delete(void* p) throw()
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp
index 1ab52ae4c8df..462d1973c507 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp
@@ -22,9 +22,13 @@ struct A
int main()
{
- char buf[3*sizeof(A)];
+ const std::size_t Size = 3;
+ // placement new might require additional space.
+ const std::size_t ExtraSize = 64;
+ char buf[Size*sizeof(A) + ExtraSize];
- A* ap = new(buf) A[3];
- assert((char*)ap == buf);
- assert(A_constructed == 3);
+ A* ap = new(buf) A[Size];
+ assert((char*)ap >= buf);
+ assert((char*)ap < (buf + ExtraSize));
+ assert(A_constructed == Size);
}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
index 57ce28752208..892842a1b9f4 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
+
// test operator new
// asan and msan will not call the new handler.
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
index cd70f90948d2..eb8319bac2f7 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
@@ -11,6 +11,9 @@
// UNSUPPORTED: sanitizer-new-delete
+// TODO Investigate why UBSAN prevents nothrow new from calling our replacement.
+// XFAIL: ubsan
+
#include <new>
#include <cstddef>
#include <cstdlib>
@@ -22,7 +25,9 @@ int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
- return std::malloc(s);
+ void* ret = std::malloc(s);
+ if (!ret) std::abort(); // placate MSVC's unchecked malloc warning
+ return ret;
}
void operator delete(void* p) throw()
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
index 0df3a93703d2..6056ed7bb0b3 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
@@ -22,7 +22,9 @@ int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
- return std::malloc(s);
+ void* ret = std::malloc(s);
+ if (!ret) std::abort(); // placate MSVC's unchecked malloc warning
+ return ret;
}
void operator delete(void* p) throw()
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp
index 5c4eba53d3e4..f656d1cd712a 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp
@@ -13,6 +13,10 @@
// UNSUPPORTED: sanitizer-new-delete
+// TODO Investigate why UBSAN prevents new from calling our replacement.
+// XFAIL: ubsan
+
+
#include <new>
#include <cstddef>
#include <cstdlib>
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
index da43d4969174..24d33e210f57 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
@@ -14,6 +14,9 @@
// UNSUPPORTED: sanitizer-new-delete
+// TODO Investigate why UBSAN prevents new from calling our replacement.
+// XFAIL: ubsan
+
// NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation.
// REQUIRES: fsized-deallocation
diff --git a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
index a8b6e15feab8..4ee95fdf3001 100644
--- a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
@@ -76,9 +76,9 @@ int main()
std::rethrow_if_nested(a);
assert(false);
}
- catch (const B& b)
+ catch (const B& b2)
{
- assert(b == B(5));
+ assert(b2 == B(5));
}
}
}
diff --git a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
index 98006bb1e3a0..c14cb69bdea3 100644
--- a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
@@ -18,6 +18,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
class A
{
int data_;
@@ -37,7 +39,7 @@ public:
friend bool operator==(const B& x, const B& y) {return x.data_ == y.data_;}
};
-#if __cplusplus > 201103L
+#if TEST_STD_VER > 11
struct Final final {};
#endif
@@ -105,14 +107,14 @@ int main()
assert(i == 7);
}
}
-#if __cplusplus > 201103L
+#if TEST_STD_VER > 11
{
try
{
std::throw_with_nested(Final());
assert(false);
}
- catch (const Final &f)
+ catch (const Final &)
{
}
}
diff --git a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
index 09adf580bddf..7bf1df457dbe 100644
--- a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
+++ b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
@@ -74,7 +74,7 @@ int main()
throw A();
assert(false);
}
- catch (A& a)
+ catch (A&)
{
std::exception_ptr p = std::current_exception();
assert(A::constructed == 1);
@@ -94,7 +94,7 @@ int main()
throw A();
assert(false);
}
- catch (A a)
+ catch (A)
{
std::exception_ptr p = std::current_exception();
assert(A::constructed == 2);
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp
index bbead15da64f..50cfc4674251 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp
@@ -178,13 +178,13 @@ int main()
TEST_NUMERIC_LIMITS(const float)
TEST_NUMERIC_LIMITS(volatile float)
TEST_NUMERIC_LIMITS(const volatile float)
-
+
// double
TEST_NUMERIC_LIMITS(double)
TEST_NUMERIC_LIMITS(const double)
TEST_NUMERIC_LIMITS(volatile double)
TEST_NUMERIC_LIMITS(const volatile double)
-
+
// long double
TEST_NUMERIC_LIMITS(long double)
TEST_NUMERIC_LIMITS(const long double)
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp
index a452d4e9949d..8deb28d3fd9c 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp
@@ -12,6 +12,7 @@
// denorm_min()
#include <limits>
+#include <cfloat>
#include <cassert>
template <class T>
@@ -47,7 +48,17 @@ int main()
test<__int128_t>(0);
test<__uint128_t>(0);
#endif
+#if defined(__FLT_DENORM_MIN__) // guarded because these macros are extensions.
test<float>(__FLT_DENORM_MIN__);
test<double>(__DBL_DENORM_MIN__);
test<long double>(__LDBL_DENORM_MIN__);
+#endif
+#if defined(FLT_TRUE_MIN) // not currently provided on linux.
+ test<float>(FLT_TRUE_MIN);
+ test<double>(DBL_TRUE_MIN);
+ test<long double>(LDBL_TRUE_MIN);
+#endif
+#if !defined(__FLT_DENORM_MIN__) && !defined(FLT_TRUE_MIN)
+#error Test has no expected values for floating point types
+#endif
}
diff --git a/test/std/language.support/support.runtime/csetjmp.pass.cpp b/test/std/language.support/support.runtime/csetjmp.pass.cpp
index dc034ce099e2..f5060305608d 100644
--- a/test/std/language.support/support.runtime/csetjmp.pass.cpp
+++ b/test/std/language.support/support.runtime/csetjmp.pass.cpp
@@ -19,6 +19,7 @@
int main()
{
std::jmp_buf jb;
+ ((void)jb); // Prevent unused warning
static_assert((std::is_same<decltype(std::longjmp(jb, 0)), void>::value),
"std::is_same<decltype(std::longjmp(jb, 0)), void>::value");
}
diff --git a/test/std/language.support/support.runtime/cstdarg.pass.cpp b/test/std/language.support/support.runtime/cstdarg.pass.cpp
index 9d6f610a943e..e7282b1c555e 100644
--- a/test/std/language.support/support.runtime/cstdarg.pass.cpp
+++ b/test/std/language.support/support.runtime/cstdarg.pass.cpp
@@ -11,11 +11,13 @@
#include <cstdarg>
+#include "test_macros.h"
+
#ifndef va_arg
#error va_arg not defined
#endif
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
# ifndef va_copy
# error va_copy is not defined when c++ >= 11
# endif
diff --git a/test/std/language.support/support.runtime/ctime.pass.cpp b/test/std/language.support/support.runtime/ctime.pass.cpp
index 03a0aa4d6966..34343b247f21 100644
--- a/test/std/language.support/support.runtime/ctime.pass.cpp
+++ b/test/std/language.support/support.runtime/ctime.pass.cpp
@@ -23,10 +23,13 @@
int main()
{
std::clock_t c = 0;
- ((void)c);
std::size_t s = 0;
std::time_t t = 0;
- std::tm tm = {0};
+ std::tm tm = {};
+ ((void)c); // Prevent unused warning
+ ((void)s); // Prevent unused warning
+ ((void)t); // Prevent unused warning
+ ((void)tm); // Prevent unused warning
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), "");
@@ -39,5 +42,7 @@ int main()
#endif
char* c1 = 0;
const char* c2 = 0;
+ ((void)c1); // Prevent unused warning
+ ((void)c2); // Prevent unused warning
static_assert((std::is_same<decltype(std::strftime(c1,s,c2,&tm)), std::size_t>::value), "");
}
diff --git a/test/std/language.support/support.types/nullptr_t.pass.cpp b/test/std/language.support/support.types/nullptr_t.pass.cpp
index 1cc2aa62032e..ca5170f649ed 100644
--- a/test/std/language.support/support.types/nullptr_t.pass.cpp
+++ b/test/std/language.support/support.types/nullptr_t.pass.cpp
@@ -57,10 +57,14 @@ void test_comparisons()
#pragma clang diagnostic ignored "-Wnull-conversion"
#endif
void test_nullptr_conversions() {
+// GCC does not accept this due to CWG Defect #1423
+// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1423
+#if defined(__clang__)
{
bool b = nullptr;
assert(!b);
}
+#endif
{
bool b(nullptr);
assert(!b);
diff --git a/test/std/language.support/support.types/offsetof.pass.cpp b/test/std/language.support/support.types/offsetof.pass.cpp
index e36ac22974ff..d479f9ca44fa 100644
--- a/test/std/language.support/support.types/offsetof.pass.cpp
+++ b/test/std/language.support/support.types/offsetof.pass.cpp
@@ -7,8 +7,12 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
#include <cstddef>
+#include "test_macros.h"
+
#ifndef offsetof
#error offsetof not defined
#endif
@@ -20,7 +24,5 @@ struct A
int main()
{
-#if (__has_feature(cxx_noexcept))
static_assert(noexcept(offsetof(A, x)), "");
-#endif
}
diff --git a/test/std/localization/c.locales/clocale.pass.cpp b/test/std/localization/c.locales/clocale.pass.cpp
index a90725bfa367..534213495cd9 100644
--- a/test/std/localization/c.locales/clocale.pass.cpp
+++ b/test/std/localization/c.locales/clocale.pass.cpp
@@ -47,6 +47,7 @@
int main()
{
std::lconv lc;
+ ((void)lc); // Prevent unused warning
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
static_assert((std::is_same<decltype(std::setlocale(0, "")), char*>::value), "");
#endif
diff --git a/test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp b/test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
index 09009ceaaae2..dfbdeaea954b 100644
--- a/test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
+++ b/test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
@@ -53,23 +53,6 @@ int main()
}
}
{
- std::locale l("");
- {
- const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
- std::string s2("aaaaaaA");
- std::string s3("BaaaaaA");
- assert(f.compare(s2.data(), s2.data() + s2.size(),
- s3.data(), s3.data() + s3.size()) == 1);
- }
- {
- const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
- std::wstring s2(L"aaaaaaA");
- std::wstring s3(L"BaaaaaA");
- assert(f.compare(s2.data(), s2.data() + s2.size(),
- s3.data(), s3.data() + s3.size()) == 1);
- }
- }
- {
std::locale l("C");
{
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
diff --git a/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp b/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
index d31705e5ad1b..b39e9ad74dc4 100644
--- a/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
+++ b/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
@@ -25,8 +25,6 @@
int main()
{
- // Ensure that the default locale is not C. If it is, the second tests will fail.
- putenv(const_cast<char*>("LC_ALL=" LOCALE_en_US_UTF_8));
{
std::locale l(LOCALE_en_US_UTF_8);
{
@@ -41,19 +39,6 @@ int main()
}
}
{
- std::locale l("");
- {
- std::string x("1234");
- const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
- assert(f.transform(x.data(), x.data() + x.size()) != x);
- }
- {
- std::wstring x(L"1234");
- const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
- assert(f.transform(x.data(), x.data() + x.size()) != x);
- }
- }
- {
std::locale l("C");
{
std::string x("1234");
diff --git a/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp b/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp
index b5690e3c6b26..f7b0e5b71567 100644
--- a/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp
@@ -30,7 +30,7 @@ int main()
for ( size_t i = 0; i < 128; ++i ) // values above 128 are not consistent
{
mask set = 0;
-
+
if ( i < 32 || i > 126 ) set |= F::cntrl;
if ( i >= 32 && i <= 126 ) set |= F::print;
@@ -51,9 +51,9 @@ int main()
if ( i >= 58 && i <= 64 ) set |= F::punct; // ':' .. '@'
if ( i >= 91 && i <= 96 ) set |= F::punct; // '[' .. '`'
if ( i >= 123 && i <= 126 ) set |= F::punct; // '{' .. '~' }
-
+
assert(( p[i] & set) == set); // all the right bits set
assert(((p[i] & ~set) & defined) == 0); // no extra ones
}
-
+
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
index fdfab5769043..0e9909720c0b 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
@@ -45,19 +45,6 @@ int main()
}
}
{
- std::locale l("");
- {
- assert(std::has_facet<std::ctype_byname<char> >(l));
- assert(&std::use_facet<std::ctype<char> >(l)
- == &std::use_facet<std::ctype_byname<char> >(l));
- }
- {
- assert(std::has_facet<std::ctype_byname<wchar_t> >(l));
- assert(&std::use_facet<std::ctype<wchar_t> >(l)
- == &std::use_facet<std::ctype_byname<wchar_t> >(l));
- }
- }
- {
std::locale l("C");
{
assert(std::has_facet<std::ctype_byname<char> >(l));
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/money_base.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/money_base.pass.cpp
index beabe0cae660..a0c17dcae7d0 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/money_base.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/money_base.pass.cpp
@@ -21,13 +21,13 @@
int main()
{
- std::money_base mb;
- assert(mb.none == 0);
- assert(mb.space == 1);
- assert(mb.symbol == 2);
- assert(mb.sign == 3);
- assert(mb.value == 4);
- assert(sizeof(std::money_base::pattern) == 4);
+ std::money_base mb; ((void)mb);
+ static_assert(std::money_base::none == 0, "");
+ static_assert(std::money_base::space == 1, "");
+ static_assert(std::money_base::symbol == 2, "");
+ static_assert(std::money_base::sign == 3, "");
+ static_assert(std::money_base::value == 4, "");
+ static_assert(sizeof(std::money_base::pattern) == 4, "");
std::money_base::pattern p;
p.field[0] = std::money_base::none;
}
diff --git a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
index a54b37314e87..596f8f80f04e 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
@@ -13,6 +13,9 @@
// iter_type put(iter_type s, ios_base& iob, char_type fill, double v) const;
+// TODO(EricWF): This test takes 40+ minutes to build with Clang 3.8 under ASAN or MSAN.
+// UNSUPPORTED: asan, msan
+
#include <locale>
#include <ios>
#include <cassert>
diff --git a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
index 935961257ef2..cf9339341abb 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
@@ -13,6 +13,9 @@
// iter_type put(iter_type s, ios_base& iob, char_type fill, long double v) const;
+// TODO(EricWF): This test takes 40+ minutes to build with Clang 3.8 under ASAN or MSAN.
+// UNSUPPORTED: asan, msan
+
// TODO GLIBC uses a different string for positive and negative NAN numbers.
// XFAIL: linux-gnu
@@ -24412,14 +24415,14 @@ void test11()
void test12()
{
- char str[200];
output_iterator<char*> iter;
std::locale lc = std::locale::classic();
std::locale lg(lc, new my_numpunct);
#ifdef __APPLE__
// This test is failing on FreeBSD, possibly due to different representations
-// of the floating point numbers.
+// of the floating point numbers.
const my_facet f(1);
+ char str[200];
{
long double v = 1234567890.125;
std::ios ios(0);
@@ -26218,7 +26221,6 @@ int main()
test10();
test11();
test12();
- char str[200];
output_iterator<char*> iter;
std::locale lc = std::locale::classic();
std::locale lg(lc, new my_numpunct);
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
index f5c7c1277c31..6d7f506bb2d4 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
@@ -207,6 +207,30 @@ int main()
assert(err == ios.goodbit);
assert(v == 2);
}
+ {
+ v = -1;
+ const char str[] = "1.79779e+309"; // unrepresentable
+ std::ios_base::iostate err = ios.goodbit;
+ input_iterator<const char*> iter =
+ f.get(input_iterator<const char*>(str),
+ input_iterator<const char*>(str+sizeof(str)),
+ ios, err, v);
+ assert(iter.base() == str+sizeof(str)-1);
+ assert(err == ios.failbit);
+ assert(v == HUGE_VAL);
+ }
+ {
+ v = -1;
+ const char str[] = "-1.79779e+308"; // unrepresentable
+ std::ios_base::iostate err = ios.goodbit;
+ input_iterator<const char*> iter =
+ f.get(input_iterator<const char*>(str),
+ input_iterator<const char*>(str+sizeof(str)),
+ ios, err, v);
+ assert(iter.base() == str+sizeof(str)-1);
+ assert(err == ios.failbit);
+ assert(v == -HUGE_VAL);
+ }
ios.imbue(std::locale(std::locale(), new my_numpunct));
{
v = -1;
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
index 9138894784ed..d01f63d5920d 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
@@ -32,6 +32,7 @@ public:
: F(refs) {}
};
+
int main()
{
const my_facet f(1);
@@ -168,4 +169,29 @@ int main()
assert(err == ios.goodbit);
assert(std::isnan(v));
}
+ {
+ v = -1;
+ const char str[] = "3.40283e+39"; // unrepresentable
+ std::ios_base::iostate err = ios.goodbit;
+ input_iterator<const char*> iter =
+ f.get(input_iterator<const char*>(str),
+ input_iterator<const char*>(str+sizeof(str)),
+ ios, err, v);
+ assert(iter.base() == str+sizeof(str)-1);
+ assert(err == ios.failbit);
+ assert(v == HUGE_VALF);
+ }
+ {
+ v = -1;
+ const char str[] = "-3.40283e+38"; // unrepresentable
+ std::ios_base::iostate err = ios.goodbit;
+ input_iterator<const char*> iter =
+ f.get(input_iterator<const char*>(str),
+ input_iterator<const char*>(str+sizeof(str)),
+ ios, err, v);
+ assert(iter.base() == str+sizeof(str)-1);
+ assert(err == ios.failbit);
+ assert(v == -HUGE_VALF);
+
+ }
}
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp
index 8e89ebc470cf..b79650b0199b 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp
@@ -32,6 +32,7 @@ public:
: F(refs) {}
};
+
int main()
{
const my_facet f(1);
@@ -228,4 +229,28 @@ int main()
assert(err != ios.failbit);
assert(v == 304888344611713860501504000000.0L);
}
+ {
+ v = -1;
+ const char str[] = "1.19973e+4933"; // unrepresentable
+ std::ios_base::iostate err = ios.goodbit;
+ input_iterator<const char*> iter =
+ f.get(input_iterator<const char*>(str),
+ input_iterator<const char*>(str+sizeof(str)),
+ ios, err, v);
+ assert(iter.base() == str+sizeof(str)-1);
+ assert(err == ios.failbit);
+ assert(v == HUGE_VALL);
+ }
+ {
+ v = -1;
+ const char str[] = "-1.18974e+4932"; // unrepresentable
+ std::ios_base::iostate err = ios.goodbit;
+ input_iterator<const char*> iter =
+ f.get(input_iterator<const char*>(str),
+ input_iterator<const char*>(str+sizeof(str)),
+ ios, err, v);
+ assert(iter.base() == str+sizeof(str)-1);
+ assert(err == ios.failbit);
+ assert(v == -HUGE_VALL);
+ }
}
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp
index e474eca2f5b2..6ba5a89e61e4 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp
@@ -25,14 +25,14 @@ void check_limits()
assert(miniss << minv);
assert(maxiss << maxv);
std::string mins = miniss.str();
- std::string maxs = maxiss.str();
+ std::string maxs = maxiss.str();
istringstream maxoss(maxs), minoss(mins);
T new_minv, new_maxv;
assert(maxoss >> new_maxv);
assert(minoss >> new_minv);
-
+
assert(new_minv == minv);
assert(new_maxv == maxv);
@@ -40,11 +40,11 @@ void check_limits()
mins = "-1";
else
mins[mins.size() - 1]++;
-
+
maxs[maxs.size() - 1]++;
istringstream maxoss2(maxs), minoss2(mins);
-
+
assert(! (maxoss2 >> new_maxv));
assert(! (minoss2 >> new_minv));
}
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
index 7ad431652a89..931ab5d40964 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
@@ -9,15 +9,8 @@
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
-// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
-// NOTE: debian and opensuse use old locale data for ru_RU.UTF-8 abbreviated
-// months. This locale data was changed in glibc 2.14.
-// Debian uses glibc 2.13 as of 20/11/2014
-// OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014
-// XFAIL: debian, opensuse
-
// <locale>
// class time_get_byname<charT, InputIterator>
@@ -70,16 +63,6 @@ int main()
assert(err == std::ios_base::eofbit);
}
{
- const my_facet f(LOCALE_ru_RU_UTF_8, 1);
- const char in[] = "\xD0\xB8\xD1\x8E\xD0\xBD\xD1\x8F";
- err = std::ios_base::goodbit;
- t = std::tm();
- I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
- assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
- assert(t.tm_mon == 5);
- assert(err == std::ios_base::eofbit);
- }
- {
const my_facet f(LOCALE_zh_CN_UTF_8, 1);
const char in[] = "\xE5\x85\xAD\xE6\x9C\x88";
err = std::ios_base::goodbit;
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
index 631a6de03d82..551f298b0419 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
@@ -9,15 +9,8 @@
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
-// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
-// NOTE: debian and opensuse use bad locale data for ru_RU.UTF-8 abbreviated
-// months. This locale data was fixed in glibc 2.14.
-// Debian uses glibc 2.13 as of 20/11/2014
-// OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014
-// XFAIL: debian, opensuse
-
// <locale>
// class time_get_byname<charT, InputIterator>
@@ -79,16 +72,6 @@ int main()
assert(err == std::ios_base::eofbit);
}
{
- const my_facet f(LOCALE_ru_RU_UTF_8, 1);
- const wchar_t in[] = L"\x438\x44E\x43D\x44F";
- err = std::ios_base::goodbit;
- t = std::tm();
- I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
- assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
- assert(t.tm_mon == 5);
- assert(err == std::ios_base::eofbit);
- }
- {
const my_facet f(LOCALE_zh_CN_UTF_8, 1);
const wchar_t in[] = L"\x516D\x6708";
err = std::ios_base::goodbit;
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
index ae8bce22445a..4a2b3819b507 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
@@ -75,7 +75,7 @@ int main()
}
{
const my_facet f(LOCALE_fr_FR_UTF_8, 1);
- const wchar_t in[] = L"Sam 31 d""\xE9""c 23:55:59 2061";
+ const wchar_t in[] = L"Sam 31 d" L"\xE9" L"c 23:55:59 2061";
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
@@ -105,11 +105,11 @@ int main()
{
const my_facet f("ru_RU", 1);
const wchar_t in[] = L"\x441\x443\x431\x431\x43E\x442\x430"
- ", 31 "
- "\x434\x435\x43A\x430\x431\x440\x44F"
- " 2061 "
- "\x433"
- ". 23:55:59";
+ L", 31 "
+ L"\x434\x435\x43A\x430\x431\x440\x44F"
+ L" 2061 "
+ L"\x433"
+ L". 23:55:59";
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
@@ -140,7 +140,7 @@ int main()
{
const my_facet f("zh_CN", 1);
const wchar_t in[] = L"\x516D"
- " 12/31 23:55:59 2061";
+ L" 12/31 23:55:59 2061";
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
@@ -157,7 +157,7 @@ int main()
#endif
{
const my_facet f(LOCALE_zh_CN_UTF_8, 1);
- const wchar_t in[] = L"23""\x65F6""55""\x5206""59""\x79D2";
+ const wchar_t in[] = L"23" L"\x65F6" L"55" L"\x5206" L"59" L"\x79D2";
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_copy.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_copy.pass.cpp
new file mode 100644
index 000000000000..72e79dfb1e7f
--- /dev/null
+++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// These constructors are still unavailable in C++03, but this test depends
+// on access control SFINAE and fails without it.
+// UNSUPPORTED: c++98, c++03
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// wstring_convert(wstring_convert const&) = delete;
+// wstring_convert& operator=(wstring_convert const&) = delete;
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+ typedef std::codecvt_utf8<wchar_t> Codecvt;
+ typedef std::wstring_convert<Codecvt> Myconv;
+ static_assert(!std::is_copy_constructible<Myconv>::value, "");
+ static_assert(!std::is_copy_assignable<Myconv>::value, "");
+}
diff --git a/test/std/localization/locales/locale/locale.cons/assign.pass.cpp b/test/std/localization/locales/locale/locale.cons/assign.pass.cpp
index 80afe1e46aad..8b31a8f97498 100644
--- a/test/std/localization/locales/locale/locale.cons/assign.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/assign.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// REQUIRES: locale.ru_RU.UTF-8
-// UNSUPPORTED: sanitizer-new-delete
// <locale>
@@ -18,21 +17,10 @@
#include <cassert>
#include <new>
-#include "platform_support.h" // locale name macros
-
-int new_called = 0;
+#include "count_new.hpp"
-void* operator new(std::size_t s) throw(std::bad_alloc)
-{
- ++new_called;
- return std::malloc(s);
-}
+#include "platform_support.h" // locale name macros
-void operator delete(void* p) throw()
-{
- --new_called;
- std::free(p);
-}
void check(const std::locale& loc)
{
@@ -79,5 +67,5 @@ int main()
check(loc);
check(loc2);
}
- assert(new_called == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp b/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
index b808a7650c47..c7021df8f577 100644
--- a/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
@@ -10,7 +10,6 @@
// XFAIL: libcpp-no-exceptions
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
-// UNSUPPORTED: sanitizer-new-delete
// <locale>
@@ -20,21 +19,9 @@
#include <new>
#include <cassert>
+#include "count_new.hpp"
#include "platform_support.h" // locale name macros
-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);
-}
void check(const std::locale& loc)
{
@@ -101,5 +88,5 @@ int main()
}
std::locale ok("");
}
- assert(new_called == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/localization/locales/locale/locale.cons/copy.pass.cpp b/test/std/localization/locales/locale/locale.cons/copy.pass.cpp
index 0760cc46cdd8..9e446e440851 100644
--- a/test/std/localization/locales/locale/locale.cons/copy.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/copy.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// REQUIRES: locale.fr_FR.UTF-8
-// UNSUPPORTED: sanitizer-new-delete
// <locale>
@@ -18,22 +17,9 @@
#include <cassert>
#include <new>
+#include "count_new.hpp"
#include "platform_support.h" // locale name macros
-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);
-}
-
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
@@ -78,5 +64,5 @@ int main()
check(loc);
check(loc2);
}
- assert(new_called == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
index 2a9e20fcf98d..eb381f9a580d 100644
--- a/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
@@ -9,7 +9,6 @@
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.ru_RU.UTF-8
-// UNSUPPORTED: sanitizer-new-delete
// <locale>
@@ -19,22 +18,9 @@
#include <new>
#include <cassert>
+#include "count_new.hpp"
#include "platform_support.h" // locale name macros
-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);
-}
-
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
@@ -78,5 +64,5 @@ int main()
std::locale loc2(loc, LOCALE_en_US_UTF_8, std::locale::monetary);
check(loc2);
}
- assert(new_called == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp
index fb6e39e5742f..1144931e3d2c 100644
--- a/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// REQUIRES: locale.ru_RU.UTF-8
-// UNSUPPORTED: sanitizer-new-delete
// <locale>
@@ -18,21 +17,9 @@
#include <new>
#include <cassert>
+#include "count_new.hpp"
#include "platform_support.h" // locale name macros
-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);
-}
void check(const std::locale& loc)
{
@@ -81,7 +68,6 @@ std::locale::id my_facet::id;
int main()
{
-{
{
std::locale loc(LOCALE_ru_RU_UTF_8);
check(loc);
@@ -91,9 +77,7 @@ int main()
const my_facet& f = std::use_facet<my_facet>(loc2);
assert(f.test() == 5);
}
- assert(new_called == 0);
-}
-{
+ assert(globalMemCounter.checkOutstandingNewEq(0));
{
std::locale loc;
check(loc);
@@ -101,6 +85,5 @@ int main()
check(loc2);
assert(loc == loc2);
}
- assert(new_called == 0);
-}
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
index fa87eb20e9af..f1afff66580e 100644
--- a/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
@@ -9,7 +9,6 @@
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.ru_RU.UTF-8
-// UNSUPPORTED: sanitizer-new-delete
// <locale>
@@ -19,22 +18,9 @@
#include <new>
#include <cassert>
+#include "count_new.hpp"
#include "platform_support.h" // locale name macros
-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);
-}
-
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
@@ -78,5 +64,5 @@ int main()
std::locale loc2(loc, std::locale(LOCALE_en_US_UTF_8), std::locale::monetary);
check(loc2);
}
- assert(new_called == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
index 59fbc59b90da..eb63cd03b663 100644
--- a/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
@@ -6,10 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-
+
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.ru_RU.UTF-8
-// UNSUPPORTED: sanitizer-new-delete
// <locale>
@@ -19,21 +18,9 @@
#include <new>
#include <cassert>
+#include "count_new.hpp"
#include "platform_support.h" // locale name macros
-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);
-}
void check(const std::locale& loc)
{
@@ -78,5 +65,5 @@ int main()
std::locale loc2(loc, std::string(LOCALE_en_US_UTF_8), std::locale::monetary);
check(loc2);
}
- assert(new_called == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/localization/locales/locale/locale.cons/string.pass.cpp b/test/std/localization/locales/locale/locale.cons/string.pass.cpp
index c9f944196e73..6fc0808b2728 100644
--- a/test/std/localization/locales/locale/locale.cons/string.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/string.pass.cpp
@@ -9,7 +9,6 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
-// UNSUPPORTED: sanitizer-new-delete
// <locale>
@@ -19,22 +18,9 @@
#include <new>
#include <cassert>
+#include "count_new.hpp"
#include "platform_support.h" // locale name macros
-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);
-}
-
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
@@ -83,5 +69,5 @@ int main()
assert(!(loc == loc3));
assert(loc != loc3);
}
- assert(new_called == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/localization/locales/locale/locale.types/locale.facet/tested_elsewhere.pass.cpp b/test/std/localization/locales/locale/locale.types/locale.facet/tested_elsewhere.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/localization/locales/locale/locale.types/locale.facet/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/localization/locales/locale/locale.types/locale.id/tested_elsewhere.pass.cpp b/test/std/localization/locales/locale/locale.types/locale.id/tested_elsewhere.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/localization/locales/locale/locale.types/locale.id/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/c.math/cmath.pass.cpp b/test/std/numerics/c.math/cmath.pass.cpp
index 0b0d86288737..7161bd37e3e2 100644
--- a/test/std/numerics/c.math/cmath.pass.cpp
+++ b/test/std/numerics/c.math/cmath.pass.cpp
@@ -9,13 +9,11 @@
// <cmath>
-// NOTE: isinf and isnan are tested separately because they are expected to fail
-// on linux. We don't want their expected failure to hide other failures in this file.
-
#include <cmath>
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
#include "hexfloat.h"
// convertible to int/float/double/etc
@@ -79,6 +77,7 @@ Ambiguous fma(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); }
Ambiguous fmax(Ambiguous, Ambiguous){ return Ambiguous(); }
Ambiguous fmin(Ambiguous, Ambiguous){ return Ambiguous(); }
Ambiguous hypot(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous hypot(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); }
Ambiguous ilogb(Ambiguous){ return Ambiguous(); }
Ambiguous lgamma(Ambiguous){ return Ambiguous(); }
Ambiguous llrint(Ambiguous){ return Ambiguous(); }
@@ -631,6 +630,29 @@ void test_isgreaterequal()
assert(std::isgreaterequal(-1.0, 0.F) == false);
}
+void test_isinf()
+{
+#ifdef isinf
+#error isinf defined
+#endif
+ static_assert((std::is_same<decltype(std::isinf((float)0)), bool>::value), "");
+
+ typedef decltype(std::isinf((double)0)) DoubleRetType;
+#ifndef __linux__
+ static_assert((std::is_same<DoubleRetType, bool>::value), "");
+#else
+ // GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in
+ // all C++ dialects. The test should tolerate this.
+ // See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
+ static_assert((std::is_same<DoubleRetType, bool>::value
+ || std::is_same<DoubleRetType, int>::value), "");
+#endif
+
+ static_assert((std::is_same<decltype(std::isinf(0)), bool>::value), "");
+ static_assert((std::is_same<decltype(std::isinf((long double)0)), bool>::value), "");
+ assert(std::isinf(-1.0) == false);
+}
+
void test_isless()
{
#ifdef isless
@@ -688,6 +710,29 @@ void test_islessgreater()
assert(std::islessgreater(-1.0, 0.F) == true);
}
+void test_isnan()
+{
+#ifdef isnan
+#error isnan defined
+#endif
+ static_assert((std::is_same<decltype(std::isnan((float)0)), bool>::value), "");
+
+ typedef decltype(std::isnan((double)0)) DoubleRetType;
+#ifndef __linux__
+ static_assert((std::is_same<DoubleRetType, bool>::value), "");
+#else
+ // GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in
+ // all C++ dialects. The test should tolerate this.
+ // See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
+ static_assert((std::is_same<DoubleRetType, bool>::value
+ || std::is_same<DoubleRetType, int>::value), "");
+#endif
+
+ static_assert((std::is_same<decltype(std::isnan(0)), bool>::value), "");
+ static_assert((std::is_same<decltype(std::isnan((long double)0)), bool>::value), "");
+ assert(std::isnan(-1.0) == false);
+}
+
void test_isunordered()
{
#ifdef isunordered
@@ -1010,6 +1055,28 @@ void test_hypot()
static_assert((std::is_same<decltype(std::hypot((int)0, (int)0)), double>::value), "");
static_assert((std::is_same<decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(std::hypot(3,4) == 5);
+
+#if TEST_STD_VER > 14
+ static_assert((std::is_same<decltype(std::hypot((float)0, (float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (int)0, (unsigned long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((int)0, (int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+
+ assert(std::hypot(2,3,6) == 7);
+ assert(std::hypot(1,4,8) == 9);
+#endif
}
void test_ilogb()
@@ -1443,9 +1510,11 @@ int main()
test_isnormal();
test_isgreater();
test_isgreaterequal();
+ test_isinf();
test_isless();
test_islessequal();
test_islessgreater();
+ test_isnan();
test_isunordered();
test_acosh();
test_asinh();
diff --git a/test/std/numerics/c.math/cmath_isinf.pass.cpp b/test/std/numerics/c.math/cmath_isinf.pass.cpp
deleted file mode 100644
index 6cde04d9bc86..000000000000
--- a/test/std/numerics/c.math/cmath_isinf.pass.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <cmath>
-
-// isinf
-
-// XFAIL: linux
-
-#include <cmath>
-#include <type_traits>
-#include <cassert>
-
-int main()
-{
-#ifdef isinf
-#error isinf defined
-#endif
- static_assert((std::is_same<decltype(std::isinf((float)0)), bool>::value), "");
- static_assert((std::is_same<decltype(std::isinf((double)0)), bool>::value), "");
- static_assert((std::is_same<decltype(std::isinf(0)), bool>::value), "");
- static_assert((std::is_same<decltype(std::isinf((long double)0)), bool>::value), "");
- assert(std::isinf(-1.0) == false);
-} \ No newline at end of file
diff --git a/test/std/numerics/c.math/cmath_isnan.pass.cpp b/test/std/numerics/c.math/cmath_isnan.pass.cpp
deleted file mode 100644
index 7b33b9647052..000000000000
--- a/test/std/numerics/c.math/cmath_isnan.pass.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <cmath>
-
-// isnan
-
-// XFAIL: linux
-
-#include <cmath>
-#include <type_traits>
-#include <cassert>
-
-int main()
-{
-#ifdef isnan
-#error isnan defined
-#endif
- static_assert((std::is_same<decltype(std::isnan((float)0)), bool>::value), "");
- static_assert((std::is_same<decltype(std::isnan((double)0)), bool>::value), "");
- static_assert((std::is_same<decltype(std::isnan(0)), bool>::value), "");
- static_assert((std::is_same<decltype(std::isnan((long double)0)), bool>::value), "");
- assert(std::isnan(-1.0) == false);
-}
diff --git a/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp b/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
index fcf075a36e1a..f2bf6433ceb4 100644
--- a/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
+++ b/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
@@ -62,6 +62,8 @@ int main()
{
std::fenv_t fenv;
std::fexcept_t fex;
+ ((void)fenv); // Prevent unused warning
+ ((void)fex); // Prevent unused warning
static_assert((std::is_same<decltype(std::feclearexcept(0)), int>::value), "");
static_assert((std::is_same<decltype(std::fegetexceptflag(&fex, 0)), int>::value), "");
static_assert((std::is_same<decltype(std::feraiseexcept(0)), int>::value), "");
diff --git a/test/std/numerics/complex.number/cases.h b/test/std/numerics/complex.number/cases.h
index cd6bd165a9d1..a2f85d11ca4d 100644
--- a/test/std/numerics/complex.number/cases.h
+++ b/test/std/numerics/complex.number/cases.h
@@ -17,7 +17,7 @@
#include <complex>
#include <cassert>
-std::complex<double> x[] =
+const std::complex<double> testcases[] =
{
std::complex<double>( 1.e-6, 1.e-6),
std::complex<double>(-1.e-6, 1.e-6),
diff --git a/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp b/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp
index 30c95c3c88d9..7decea877fbd 100644
--- a/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp
+++ b/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp
@@ -30,7 +30,7 @@ test(typename std::enable_if<std::is_integral<T>::value>::type* = 0)
static_assert(std::imag(val) == 0, "");
constexpr std::complex<T> t{val, val};
static_assert(t.imag() == x, "" );
-#endif
+#endif
}
template <class T, int x>
@@ -44,7 +44,7 @@ test(typename std::enable_if<!std::is_integral<T>::value>::type* = 0)
static_assert(std::imag(val) == 0, "");
constexpr std::complex<T> t{val, val};
static_assert(t.imag() == x, "" );
-#endif
+#endif
}
template <class T>
diff --git a/test/std/numerics/complex.number/cmplx.over/real.pass.cpp b/test/std/numerics/complex.number/cmplx.over/real.pass.cpp
index a5a4a35b13ca..491b35890c0c 100644
--- a/test/std/numerics/complex.number/cmplx.over/real.pass.cpp
+++ b/test/std/numerics/complex.number/cmplx.over/real.pass.cpp
@@ -30,7 +30,7 @@ test(typename std::enable_if<std::is_integral<T>::value>::type* = 0)
static_assert(std::real(val) == val, "");
constexpr std::complex<T> t{val, val};
static_assert(t.real() == x, "" );
-#endif
+#endif
}
template <class T, int x>
@@ -44,7 +44,7 @@ test(typename std::enable_if<!std::is_integral<T>::value>::type* = 0)
static_assert(std::real(val) == val, "");
constexpr std::complex<T> t{val, val};
static_assert(t.real() == x, "" );
-#endif
+#endif
}
template <class T>
diff --git a/test/std/numerics/complex.number/complex.literals/literals.pass.cpp b/test/std/numerics/complex.number/complex.literals/literals.pass.cpp
index 45b59914e7f8..a2e53629f97d 100644
--- a/test/std/numerics/complex.number/complex.literals/literals.pass.cpp
+++ b/test/std/numerics/complex.number/complex.literals/literals.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <chrono>
#include <complex>
@@ -15,7 +16,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std::literals::complex_literals;
// Make sure the types are right
@@ -25,14 +25,14 @@ int main()
static_assert ( std::is_same<decltype( 3i ), std::complex<double>>::value, "" );
static_assert ( std::is_same<decltype( 3.0if ), std::complex<float>>::value, "" );
static_assert ( std::is_same<decltype( 3if ), std::complex<float>>::value, "" );
-
+
{
std::complex<long double> c1 = 3.0il;
assert ( c1 == std::complex<long double>(0, 3.0));
auto c2 = 3il;
assert ( c1 == c2 );
}
-
+
{
std::complex<double> c1 = 3.0i;
assert ( c1 == std::complex<double>(0, 3.0));
@@ -46,6 +46,4 @@ int main()
auto c2 = 3if;
assert ( c1 == c2 );
}
-
-#endif
}
diff --git a/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp b/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp
index 0f31d595566c..67e0fa131fd0 100644
--- a/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp
+++ b/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp
@@ -7,14 +7,12 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
#include <complex>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
std::complex<float> foo = 1.0if; // should fail w/conversion operator not found
-#else
-#error
-#endif
}
diff --git a/test/std/numerics/complex.number/complex.literals/literals1.pass.cpp b/test/std/numerics/complex.number/complex.literals/literals1.pass.cpp
index 46903bbd565d..09a6f270f759 100644
--- a/test/std/numerics/complex.number/complex.literals/literals1.pass.cpp
+++ b/test/std/numerics/complex.number/complex.literals/literals1.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <chrono>
#include <complex>
@@ -15,7 +16,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std::literals;
{
@@ -24,7 +24,7 @@ int main()
auto c2 = 3il;
assert ( c1 == c2 );
}
-
+
{
std::complex<double> c1 = 3.0i;
assert ( c1 == std::complex<double>(0, 3.0));
@@ -38,6 +38,4 @@ int main()
auto c2 = 3if;
assert ( c1 == c2 );
}
-
-#endif
}
diff --git a/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp b/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp
index 8bd8acd981bc..d11530d7803a 100644
--- a/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp
+++ b/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <chrono>
#include <complex>
@@ -15,7 +16,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std;
{
@@ -24,7 +24,7 @@ int main()
auto c2 = 3il;
assert ( c1 == c2 );
}
-
+
{
std::complex<double> c1 = 3.0i;
assert ( c1 == std::complex<double>(0, 3.0));
@@ -38,6 +38,4 @@ int main()
auto c2 = 3if;
assert ( c1 == c2 );
}
-
-#endif
}
diff --git a/test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp b/test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp
index cb285117b15d..b4200fc81d40 100644
--- a/test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp
@@ -28,7 +28,7 @@ test()
c /= c2;
assert(c.real() == 1);
assert(c.imag() == 0);
-
+
std::complex<T> c3;
c3 = c;
@@ -36,13 +36,13 @@ test()
c3 /= ic;
assert(c3.real() == 0.5);
assert(c3.imag() == -0.5);
-
+
c3 = c;
std::complex<float> fc (1,1);
c3 /= fc;
assert(c3.real() == 0.5);
assert(c3.imag() == -0.5);
-
+
}
int main()
diff --git a/test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp b/test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp
index 8c16f4ced2cd..9b222b8a1d3c 100644
--- a/test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp
@@ -36,7 +36,7 @@ test()
c3 += ic;
assert(c3.real() == 4);
assert(c3.imag() == 6);
-
+
c3 = c;
std::complex<float> fc (1,1);
c3 += fc;
diff --git a/test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp b/test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp
index 84d6e591306e..98b7197cb272 100644
--- a/test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp
@@ -36,7 +36,7 @@ test()
c3 *= ic;
assert(c3.real() == -11.5);
assert(c3.imag() == 3.5);
-
+
c3 = c;
std::complex<float> fc (1,1);
c3 *= fc;
diff --git a/test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp b/test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp
index 86119678aa70..8d4712eece78 100644
--- a/test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp
@@ -37,16 +37,16 @@ test()
void test_edges()
{
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
for (unsigned j = 0; j < N; ++j)
{
- std::complex<double> r = x[i] / x[j];
- switch (classify(x[i]))
+ std::complex<double> r = testcases[i] / testcases[j];
+ switch (classify(testcases[i]))
{
case zero:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == NaN);
@@ -66,7 +66,7 @@ void test_edges()
}
break;
case non_zero:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == inf);
@@ -86,7 +86,7 @@ void test_edges()
}
break;
case inf:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == inf);
@@ -106,7 +106,7 @@ void test_edges()
}
break;
case NaN:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == NaN);
@@ -126,7 +126,7 @@ void test_edges()
}
break;
case non_zero_nan:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == inf);
diff --git a/test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp b/test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp
index 565eaa5657cd..8ead5bfb627a 100644
--- a/test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp
@@ -39,16 +39,16 @@ test()
void test_edges()
{
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
for (unsigned j = 0; j < N; ++j)
{
- std::complex<double> r = x[i] * x[j];
- switch (classify(x[i]))
+ std::complex<double> r = testcases[i] * testcases[j];
+ switch (classify(testcases[i]))
{
case zero:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == zero);
@@ -68,7 +68,7 @@ void test_edges()
}
break;
case non_zero:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == zero);
@@ -88,7 +88,7 @@ void test_edges()
}
break;
case inf:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == NaN);
@@ -108,7 +108,7 @@ void test_edges()
}
break;
case NaN:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == NaN);
@@ -128,7 +128,7 @@ void test_edges()
}
break;
case non_zero_nan:
- switch (classify(x[j]))
+ switch (classify(testcases[j]))
{
case zero:
assert(classify(r) == NaN);
diff --git a/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp
index f8ee306d7544..1b0cca0d5f69 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp
@@ -36,94 +36,94 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = acos(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = acos(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
is_about(r.real(), pi/2);
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) != std::signbit(r.imag()));
}
- else if (x[i].real() == 0 && std::isnan(x[i].imag()))
+ else if (testcases[i].real() == 0 && std::isnan(testcases[i].imag()))
{
is_about(r.real(), pi/2);
assert(std::isnan(r.imag()));
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
is_about(r.real(), pi/2);
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) != std::signbit(r.imag()));
}
- else if (std::isfinite(x[i].real()) && x[i].real() != 0 && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && testcases[i].real() != 0 && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() < 0 && std::isfinite(testcases[i].imag()))
{
is_about(r.real(), pi);
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) != std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && std::isfinite(testcases[i].imag()))
{
assert(r.real() == 0);
assert(!std::signbit(r.real()));
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) != std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() < 0 && std::isinf(testcases[i].imag()))
{
is_about(r.real(), 0.75 * pi);
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) != std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && std::isinf(testcases[i].imag()))
{
is_about(r.real(), 0.25 * pi);
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) != std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isinf(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) != std::signbit(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (!std::signbit(x[i].real()) && !std::signbit(x[i].imag()))
+ else if (!std::signbit(testcases[i].real()) && !std::signbit(testcases[i].imag()))
{
assert(!std::signbit(r.real()));
assert( std::signbit(r.imag()));
}
- else if (std::signbit(x[i].real()) && !std::signbit(x[i].imag()))
+ else if (std::signbit(testcases[i].real()) && !std::signbit(testcases[i].imag()))
{
assert(!std::signbit(r.real()));
assert( std::signbit(r.imag()));
}
- else if (std::signbit(x[i].real()) && std::signbit(x[i].imag()))
+ else if (std::signbit(testcases[i].real()) && std::signbit(testcases[i].imag()))
{
assert(!std::signbit(r.real()));
assert(!std::signbit(r.imag()));
}
- else if (!std::signbit(x[i].real()) && std::signbit(x[i].imag()))
+ else if (!std::signbit(testcases[i].real()) && std::signbit(testcases[i].imag()))
{
assert(!std::signbit(r.real()));
assert(!std::signbit(r.imag()));
diff --git a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp
index 88a5c798424d..f1aece20e6cf 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp
@@ -36,91 +36,91 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = acosh(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = acosh(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
assert(!std::signbit(r.real()));
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi/2);
else
is_about(r.imag(), pi/2);
}
- else if (x[i].real() == 1 && x[i].imag() == 0)
+ else if (testcases[i].real() == 1 && testcases[i].imag() == 0)
{
assert(r.real() == 0);
assert(!std::signbit(r.real()));
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi/2);
else
is_about(r.imag(), pi/2);
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() < 0 && std::isfinite(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi);
else
is_about(r.imag(), pi);
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && std::isfinite(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() < 0 && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -0.75 * pi);
else
is_about(r.imag(), 0.75 * pi);
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -0.25 * pi);
else
is_about(r.imag(), 0.25 * pi);
}
- else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
@@ -128,7 +128,7 @@ void test_edges()
else
{
assert(!std::signbit(r.real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
}
}
diff --git a/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp
index c743be6488c6..cf6f7869bd1a 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp
@@ -36,77 +36,77 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = asin(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = asin(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
- assert(std::signbit(r.real()) == std::signbit(x[i].real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(r.real() == 0);
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if ( x[i].real() == 0 && std::isnan(x[i].imag()))
+ else if ( testcases[i].real() == 0 && std::isnan(testcases[i].imag()))
{
assert(r.real() == 0);
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
- if (x[i].real() > 0)
+ if (testcases[i].real() > 0)
is_about(r.real(), pi/2);
else
is_about(r.real(), - pi/2);
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
- if (std::signbit(x[i].real()))
+ if (std::signbit(testcases[i].real()))
is_about(r.real(), -pi/4);
else
is_about(r.real(), pi/4);
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].real()) != std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].real()) != std::signbit(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isinf(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
else
{
- assert(std::signbit(r.real()) == std::signbit(x[i].real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
}
}
diff --git a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp
index 027bc6a98a99..011f9d6b4f2e 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp
@@ -36,76 +36,76 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = asinh(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = asinh(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
- assert(std::signbit(r.real()) == std::signbit(x[i].real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
- if (std::signbit(x[i].imag()))
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi/2);
else
is_about(r.imag(), pi/2);
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isinf(r.real()));
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
- if (std::signbit(x[i].imag()))
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi/4);
else
is_about(r.imag(), pi/4);
}
- else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isinf(r.real()));
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+ else if (std::isnan(testcases[i].real()) && testcases[i].imag() == 0)
{
assert(std::isnan(r.real()));
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
else
{
- assert(std::signbit(r.real()) == std::signbit(x[i].real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
}
}
diff --git a/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp
index 69bc95240141..8cc71f7bff27 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp
@@ -35,11 +35,11 @@ test()
void test_edges()
{
typedef std::complex<double> C;
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = atan(x[i]);
- std::complex<double> t1(-imag(x[i]), real(x[i]));
+ std::complex<double> r = atan(testcases[i]);
+ std::complex<double> t1(-imag(testcases[i]), real(testcases[i]));
std::complex<double> t2 = atanh(t1);
std::complex<double> z(imag(t2), -real(t2));
if (std::isnan(real(r)))
diff --git a/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp
index b821109b751b..6dc6034ca3c6 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp
@@ -36,89 +36,89 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = atanh(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = atanh(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
- assert(std::signbit(r.real()) == std::signbit(x[i].real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if ( x[i].real() == 0 && std::isnan(x[i].imag()))
+ else if ( testcases[i].real() == 0 && std::isnan(testcases[i].imag()))
{
assert(r.real() == 0);
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::abs(x[i].real()) == 1 && x[i].imag() == 0)
+ else if (std::abs(testcases[i].real()) == 1 && testcases[i].imag() == 0)
{
assert(std::isinf(r.real()));
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(r.real() == 0);
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
- if (x[i].imag() > 0)
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
+ if (testcases[i].imag() > 0)
is_about(r.imag(), pi/2);
else
is_about(r.imag(), -pi/2);
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(r.real() == 0);
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
- if (std::signbit(x[i].imag()))
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi/2);
else
is_about(r.imag(), pi/2);
}
- else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(r.real() == 0);
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
- if (std::signbit(x[i].imag()))
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi/2);
else
is_about(r.imag(), pi/2);
}
- else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(r.real() == 0);
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(r.real() == 0);
- assert(std::signbit(x[i].real()) == std::signbit(r.real()));
- if (std::signbit(x[i].imag()))
+ assert(std::signbit(testcases[i].real()) == std::signbit(r.real()));
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi/2);
else
is_about(r.imag(), pi/2);
}
- else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
else
{
- assert(std::signbit(r.real()) == std::signbit(x[i].real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
}
}
diff --git a/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
index f25c967cb1a7..e09163a7057d 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
@@ -36,11 +36,11 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = cos(x[i]);
- std::complex<double> t1(-imag(x[i]), real(x[i]));
+ std::complex<double> r = cos(testcases[i]);
+ std::complex<double> t1(-imag(testcases[i]), real(testcases[i]));
std::complex<double> z = cosh(t1);
if (std::isnan(real(r)))
assert(std::isnan(real(z)));
diff --git a/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
index acf4746389c8..0fd9cf79bcbf 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
@@ -36,72 +36,72 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = cosh(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = cosh(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
assert(r.real() == 1);
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (x[i].real() == 0 && std::isinf(x[i].imag()))
+ else if (testcases[i].real() == 0 && std::isinf(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(r.imag() == 0);
}
- else if (x[i].real() == 0 && std::isnan(x[i].imag()))
+ else if (testcases[i].real() == 0 && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(r.imag() == 0);
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].imag() == 0)
+ else if (std::isinf(testcases[i].real()) && testcases[i].imag() == 0)
{
assert(std::isinf(r.real()));
assert(!std::signbit(r.real()));
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isinf(r.real()));
- assert(std::signbit(r.real()) == std::signbit(cos(x[i].imag())));
+ assert(std::signbit(r.real()) == std::signbit(cos(testcases[i].imag())));
assert(std::isinf(r.imag()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].real() * sin(x[i].imag())));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].real() * sin(testcases[i].imag())));
}
- else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+ else if (std::isnan(testcases[i].real()) && testcases[i].imag() == 0)
{
assert(std::isnan(r.real()));
assert(r.imag() == 0);
}
- else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
diff --git a/test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp
index e8b507572f1b..31317816fae0 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp
@@ -34,73 +34,73 @@ test()
void test_edges()
{
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = exp(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = exp(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
assert(r.real() == 1.0);
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && x[i].imag() == 0)
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && testcases[i].imag() == 0)
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() < 0 && std::isinf(testcases[i].imag()))
{
assert(r.real() == 0);
assert(r.imag() == 0);
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() < 0 && std::isnan(testcases[i].imag()))
{
assert(r.real() == 0);
assert(r.imag() == 0);
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && std::isnan(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+ else if (std::isnan(testcases[i].real()) && testcases[i].imag() == 0)
{
assert(std::isnan(r.real()));
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isnan(x[i].real()) && x[i].imag() != 0)
+ else if (std::isnan(testcases[i].real()) && testcases[i].imag() != 0)
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isfinite(x[i].imag()) && std::abs(x[i].imag()) <= 1)
+ else if (std::isfinite(testcases[i].imag()) && std::abs(testcases[i].imag()) <= 1)
{
assert(!std::signbit(r.real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
}
}
diff --git a/test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp
index 800b92474bf0..589b5969950d 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp
@@ -35,17 +35,17 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = log(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = log(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
- if (std::signbit(x[i].real()))
+ if (std::signbit(testcases[i].real()))
{
assert(std::isinf(r.real()));
assert(r.real() < 0);
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi);
else
is_about(r.imag(), pi);
@@ -55,24 +55,24 @@ void test_edges()
assert(std::isinf(r.real()));
assert(r.real() < 0);
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
- if (x[i].imag() > 0)
+ if (testcases[i].imag() > 0)
is_about(r.imag(), pi/2);
else
is_about(r.imag(), -pi/2);
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() < 0 && std::isfinite(testcases[i].imag()))
{
assert(std::isinf(r.real()) && r.real() > 0);
if (r.imag() > 0)
@@ -80,44 +80,44 @@ void test_edges()
else
is_about(r.imag(), -pi);
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && std::isfinite(testcases[i].imag()))
{
assert(std::isinf(r.real()) && r.real() > 0);
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (x[i].real() == 1 && x[i].imag() == 0)
+ else if (testcases[i].real() == 1 && testcases[i].imag() == 0)
{
assert(r.real() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (x[i].real() == 0 && x[i].imag() == 1)
+ else if (testcases[i].real() == 0 && testcases[i].imag() == 1)
{
assert(r.real() == 0);
is_about(r.imag(), pi/2);
}
- else if (x[i].real() == -1 && x[i].imag() == 0)
+ else if (testcases[i].real() == -1 && testcases[i].imag() == 0)
{
assert(r.real() == 0);
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r.imag(), -pi);
else
is_about(r.imag(), pi);
}
- else if (x[i].real() == 0 && x[i].imag() == -1)
+ else if (testcases[i].real() == 0 && testcases[i].imag() == -1)
{
assert(r.real() == 0);
is_about(r.imag(), -pi/2);
}
- else if (std::isfinite(x[i].real()) && std::isfinite(x[i].imag()) && abs(x[i]) < 1)
+ else if (std::isfinite(testcases[i].real()) && std::isfinite(testcases[i].imag()) && abs(testcases[i]) < 1)
{
assert( std::signbit(r.real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isfinite(x[i].real()) && std::isfinite(x[i].imag()) && abs(x[i]) > 1)
+ else if (std::isfinite(testcases[i].real()) && std::isfinite(testcases[i].imag()) && abs(testcases[i]) > 1)
{
assert(!std::signbit(r.real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
}
}
diff --git a/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp
index ba03ebf8ad28..58286904ae25 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp
@@ -35,11 +35,11 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = log10(x[i]);
- std::complex<double> z = log(x[i])/std::log(10);
+ std::complex<double> r = log10(testcases[i]);
+ std::complex<double> z = log(testcases[i])/std::log(10);
if (std::isnan(real(r)))
assert(std::isnan(real(z)));
else
diff --git a/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp
index 258193d257a8..157246947cfe 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp
@@ -37,13 +37,13 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
for (unsigned j = 0; j < N; ++j)
{
- std::complex<double> r = pow(x[i], x[j]);
- std::complex<double> z = exp(x[j] * log(x[i]));
+ std::complex<double> r = pow(testcases[i], testcases[j]);
+ std::complex<double> z = exp(testcases[j] * log(testcases[i]));
if (std::isnan(real(r)))
assert(std::isnan(real(z)));
else
diff --git a/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp
index 03bd10d465d1..0752ea59f554 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp
@@ -37,13 +37,13 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
for (unsigned j = 0; j < N; ++j)
{
- std::complex<double> r = pow(x[i], real(x[j]));
- std::complex<double> z = exp(std::complex<double>(real(x[j])) * log(x[i]));
+ std::complex<double> r = pow(testcases[i], real(testcases[j]));
+ std::complex<double> z = exp(std::complex<double>(real(testcases[j])) * log(testcases[i]));
if (std::isnan(real(r)))
assert(std::isnan(real(z)));
else
diff --git a/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp
index a48498cea92c..aedeec8caacc 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp
@@ -37,13 +37,13 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
for (unsigned j = 0; j < N; ++j)
{
- std::complex<double> r = pow(real(x[i]), x[j]);
- std::complex<double> z = exp(x[j] * log(std::complex<double>(real(x[i]))));
+ std::complex<double> r = pow(real(testcases[i]), testcases[j]);
+ std::complex<double> z = exp(testcases[j] * log(std::complex<double>(real(testcases[i]))));
if (std::isnan(real(r)))
assert(std::isnan(real(z)));
else
diff --git a/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
index 068222a27373..e1b98ecd0677 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
@@ -36,11 +36,11 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = sin(x[i]);
- std::complex<double> t1(-imag(x[i]), real(x[i]));
+ std::complex<double> r = sin(testcases[i]);
+ std::complex<double> t1(-imag(testcases[i]), real(testcases[i]));
std::complex<double> t2 = sinh(t1);
std::complex<double> z(imag(t2), -real(t2));
if (std::isnan(real(r)))
diff --git a/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
index dcd30e48dff5..20f2e71b140a 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
@@ -36,73 +36,73 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = sinh(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = sinh(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
assert(r.real() == 0);
- assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real()));
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (x[i].real() == 0 && std::isinf(x[i].imag()))
+ else if (testcases[i].real() == 0 && std::isinf(testcases[i].imag()))
{
assert(r.real() == 0);
assert(std::isnan(r.imag()));
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (x[i].real() == 0 && std::isnan(x[i].imag()))
+ else if (testcases[i].real() == 0 && std::isnan(testcases[i].imag()))
{
assert(r.real() == 0);
assert(std::isnan(r.imag()));
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].imag() == 0)
+ else if (std::isinf(testcases[i].real()) && testcases[i].imag() == 0)
{
assert(std::isinf(r.real()));
- assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real()));
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isinf(r.real()));
- assert(std::signbit(r.real()) == std::signbit(x[i].real() * cos(x[i].imag())));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real() * cos(testcases[i].imag())));
assert(std::isinf(r.imag()));
- assert(std::signbit(r.imag()) == std::signbit(sin(x[i].imag())));
+ assert(std::signbit(r.imag()) == std::signbit(sin(testcases[i].imag())));
}
- else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+ else if (std::isnan(testcases[i].real()) && testcases[i].imag() == 0)
{
assert(std::isnan(r.real()));
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
diff --git a/test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp
index 69309d2b9ab1..d3273179a6da 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp
@@ -36,58 +36,58 @@ test()
void test_edges()
{
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = sqrt(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = sqrt(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
assert(!std::signbit(r.real()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
assert(std::isinf(r.imag()));
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() < 0 && std::isfinite(testcases[i].imag()))
{
assert(r.real() == 0);
assert(!std::signbit(r.real()));
assert(std::isinf(r.imag()));
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && std::isfinite(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
assert(r.imag() == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() < 0 && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isinf(r.imag()));
}
- else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && testcases[i].real() > 0 && std::isnan(testcases[i].imag()))
{
assert(std::isinf(r.real()));
assert(r.real() > 0);
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && (std::isfinite(x[i].imag()) || std::isnan(x[i].imag())))
+ else if (std::isnan(testcases[i].real()) && (std::isfinite(testcases[i].imag()) || std::isnan(testcases[i].imag())))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::signbit(x[i].imag()))
+ else if (std::signbit(testcases[i].imag()))
{
assert(!std::signbit(r.real()));
assert(std::signbit(r.imag()));
diff --git a/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp
index 881427600686..041a7814d033 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp
@@ -37,11 +37,11 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = tan(x[i]);
- std::complex<double> t1(-imag(x[i]), real(x[i]));
+ std::complex<double> r = tan(testcases[i]);
+ std::complex<double> t1(-imag(testcases[i]), real(testcases[i]));
std::complex<double> t2 = tanh(t1);
std::complex<double> z(imag(t2), -real(t2));
if (std::isnan(real(r)))
diff --git a/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
index 907c0e64dba9..9a2276a8b753 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
@@ -36,55 +36,55 @@ void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = tanh(x[i]);
- if (x[i].real() == 0 && x[i].imag() == 0)
+ std::complex<double> r = tanh(testcases[i]);
+ if (testcases[i].real() == 0 && testcases[i].imag() == 0)
{
assert(r.real() == 0);
- assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+ assert(std::signbit(r.real()) == std::signbit(testcases[i].real()));
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isfinite(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(r.real() == 1);
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(sin(2*x[i].imag())));
+ assert(std::signbit(r.imag()) == std::signbit(sin(2*testcases[i].imag())));
}
- else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
assert(r.real() == 1);
assert(r.imag() == 0);
}
- else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isinf(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(r.real() == 1);
assert(r.imag() == 0);
}
- else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+ else if (std::isnan(testcases[i].real()) && testcases[i].imag() == 0)
{
assert(std::isnan(r.real()));
assert(r.imag() == 0);
- assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+ assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag()));
}
- else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isfinite(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
}
- else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+ else if (std::isnan(testcases[i].real()) && std::isnan(testcases[i].imag()))
{
assert(std::isnan(r.real()));
assert(std::isnan(r.imag()));
diff --git a/test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp b/test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp
index 5d841d6ee9f1..7a0e3bd70072 100644
--- a/test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp
+++ b/test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp
@@ -28,11 +28,11 @@ test()
void test_edges()
{
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- double r = abs(x[i]);
- switch (classify(x[i]))
+ double r = abs(testcases[i]);
+ switch (classify(testcases[i]))
{
case zero:
assert(r == 0);
diff --git a/test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp b/test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp
index a7da456b979c..78f2781b76e2 100644
--- a/test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp
+++ b/test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp
@@ -29,42 +29,42 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- double r = arg(x[i]);
- if (std::isnan(x[i].real()) || std::isnan(x[i].imag()))
+ double r = arg(testcases[i]);
+ if (std::isnan(testcases[i].real()) || std::isnan(testcases[i].imag()))
assert(std::isnan(r));
else
{
- switch (classify(x[i]))
+ switch (classify(testcases[i]))
{
case zero:
- if (std::signbit(x[i].real()))
+ if (std::signbit(testcases[i].real()))
{
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r, -pi);
else
is_about(r, pi);
}
else
{
- assert(std::signbit(x[i].imag()) == std::signbit(r));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r));
}
break;
case non_zero:
- if (x[i].real() == 0)
+ if (testcases[i].real() == 0)
{
- if (x[i].imag() < 0)
+ if (testcases[i].imag() < 0)
is_about(r, -pi/2);
else
is_about(r, pi/2);
}
- else if (x[i].imag() == 0)
+ else if (testcases[i].imag() == 0)
{
- if (x[i].real() < 0)
+ if (testcases[i].real() < 0)
{
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r, -pi);
else
is_about(r, pi);
@@ -72,37 +72,37 @@ void test_edges()
else
{
assert(r == 0);
- assert(std::signbit(x[i].imag()) == std::signbit(r));
+ assert(std::signbit(testcases[i].imag()) == std::signbit(r));
}
}
- else if (x[i].imag() > 0)
+ else if (testcases[i].imag() > 0)
assert(r > 0);
else
assert(r < 0);
break;
case inf:
- if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+ if (std::isinf(testcases[i].real()) && std::isinf(testcases[i].imag()))
{
- if (x[i].real() < 0)
+ if (testcases[i].real() < 0)
{
- if (x[i].imag() > 0)
+ if (testcases[i].imag() > 0)
is_about(r, 0.75 * pi);
else
is_about(r, -0.75 * pi);
}
else
{
- if (x[i].imag() > 0)
+ if (testcases[i].imag() > 0)
is_about(r, 0.25 * pi);
else
is_about(r, -0.25 * pi);
}
}
- else if (std::isinf(x[i].real()))
+ else if (std::isinf(testcases[i].real()))
{
- if (x[i].real() < 0)
+ if (testcases[i].real() < 0)
{
- if (std::signbit(x[i].imag()))
+ if (std::signbit(testcases[i].imag()))
is_about(r, -pi);
else
is_about(r, pi);
@@ -110,12 +110,12 @@ void test_edges()
else
{
assert(r == 0);
- assert(std::signbit(r) == std::signbit(x[i].imag()));
+ assert(std::signbit(r) == std::signbit(testcases[i].imag()));
}
}
else
{
- if (x[i].imag() < 0)
+ if (testcases[i].imag() < 0)
is_about(r, -pi/2);
else
is_about(r, pi/2);
diff --git a/test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp b/test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp
index 48f774e8e1c9..da7ad14bedce 100644
--- a/test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp
+++ b/test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp
@@ -28,11 +28,11 @@ test()
void test_edges()
{
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- double r = norm(x[i]);
- switch (classify(x[i]))
+ double r = norm(testcases[i]);
+ switch (classify(testcases[i]))
{
case zero:
assert(r == 0);
diff --git a/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp b/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp
index a8747bd7c83b..5e6cb0d523c2 100644
--- a/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp
+++ b/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp
@@ -46,11 +46,11 @@ test()
void test_edges()
{
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- double r = real(x[i]);
- double theta = imag(x[i]);
+ double r = real(testcases[i]);
+ double theta = imag(testcases[i]);
std::complex<double> z = std::polar(r, theta);
switch (classify(r))
{
diff --git a/test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp b/test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp
index 10bf7f8576f6..1a7e0c53f3d3 100644
--- a/test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp
+++ b/test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp
@@ -37,26 +37,26 @@ test()
void test_edges()
{
- const unsigned N = sizeof(x) / sizeof(x[0]);
+ const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
- std::complex<double> r = proj(x[i]);
- switch (classify(x[i]))
+ std::complex<double> r = proj(testcases[i]);
+ switch (classify(testcases[i]))
{
case zero:
case non_zero:
- assert(r == x[i]);
- assert(std::signbit(real(r)) == std::signbit(real(x[i])));
- assert(std::signbit(imag(r)) == std::signbit(imag(x[i])));
+ assert(r == testcases[i]);
+ assert(std::signbit(real(r)) == std::signbit(real(testcases[i])));
+ assert(std::signbit(imag(r)) == std::signbit(imag(testcases[i])));
break;
case inf:
assert(std::isinf(real(r)) && real(r) > 0);
assert(imag(r) == 0);
- assert(std::signbit(imag(r)) == std::signbit(imag(x[i])));
+ assert(std::signbit(imag(r)) == std::signbit(imag(testcases[i])));
break;
case NaN:
case non_zero_nan:
- assert(classify(r) == classify(x[i]));
+ assert(classify(r) == classify(testcases[i]));
break;
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp
index 0b792c68fb94..306ea0c18470 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp
@@ -36,6 +36,6 @@ int main()
std::valarray<bool> v2 = !(v + v);
assert(v2.size() == v.size());
for (int i = 0; i < v2.size(); ++i)
- assert(v2[i] == !2*v[i]);
+ assert(v2[i] == !(2 * v[i]));
}
}
diff --git a/test/std/numerics/rand/rand.device/ctor.pass.cpp b/test/std/numerics/rand/rand.device/ctor.pass.cpp
index dfeccc81e30e..8c45bb19a0a6 100644
--- a/test/std/numerics/rand/rand.device/ctor.pass.cpp
+++ b/test/std/numerics/rand/rand.device/ctor.pass.cpp
@@ -22,7 +22,13 @@
#include <random>
#include <system_error>
#include <cassert>
+
+#if !defined(_WIN32)
#include <unistd.h>
+#endif
+
+#include "test_macros.h"
+
bool is_valid_random_device(const std::string &token) {
#if defined(_LIBCPP_USING_DEV_RANDOM)
@@ -40,33 +46,20 @@ void check_random_device_valid(const std::string &token) {
void check_random_device_invalid(const std::string &token) {
try {
std::random_device r(token);
- assert(false);
- } catch (const std::system_error &e) {
+ LIBCPP_ASSERT(false);
+ } catch (const std::system_error&) {
}
}
-int main() {
- { std::random_device r; }
+int main() {
{
- int ec;
- ec = close(STDIN_FILENO);
- assert(!ec);
- ec = close(STDOUT_FILENO);
- assert(!ec);
- ec = close(STDERR_FILENO);
- assert(!ec);
std::random_device r;
}
-
{
std::string token = "wrong file";
- if (is_valid_random_device(token))
- check_random_device_valid(token);
- else
- check_random_device_invalid(token);
+ check_random_device_invalid(token);
}
-
{
std::string token = "/dev/urandom";
if (is_valid_random_device(token))
@@ -74,7 +67,6 @@ int main() {
else
check_random_device_invalid(token);
}
-
{
std::string token = "/dev/random";
if (is_valid_random_device(token))
@@ -82,4 +74,19 @@ int main() {
else
check_random_device_invalid(token);
}
+#if !defined(_WIN32)
+// Test that random_device(const string&) properly handles getting
+// a file descriptor with the value '0'. Do this by closing the standard
+// streams so that the descriptor '0' is available.
+ {
+ int ec;
+ ec = close(STDIN_FILENO);
+ assert(!ec);
+ ec = close(STDOUT_FILENO);
+ assert(!ec);
+ ec = close(STDERR_FILENO);
+ assert(!ec);
+ std::random_device r;
+ }
+#endif // !defined(_WIN32)
}
diff --git a/test/std/numerics/rand/rand.device/eval.pass.cpp b/test/std/numerics/rand/rand.device/eval.pass.cpp
index ed5361fbde75..eabcc201e068 100644
--- a/test/std/numerics/rand/rand.device/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.device/eval.pass.cpp
@@ -17,6 +17,8 @@
#include <random>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -28,9 +30,9 @@ int main()
{
std::random_device r("/dev/null");
r();
- assert(false);
+ LIBCPP_ASSERT(false);
}
- catch (const std::system_error& e)
+ catch (const std::system_error&)
{
}
}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
index f071e8507478..b267c2477e91 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
@@ -44,10 +44,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -80,10 +80,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
index e03fb57f380c..f96df82304f0 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
@@ -46,10 +46,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -84,10 +84,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
index 43c6b546bdb2..88004ba4a741 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
@@ -29,447 +29,491 @@ sqr(T x)
return x * x;
}
-int main()
+void
+test1()
{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ D d(5, .75);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- D d(5, .75);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
- double x_skew = (1-2*d.p()) / std::sqrt(x_var);
- double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(30, .03125);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
- double x_skew = (1-2*d.p()) / std::sqrt(x_var);
- double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+}
+
+void
+test2()
+{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(30, .03125);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(40, .25);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
- double x_skew = (1-2*d.p()) / std::sqrt(x_var);
- double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.03);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.3);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(40, 0);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- // In this case:
- // skew computes to 0./0. == nan
- // kurtosis computes to 0./0. == nan
- // x_skew == inf
- // x_kurtosis == inf
- // These tests are commented out because UBSan warns about division by 0
-// skew /= u.size() * dev * var;
-// kurtosis /= u.size() * var * var;
-// kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
-// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(mean == x_mean);
- assert(var == x_var);
-// assert(skew == x_skew);
-// assert(kurtosis == x_kurtosis);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test3()
+{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, .25);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(40, 1);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- // In this case:
- // skew computes to 0./0. == nan
- // kurtosis computes to 0./0. == nan
- // x_skew == -inf
- // x_kurtosis == inf
- // These tests are commented out because UBSan warns about division by 0
-// skew /= u.size() * dev * var;
-// kurtosis /= u.size() * var * var;
-// kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
-// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(mean == x_mean);
- assert(var == x_var);
-// assert(skew == x_skew);
-// assert(kurtosis == x_kurtosis);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(400, 0.5);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
- double x_skew = (1-2*d.p()) / std::sqrt(x_var);
- double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs(kurtosis - x_kurtosis) < 0.01);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.03);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.3);
+}
+
+void
+test4()
+{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, 0);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(1, 0.5);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
- double x_skew = (1-2*d.p()) / std::sqrt(x_var);
- double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- const int N = 100000;
- std::mt19937 gen1;
- std::mt19937 gen2;
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+}
- std::binomial_distribution<> dist1(5, 0.1);
- std::binomial_distribution<unsigned> dist2(5, 0.1);
+void
+test5()
+{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, 1);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == -inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+}
- for(int i = 0; i < N; ++i)
- assert(dist1(gen1) == dist2(gen2));
+void
+test6()
+{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(400, 0.5);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(0, 0.005);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- // In this case:
- // skew computes to 0./0. == nan
- // kurtosis computes to 0./0. == nan
- // x_skew == inf
- // x_kurtosis == inf
- // These tests are commented out because UBSan warns about division by 0
-// skew /= u.size() * dev * var;
-// kurtosis /= u.size() * var * var;
-// kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
-// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(mean == x_mean);
- assert(var == x_var);
-// assert(skew == x_skew);
-// assert(kurtosis == x_kurtosis);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs(kurtosis - x_kurtosis) < 0.01);
+}
+
+void
+test7()
+{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, 0.5);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(0, 0);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- // In this case:
- // skew computes to 0./0. == nan
- // kurtosis computes to 0./0. == nan
- // x_skew == inf
- // x_kurtosis == inf
- // These tests are commented out because UBSan warns about division by 0
-// skew /= u.size() * dev * var;
-// kurtosis /= u.size() * var * var;
-// kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
-// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(mean == x_mean);
- assert(var == x_var);
-// assert(skew == x_skew);
-// assert(kurtosis == x_kurtosis);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(0, 1);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- // In this case:
- // skew computes to 0./0. == nan
- // kurtosis computes to 0./0. == nan
- // x_skew == -inf
- // x_kurtosis == inf
- // These tests are commented out because UBSan warns about division by 0
-// skew /= u.size() * dev * var;
-// kurtosis /= u.size() * var * var;
-// kurtosis -= 3;
- double x_mean = d.t() * d.p();
- double x_var = x_mean*(1-d.p());
-// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
- assert(mean == x_mean);
- assert(var == x_var);
-// assert(skew == x_skew);
-// assert(kurtosis == x_kurtosis);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test8()
+{
+ const int N = 100000;
+ std::mt19937 gen1;
+ std::mt19937 gen2;
+
+ std::binomial_distribution<> dist1(5, 0.1);
+ std::binomial_distribution<unsigned> dist2(5, 0.1);
+
+ for(int i = 0; i < N; ++i)
+ assert(dist1(gen1) == dist2(gen2));
+}
+
+void
+test9()
+{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0, 0.005);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+}
+
+void
+test10()
+{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0, 0);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+}
+
+void
+test11()
+{
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0, 1);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == -inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+ test7();
+ test8();
+ test9();
+ test10();
+ test11();
}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
index 1aa66ed57ad1..092a69778513 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
@@ -53,10 +53,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -95,10 +95,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -137,10 +137,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
index a8ef221e3b67..4e9f9d3c044d 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
@@ -29,246 +29,270 @@ sqr(T x)
return x * x;
}
-int main()
+void
+test1()
+{
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(.03125);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test2()
+{
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.05);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+}
+
+void
+test3()
+{
+ typedef std::geometric_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+}
+
+void
+test4()
{
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::geometric_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(.03125);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
- double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::geometric_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(0.05);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
- double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+}
+
+void
+test5()
+{
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.75);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::geometric_distribution<> D;
- typedef std::minstd_rand G;
- G g;
- D d(.25);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
- double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::geometric_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(0.5);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
- double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+}
+
+void
+test6()
+{
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.96875);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::geometric_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(0.75);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
- double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::geometric_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(0.96875);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
- double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
index 91dea8aa1337..c451f0130904 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
@@ -53,10 +53,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -95,10 +95,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -137,10 +137,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
index 853161e9f9b7..929e6e7e6c3b 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
@@ -29,244 +29,268 @@ sqr(T x)
return x * x;
}
-int main()
+void
+test1()
+{
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(5, .25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+}
+
+void
+test2()
+{
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(30, .03125);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test3()
+{
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, .25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+}
+
+void
+test4()
{
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, 1);
+ const int N = 1000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::negative_binomial_distribution<> D;
- typedef std::minstd_rand G;
- G g;
- D d(5, .25);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.k() * (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
- double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::negative_binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(30, .03125);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.k() * (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
- double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(mean == x_mean);
+ assert(var == x_var);
+}
+
+void
+test5()
+{
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(400, 0.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::negative_binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(40, .25);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.k() * (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
- double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::negative_binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(40, 1);
- const int N = 1000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.k() * (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
- double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
- assert(mean == x_mean);
- assert(var == x_var);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.04);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+}
+
+void
+test6()
+{
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, 0.05);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::negative_binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(400, 0.5);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.k() * (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
- double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.04);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::negative_binomial_distribution<> D;
- typedef std::mt19937 G;
- G g;
- D d(1, 0.05);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v <= d.max());
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(),
- double(0)) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.k() * (1 - d.p()) / d.p();
- double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
- double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
index f2f2a07879e2..2710061a1a05 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
@@ -53,10 +53,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -95,10 +95,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -137,10 +137,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
index 6fbdd93f8ffd..f6bc3c73993c 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
@@ -51,10 +51,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -91,10 +91,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -131,10 +131,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
index 548848d19f3e..fd52a0488979 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
@@ -52,10 +52,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -93,10 +93,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -134,10 +134,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
index 9b111cced8a8..2ad6784cd878 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
@@ -29,216 +29,236 @@ sqr(T x)
return x * x;
}
-int main()
+void
+test1()
+{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-1./8192, 0.015625);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.05);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.25);
+}
+
+void
+test2()
{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-1./32, 0.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(-1./8192, 0.015625);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(d.m() + sqr(d.s())/2);
- double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
- double x_skew = (std::exp(sqr(d.s())) + 2) *
- std::sqrt((std::exp(sqr(d.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
- 3*std::exp(2*sqr(d.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.05);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.25);
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(-1./32, 0.25);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(d.m() + sqr(d.s())/2);
- double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
- double x_skew = (std::exp(sqr(d.s())) + 2) *
- std::sqrt((std::exp(sqr(d.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
- 3*std::exp(2*sqr(d.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+}
+
+void
+test3()
+{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-1./8, 0.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(-1./8, 0.5);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(d.m() + sqr(d.s())/2);
- double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
- double x_skew = (std::exp(sqr(d.s())) + 2) *
- std::sqrt((std::exp(sqr(d.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
- 3*std::exp(2*sqr(d.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.02);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d;
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(d.m() + sqr(d.s())/2);
- double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
- double x_skew = (std::exp(sqr(d.s())) + 2) *
- std::sqrt((std::exp(sqr(d.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
- 3*std::exp(2*sqr(d.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.02);
- assert(std::abs((skew - x_skew) / x_skew) < 0.08);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.4);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+}
+
+void
+test4()
+{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(-0.78125, 1.25);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(d.m() + sqr(d.s())/2);
- double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
- double x_skew = (std::exp(sqr(d.s())) + 2) *
- std::sqrt((std::exp(sqr(d.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
- 3*std::exp(2*sqr(d.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.04);
- assert(std::abs((skew - x_skew) / x_skew) < 0.2);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.7);
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.08);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.4);
+}
+
+void
+test5()
+{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.78125, 1.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.04);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.2);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.7);
+}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
index 283403ea1a0d..8f397fcab096 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
@@ -29,222 +29,241 @@ sqr(T x)
return x * x;
}
-int main()
+void
+test1()
{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ P p(-1./8192, 0.015625);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.05);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.25);
+}
+
+void
+test2()
+{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ P p(-1./32, 0.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+}
+void
+test3()
+{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ P p(-1./8, 0.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d;
- P p(-1./8192, 0.015625);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g, p);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(p.m() + sqr(p.s())/2);
- double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
- double x_skew = (std::exp(sqr(p.s())) + 2) *
- std::sqrt((std::exp(sqr(p.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
- 3*std::exp(2*sqr(p.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.05);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.25);
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d;
- P p(-1./32, 0.25);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g, p);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(p.m() + sqr(p.s())/2);
- double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
- double x_skew = (std::exp(sqr(p.s())) + 2) *
- std::sqrt((std::exp(sqr(p.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
- 3*std::exp(2*sqr(p.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+}
+
+void
+test4()
+{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(3, 4);
+ P p;
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d;
- P p(-1./8, 0.5);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g, p);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(p.m() + sqr(p.s())/2);
- double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
- double x_skew = (std::exp(sqr(p.s())) + 2) *
- std::sqrt((std::exp(sqr(p.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
- 3*std::exp(2*sqr(p.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.02);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(3, 4);
- P p;
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g, p);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(p.m() + sqr(p.s())/2);
- double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
- double x_skew = (std::exp(sqr(p.s())) + 2) *
- std::sqrt((std::exp(sqr(p.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
- 3*std::exp(2*sqr(p.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.02);
- assert(std::abs((skew - x_skew) / x_skew) < 0.08);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.4);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.08);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.4);
+}
+
+void
+test5()
+{
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ P p(-0.78125, 1.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d;
- P p(-0.78125, 1.25);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g, p);
- assert(v > 0);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = std::exp(p.m() + sqr(p.s())/2);
- double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
- double x_skew = (std::exp(sqr(p.s())) + 2) *
- std::sqrt((std::exp(sqr(p.s())) - 1));
- double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
- 3*std::exp(2*sqr(p.s())) - 6;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.04);
- assert(std::abs((skew - x_skew) / x_skew) < 0.2);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.7);
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.04);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.2);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.7);
+}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp
index 95d0272dbc32..69f786397711 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp
@@ -47,10 +47,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp
index 20c3a44f13e1..af9c547cb7f9 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp
@@ -48,10 +48,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
index ef6b37e9f9cc..9210e8a8d350 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
@@ -47,10 +47,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -83,10 +83,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -119,10 +119,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
index 70bc29e3ad13..93053f0a36b7 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
@@ -48,10 +48,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -85,10 +85,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -122,10 +122,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
index b2fe52676e7e..42965b0e6ab2 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
@@ -51,10 +51,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -91,10 +91,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -131,10 +131,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
index 9879e63a33e9..e7de18fdb434 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
@@ -52,10 +52,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
index 6390acef8941..3f1b331889e5 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
@@ -29,162 +29,178 @@ sqr(T x)
return x * x;
}
-int main()
+void
+test1()
+{
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.5, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.a() + d.b() * 0.577215665;
+ double x_var = sqr(d.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test2()
+{
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.a() + d.b() * 0.577215665;
+ double x_var = sqr(d.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test3()
{
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1.5, 3);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(0.5, 2);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.a() + d.b() * 0.577215665;
- double x_var = sqr(d.b()) * 1.644934067;
- double x_skew = 1.139547;
- double x_kurtosis = 12./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ D::result_type v = d(g);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(1, 2);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.a() + d.b() * 0.577215665;
- double x_var = sqr(d.b()) * 1.644934067;
- double x_skew = 1.139547;
- double x_kurtosis = 12./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.a() + d.b() * 0.577215665;
+ double x_var = sqr(d.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test4()
+{
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(3, 4);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(1.5, 3);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.a() + d.b() * 0.577215665;
- double x_var = sqr(d.b()) * 1.644934067;
- double x_skew = 1.139547;
- double x_kurtosis = 12./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ D::result_type v = d(g);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(3, 4);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = d.a() + d.b() * 0.577215665;
- double x_var = sqr(d.b()) * 1.644934067;
- double x_skew = 1.139547;
- double x_kurtosis = 12./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.a() + d.b() * 0.577215665;
+ double x_var = sqr(d.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
index 6152cce8f4f8..21bf774228f8 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
@@ -29,166 +29,182 @@ sqr(T x)
return x * x;
}
-int main()
+void
+test1()
+{
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.5, 1);
+ P p(0.5, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.a() + p.b() * 0.577215665;
+ double x_var = sqr(p.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test2()
+{
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.5, 1);
+ P p(1, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.a() + p.b() * 0.577215665;
+ double x_var = sqr(p.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test3()
{
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.5, 1);
+ P p(1.5, 3);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(-0.5, 1);
- P p(0.5, 2);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g, p);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = p.a() + p.b() * 0.577215665;
- double x_var = sqr(p.b()) * 1.644934067;
- double x_skew = 1.139547;
- double x_kurtosis = 12./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ D::result_type v = d(g, p);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(-0.5, 1);
- P p(1, 2);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g, p);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = p.a() + p.b() * 0.577215665;
- double x_var = sqr(p.b()) * 1.644934067;
- double x_skew = 1.139547;
- double x_kurtosis = 12./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.a() + p.b() * 0.577215665;
+ double x_var = sqr(p.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+void
+test4()
+{
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.5, 1);
+ P p(3, 4);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(-0.5, 1);
- P p(1.5, 3);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g, p);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = p.a() + p.b() * 0.577215665;
- double x_var = sqr(p.b()) * 1.644934067;
- double x_skew = 1.139547;
- double x_kurtosis = 12./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ D::result_type v = d(g, p);
+ u.push_back(v);
}
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
{
- typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937 G;
- G g;
- D d(-0.5, 1);
- P p(3, 4);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g, p);
- u.push_back(v);
- }
- double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
- {
- double d = (u[i] - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= u.size();
- double dev = std::sqrt(var);
- skew /= u.size() * dev * var;
- kurtosis /= u.size() * var * var;
- kurtosis -= 3;
- double x_mean = p.a() + p.b() * 0.577215665;
- double x_var = sqr(p.b()) * 1.644934067;
- double x_skew = 1.139547;
- double x_kurtosis = 12./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.a() + p.b() * 0.577215665;
+ double x_var = sqr(p.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
index 7c26cc8a1c47..7c23630ed1e1 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
@@ -51,10 +51,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -91,10 +91,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -131,10 +131,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
index 8ed39df819d7..54a89b6b3f40 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
@@ -52,10 +52,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -93,10 +93,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -134,10 +134,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
index f5598978bf0a..a475624a58a8 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
@@ -50,10 +50,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -89,10 +89,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -128,10 +128,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
index c3bbdeb0ed6c..d24fbd9f9cf5 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
@@ -52,10 +52,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -93,10 +93,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -134,10 +134,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp
index e414932dc870..cfec8c0d81e1 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp
@@ -51,10 +51,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -95,10 +95,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -139,10 +139,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp
index 6da705eb26c7..a19654dbd575 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp
@@ -52,10 +52,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -97,10 +97,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -142,10 +142,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
index 5d14b3612b2e..3111912ec29c 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
@@ -20,6 +20,7 @@
#include <vector>
#include <iterator>
#include <numeric>
+#include <algorithm> // for sort
#include <cassert>
template <class T>
@@ -30,666 +31,710 @@ sqr(T x)
return x*x;
}
-int main()
+void
+test1()
{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {25, 62.5, 12.5};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test2()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {0, 62.5, 12.5};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test3()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 0, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {25, 0, 12.5};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
- {
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test4()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {25, 62.5, 0};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test5()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 0, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {25, 0, 0};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test6()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 25, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {0, 25, 0};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test7()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 0, 1};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {0, 0, 1};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test8()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16};
+ double p[] = {75, 25};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16};
- double p[] = {75, 25};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
- {
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test9()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16};
+ double p[] = {0, 25};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16};
- double p[] = {0, 25};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test10()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16};
+ double p[] = {1, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16};
- double p[] = {1, 0};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
+}
+
+void
+test11()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14};
+ double p[] = {1};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_constant_distribution<> D;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14};
- double p[] = {1};
- const size_t Np = sizeof(p) / sizeof(p[0]);
- D d(b, b+Np+1, p);
- const int N = 100000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::vector<double> prob(std::begin(p), std::end(p));
- double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
- prob[i] /= s;
- std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
{
- typedef std::vector<D::result_type>::iterator I;
- I lb = std::lower_bound(u.begin(), u.end(), b[i]);
- I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
- const size_t Ni = ub - lb;
- if (prob[i] == 0)
- assert(Ni == 0);
- else
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
{
- assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
- double mean = std::accumulate(lb, ub, 0.0) / Ni;
- double var = 0;
- double skew = 0;
- double kurtosis = 0;
- for (I j = lb; j != ub; ++j)
- {
- double d = (*j - mean);
- double d2 = sqr(d);
- var += d2;
- skew += d * d2;
- kurtosis += d2 * d2;
- }
- var /= Ni;
- double dev = std::sqrt(var);
- skew /= Ni * dev * var;
- kurtosis /= Ni * var * var;
- kurtosis -= 3;
- double x_mean = (b[i+1] + b[i]) / 2;
- double x_var = sqr(b[i+1] - b[i]) / 12;
- double x_skew = 0;
- double x_kurtosis = -6./5;
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
+ var += d2;
+ skew += dbl * d2;
+ kurtosis += d2 * d2;
}
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+ test7();
+ test8();
+ test9();
+ test10();
+ test11();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
index 6850115875bb..ffd53c05d37e 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
@@ -17,6 +17,7 @@
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
+#include <algorithm>
#include <vector>
#include <iterator>
#include <numeric>
@@ -72,10 +73,10 @@ int main()
double kurtosis = 0;
for (I j = lb; j != ub; ++j)
{
- double d = (*j - mean);
- double d2 = sqr(d);
+ double dbl = (*j - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= Ni;
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
index af75fce512e4..03da9b8960e4 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
@@ -19,10 +19,12 @@
#include <iostream>
#include <random>
+#include <algorithm>
#include <vector>
#include <iterator>
#include <numeric>
#include <cassert>
+#include <limits>
template <class T>
inline
@@ -38,306 +40,333 @@ f(double x, double a, double m, double b, double c)
return a + m*(sqr(x) - sqr(b))/2 + c*(x-b);
}
-int main()
+void
+test1()
{
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 1, 1, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_linear_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {0, 1, 1, 0};
- const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::sort(u.begin(), u.end());
- int kp = -1;
- double a;
- double m;
- double bk;
- double c;
- std::vector<double> areas(Np);
- double S = 0;
- for (int i = 0; i < areas.size(); ++i)
- {
- areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
- S += areas[i];
- }
- for (int i = 0; i < areas.size(); ++i)
- areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
- p[i] /= S;
- for (int i = 0; i < N; ++i)
- {
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
- if (k != kp)
- {
- a = 0;
- for (int j = 0; j < k; ++j)
- a += areas[j];
- m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
- bk = b[k];
- c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
- kp = k;
- }
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
- }
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
}
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a = std::numeric_limits<double>::quiet_NaN();
+ double m = std::numeric_limits<double>::quiet_NaN();
+ double bk = std::numeric_limits<double>::quiet_NaN();
+ double c = std::numeric_limits<double>::quiet_NaN();
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
{
- typedef std::piecewise_linear_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {0, 0, 1, 0};
- const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::sort(u.begin(), u.end());
- int kp = -1;
- double a;
- double m;
- double bk;
- double c;
- std::vector<double> areas(Np);
- double S = 0;
- for (int i = 0; i < areas.size(); ++i)
- {
- areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
- S += areas[i];
- }
- for (int i = 0; i < areas.size(); ++i)
- areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
- p[i] /= S;
- for (int i = 0; i < N; ++i)
- {
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
- if (k != kp)
- {
- a = 0;
- for (int j = 0; j < k; ++j)
- a += areas[j];
- m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
- bk = b[k];
- c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
- kp = k;
- }
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
- }
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
}
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_linear_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {1, 0, 0, 0};
- const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::sort(u.begin(), u.end());
- int kp = -1;
- double a;
- double m;
- double bk;
- double c;
- std::vector<double> areas(Np);
- double S = 0;
- for (int i = 0; i < areas.size(); ++i)
- {
- areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
- S += areas[i];
- }
- for (int i = 0; i < areas.size(); ++i)
- areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
- p[i] /= S;
- for (int i = 0; i < N; ++i)
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
- if (k != kp)
- {
- a = 0;
- for (int j = 0; j < k; ++j)
- a += areas[j];
- m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
- bk = b[k];
- c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
- kp = k;
- }
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
}
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
}
+}
+
+void
+test2()
+{
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 0, 1, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_linear_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16};
- double p[] = {0, 1, 0};
- const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::sort(u.begin(), u.end());
- int kp = -1;
- double a;
- double m;
- double bk;
- double c;
- std::vector<double> areas(Np);
- double S = 0;
- for (int i = 0; i < areas.size(); ++i)
- {
- areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
- S += areas[i];
- }
- for (int i = 0; i < areas.size(); ++i)
- areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
- p[i] /= S;
- for (int i = 0; i < N; ++i)
- {
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
- if (k != kp)
- {
- a = 0;
- for (int j = 0; j < k; ++j)
- a += areas[j];
- m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
- bk = b[k];
- c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
- kp = k;
- }
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
- }
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
}
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a = std::numeric_limits<double>::quiet_NaN();
+ double m = std::numeric_limits<double>::quiet_NaN();
+ double bk = std::numeric_limits<double>::quiet_NaN();
+ double c = std::numeric_limits<double>::quiet_NaN();
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
{
- typedef std::piecewise_linear_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14};
- double p[] = {1, 1};
- const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
- {
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
- }
- std::sort(u.begin(), u.end());
- int kp = -1;
- double a;
- double m;
- double bk;
- double c;
- std::vector<double> areas(Np);
- double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
{
- areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
- S += areas[i];
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
}
- for (int i = 0; i < areas.size(); ++i)
- areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
- p[i] /= S;
- for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+}
+
+void
+test3()
+{
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {1, 0, 0, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a = std::numeric_limits<double>::quiet_NaN();
+ double m = std::numeric_limits<double>::quiet_NaN();
+ double bk = std::numeric_limits<double>::quiet_NaN();
+ double c = std::numeric_limits<double>::quiet_NaN();
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
- if (k != kp)
- {
- a = 0;
- for (int j = 0; j < k; ++j)
- a += areas[j];
- m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
- bk = b[k];
- c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
- kp = k;
- }
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
}
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
}
+}
+
+void
+test4()
+{
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16};
+ double p[] = {0, 1, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
{
- typedef std::piecewise_linear_distribution<> D;
- typedef D::param_type P;
- typedef std::mt19937_64 G;
- G g;
- double b[] = {10, 14, 16, 17};
- double p[] = {25, 62.5, 12.5, 0};
- const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
- D d(b, b+Np+1, p);
- const int N = 1000000;
- std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a = std::numeric_limits<double>::quiet_NaN();
+ double m = std::numeric_limits<double>::quiet_NaN();
+ double bk = std::numeric_limits<double>::quiet_NaN();
+ double c = std::numeric_limits<double>::quiet_NaN();
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
{
- D::result_type v = d(g);
- assert(d.min() <= v && v < d.max());
- u.push_back(v);
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ assert(k < Np);
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
}
- std::sort(u.begin(), u.end());
- int kp = -1;
- double a;
- double m;
- double bk;
- double c;
- std::vector<double> areas(Np);
- double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+}
+
+void
+test5()
+{
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14};
+ double p[] = {1, 1};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a = std::numeric_limits<double>::quiet_NaN();
+ double m = std::numeric_limits<double>::quiet_NaN();
+ double bk = std::numeric_limits<double>::quiet_NaN();
+ double c = std::numeric_limits<double>::quiet_NaN();
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ assert(i < Np);
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
{
- areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
- S += areas[i];
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ assert(k < Np);
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
}
- for (int i = 0; i < areas.size(); ++i)
- areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
- p[i] /= S;
- for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+}
+
+void
+test6()
+{
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a = std::numeric_limits<double>::quiet_NaN();
+ double m = std::numeric_limits<double>::quiet_NaN();
+ double bk = std::numeric_limits<double>::quiet_NaN();
+ double c = std::numeric_limits<double>::quiet_NaN();
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
- if (k != kp)
- {
- a = 0;
- for (int j = 0; j < k; ++j)
- a += areas[j];
- m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
- bk = b[k];
- c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
- kp = k;
- }
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
}
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
}
}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
index fe704228e788..8054a69fed87 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
@@ -20,7 +20,9 @@
#include <vector>
#include <iterator>
#include <numeric>
+#include <algorithm> // for sort
#include <cassert>
+#include <limits>
template <class T>
inline
@@ -58,10 +60,10 @@ int main()
}
std::sort(u.begin(), u.end());
int kp = -1;
- double a;
- double m;
- double bk;
- double c;
+ double a = std::numeric_limits<double>::quiet_NaN();
+ double m = std::numeric_limits<double>::quiet_NaN();
+ double bk = std::numeric_limits<double>::quiet_NaN();
+ double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
for (int i = 0; i < areas.size(); ++i)
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
index 66693a8da55b..2abc9d4c6dd5 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
@@ -51,10 +51,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -92,10 +92,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -133,10 +133,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -174,10 +174,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -215,10 +215,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -256,10 +256,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -297,10 +297,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -338,10 +338,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -379,10 +379,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -431,10 +431,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp
index d83d48cac1e3..849f25107fa8 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp
@@ -51,10 +51,10 @@ int main()
double kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- double d = (u[i] - mean);
- double d2 = sqr(d);
+ double dbl = (u[i] - mean);
+ double d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
index 2663b2683bb4..e000363f3215 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
@@ -51,10 +51,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -91,10 +91,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -131,10 +131,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -171,10 +171,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -211,10 +211,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -251,10 +251,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -291,10 +291,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -331,10 +331,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -371,10 +371,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -411,10 +411,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
@@ -451,10 +451,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
index b5803f401465..d351f0caed71 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
@@ -51,10 +51,10 @@ int main()
D::result_type kurtosis = 0;
for (int i = 0; i < u.size(); ++i)
{
- D::result_type d = (u[i] - mean);
- D::result_type d2 = sqr(d);
+ D::result_type dbl = (u[i] - mean);
+ D::result_type d2 = sqr(dbl);
var += d2;
- skew += d * d2;
+ skew += dbl * d2;
kurtosis += d2 * d2;
}
var /= u.size();
diff --git a/test/std/re/re.alg/re.alg.match/awk.pass.cpp b/test/std/re/re.alg/re.alg.match/awk.pass.cpp
index e4b2f3ec5014..a32b2ca0ae32 100644
--- a/test/std/re/re.alg/re.alg.match/awk.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/awk.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "platform_support.h" // locale name macros
diff --git a/test/std/re/re.alg/re.alg.match/basic.fail.cpp b/test/std/re/re.alg/re.alg.match/basic.fail.cpp
index 82f8e3b7ee89..04ce8fdd201b 100644
--- a/test/std/re/re.alg/re.alg.match/basic.fail.cpp
+++ b/test/std/re/re.alg/re.alg.match/basic.fail.cpp
@@ -9,21 +9,22 @@
// <regex>
-// template <class ST, class SA, class Allocator, class charT, class traits>
-// bool regex_match(const basic_string<charT, ST, SA>&&,
+// template <class ST, class SA, class Allocator, class charT, class traits>
+// bool regex_match(const basic_string<charT, ST, SA>&&,
// match_results<
-// typename basic_string<charT, ST, SA>::const_iterator,
-// Allocator>&,
-// const basic_regex<charT, traits>&,
-// regex_constants::match_flag_type =
+// typename basic_string<charT, ST, SA>::const_iterator,
+// Allocator>&,
+// const basic_regex<charT, traits>&,
+// regex_constants::match_flag_type =
// regex_constants::match_default) = delete;
-#if __cplusplus <= 201402L
-#error
-#else
-
#include <regex>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+#error
+#endif
int main()
{
@@ -33,4 +34,3 @@ int main()
std::regex_match(std::string("abcde"), m, re);
}
}
-#endif
diff --git a/test/std/re/re.alg/re.alg.match/basic.pass.cpp b/test/std/re/re.alg/re.alg.match/basic.pass.cpp
index 2ddc07a2000f..901bf90e6386 100644
--- a/test/std/re/re.alg/re.alg.match/basic.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/basic.pass.cpp
@@ -23,6 +23,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "platform_support.h" // locale name macros
diff --git a/test/std/re/re.alg/re.alg.match/ecma.pass.cpp b/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
index 785a61c47f11..a4568f60167c 100644
--- a/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
@@ -23,6 +23,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "platform_support.h" // locale name macros
diff --git a/test/std/re/re.alg/re.alg.match/egrep.pass.cpp b/test/std/re/re.alg/re.alg.match/egrep.pass.cpp
index dd2e6038dc31..53cff850e2d4 100644
--- a/test/std/re/re.alg/re.alg.match/egrep.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/egrep.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
diff --git a/test/std/re/re.alg/re.alg.match/extended.pass.cpp b/test/std/re/re.alg/re.alg.match/extended.pass.cpp
index 9ca31d1814a6..5e08d0ac5fdb 100644
--- a/test/std/re/re.alg/re.alg.match/extended.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/extended.pass.cpp
@@ -23,6 +23,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "platform_support.h" // locale name macros
diff --git a/test/std/re/re.alg/re.alg.match/grep.pass.cpp b/test/std/re/re.alg/re.alg.match/grep.pass.cpp
index 2dc0966d6b8d..efd33cb11e03 100644
--- a/test/std/re/re.alg/re.alg.match/grep.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/grep.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
diff --git a/test/std/re/re.alg/re.alg.match/lookahead_capture.pass.cpp b/test/std/re/re.alg/re.alg.match/lookahead_capture.pass.cpp
index 949739b992cb..95f400ce88c9 100644
--- a/test/std/re/re.alg/re.alg.match/lookahead_capture.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/lookahead_capture.pass.cpp
@@ -16,12 +16,13 @@
// const basic_regex<charT, traits>& e,
// regex_constants::match_flag_type flags = regex_constants::match_default);
-// std::regex in ECMAScript mode should not ignore capture groups inside lookahead assertions.
+// std::regex in ECMAScript mode should not ignore capture groups inside lookahead assertions.
// For example, matching /(?=(a))(a)/ to "a" should yield two captures: \1 = "a", \2 = "a"
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
diff --git a/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp b/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp
index 0b4c6948140e..59b2832c4580 100644
--- a/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test1()
diff --git a/test/std/re/re.alg/re.alg.replace/test1.pass.cpp b/test/std/re/re.alg/re.alg.replace/test1.pass.cpp
index 9fd84fdc1f6e..13cc8f2a0dd2 100644
--- a/test/std/re/re.alg/re.alg.replace/test1.pass.cpp
+++ b/test/std/re/re.alg/re.alg.replace/test1.pass.cpp
@@ -22,6 +22,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
diff --git a/test/std/re/re.alg/re.alg.replace/test2.pass.cpp b/test/std/re/re.alg/re.alg.replace/test2.pass.cpp
index 63a4ed56933d..679644f09b68 100644
--- a/test/std/re/re.alg/re.alg.replace/test2.pass.cpp
+++ b/test/std/re/re.alg/re.alg.replace/test2.pass.cpp
@@ -22,6 +22,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
diff --git a/test/std/re/re.alg/re.alg.replace/test3.pass.cpp b/test/std/re/re.alg/re.alg.replace/test3.pass.cpp
index d1167860646f..c8b8c649d1da 100644
--- a/test/std/re/re.alg/re.alg.replace/test3.pass.cpp
+++ b/test/std/re/re.alg/re.alg.replace/test3.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.alg/re.alg.replace/test4.pass.cpp b/test/std/re/re.alg/re.alg.replace/test4.pass.cpp
index fba1bc19546a..251eae8f6e20 100644
--- a/test/std/re/re.alg/re.alg.replace/test4.pass.cpp
+++ b/test/std/re/re.alg/re.alg.replace/test4.pass.cpp
@@ -18,6 +18,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.alg/re.alg.replace/test5.pass.cpp b/test/std/re/re.alg/re.alg.replace/test5.pass.cpp
index 7190e41d5228..53720d6f72ae 100644
--- a/test/std/re/re.alg/re.alg.replace/test5.pass.cpp
+++ b/test/std/re/re.alg/re.alg.replace/test5.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.alg/re.alg.replace/test6.pass.cpp b/test/std/re/re.alg/re.alg.replace/test6.pass.cpp
index b01780077303..a00ac75193d5 100644
--- a/test/std/re/re.alg/re.alg.replace/test6.pass.cpp
+++ b/test/std/re/re.alg/re.alg.replace/test6.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.alg/re.alg.search/awk.pass.cpp b/test/std/re/re.alg/re.alg.search/awk.pass.cpp
index 7fc1b3fcc233..05d1f59e147a 100644
--- a/test/std/re/re.alg/re.alg.search/awk.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/awk.pass.cpp
@@ -23,6 +23,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "platform_support.h" // locale name macros
diff --git a/test/std/re/re.alg/re.alg.search/backup.pass.cpp b/test/std/re/re.alg/re.alg.search/backup.pass.cpp
index 7da58608705b..f33b844bed9c 100644
--- a/test/std/re/re.alg/re.alg.search/backup.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/backup.pass.cpp
@@ -20,6 +20,7 @@
#include <string>
#include <list>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.alg/re.alg.search/basic.fail.cpp b/test/std/re/re.alg/re.alg.search/basic.fail.cpp
index 9ab6a21ad9dc..430b0a3aa4c3 100644
--- a/test/std/re/re.alg/re.alg.search/basic.fail.cpp
+++ b/test/std/re/re.alg/re.alg.search/basic.fail.cpp
@@ -9,21 +9,22 @@
// <regex>
-// template <class ST, class SA, class Allocator, class charT, class traits>
-// bool regex_search(const basic_string<charT, ST, SA>&&,
+// template <class ST, class SA, class Allocator, class charT, class traits>
+// bool regex_search(const basic_string<charT, ST, SA>&&,
// match_results<
-// typename basic_string<charT, ST, SA>::const_iterator,
-// Allocator>&,
-// const basic_regex<charT, traits>&,
-// regex_constants::match_flag_type =
+// typename basic_string<charT, ST, SA>::const_iterator,
+// Allocator>&,
+// const basic_regex<charT, traits>&,
+// regex_constants::match_flag_type =
// regex_constants::match_default) = delete;
-#if __cplusplus <= 201402L
-#error
-#else
-
#include <regex>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+#error
+#endif
int main()
{
@@ -33,4 +34,3 @@ int main()
std::regex_search(std::string("abcde"), m, re);
}
}
-#endif
diff --git a/test/std/re/re.alg/re.alg.search/basic.pass.cpp b/test/std/re/re.alg/re.alg.search/basic.pass.cpp
index bdfcd9cc9bcd..f5157f563755 100644
--- a/test/std/re/re.alg/re.alg.search/basic.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/basic.pass.cpp
@@ -23,6 +23,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "platform_support.h" // locale name macros
diff --git a/test/std/re/re.alg/re.alg.search/ecma.pass.cpp b/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
index fb9fc26a281a..d6a3da6ea076 100644
--- a/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
@@ -23,6 +23,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "platform_support.h" // locale name macros
diff --git a/test/std/re/re.alg/re.alg.search/egrep.pass.cpp b/test/std/re/re.alg/re.alg.search/egrep.pass.cpp
index 1dffed44f227..0bf8386119ee 100644
--- a/test/std/re/re.alg/re.alg.search/egrep.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/egrep.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
diff --git a/test/std/re/re.alg/re.alg.search/extended.pass.cpp b/test/std/re/re.alg/re.alg.search/extended.pass.cpp
index 81eef2f9e4b9..88af3b908815 100644
--- a/test/std/re/re.alg/re.alg.search/extended.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/extended.pass.cpp
@@ -23,6 +23,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "platform_support.h" // locale name macros
diff --git a/test/std/re/re.alg/re.alg.search/grep.pass.cpp b/test/std/re/re.alg/re.alg.search/grep.pass.cpp
index 9d74c2417d2d..136f9958c9b2 100644
--- a/test/std/re/re.alg/re.alg.search/grep.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/grep.pass.cpp
@@ -34,9 +34,9 @@ extern "C" void LLVMFuzzerTestOneInput(const char *data)
std::string s((const char *)data, size);
std::regex re(s, flag);
std::regex_match(s, re);
- }
- catch (std::regex_error &ex) {}
- }
+ }
+ catch (std::regex_error &) {}
+ }
}
diff --git a/test/std/re/re.alg/re.alg.search/lookahead.pass.cpp b/test/std/re/re.alg/re.alg.search/lookahead.pass.cpp
index 9f5f9540165a..93424e188432 100644
--- a/test/std/re/re.alg/re.alg.search/lookahead.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/lookahead.pass.cpp
@@ -20,8 +20,9 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
-int main()
+int main()
{
assert(!std::regex_search("ab", std::regex("(?=^)b")));
assert(!std::regex_search("ab", std::regex("a(?=^)b")));
diff --git a/test/std/re/re.alg/re.alg.search/no_update_pos.pass.cpp b/test/std/re/re.alg/re.alg.search/no_update_pos.pass.cpp
index ef9cec5f736e..600425d8de35 100644
--- a/test/std/re/re.alg/re.alg.search/no_update_pos.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/no_update_pos.pass.cpp
@@ -18,6 +18,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.badexp/regex_error.pass.cpp b/test/std/re/re.badexp/regex_error.pass.cpp
index 02fecbda2d95..f1752716ec75 100644
--- a/test/std/re/re.badexp/regex_error.pass.cpp
+++ b/test/std/re/re.badexp/regex_error.pass.cpp
@@ -20,6 +20,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.const/re.err/error_type.pass.cpp b/test/std/re/re.const/re.err/error_type.pass.cpp
index 150855beb0a4..3609d41b9beb 100644
--- a/test/std/re/re.const/re.err/error_type.pass.cpp
+++ b/test/std/re/re.const/re.err/error_type.pass.cpp
@@ -34,6 +34,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.const/re.matchflag/match_flag_type.pass.cpp b/test/std/re/re.const/re.matchflag/match_flag_type.pass.cpp
index b48703c7579f..c7b2a80cd2a4 100644
--- a/test/std/re/re.const/re.matchflag/match_flag_type.pass.cpp
+++ b/test/std/re/re.const/re.matchflag/match_flag_type.pass.cpp
@@ -34,6 +34,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.const/re.matchflag/match_not_bol.pass.cpp b/test/std/re/re.const/re.matchflag/match_not_bol.pass.cpp
index 41ac0cee0d6a..03e8770dd68d 100644
--- a/test/std/re/re.const/re.matchflag/match_not_bol.pass.cpp
+++ b/test/std/re/re.const/re.matchflag/match_not_bol.pass.cpp
@@ -11,12 +11,13 @@
// <regex>
// match_not_bol:
-// The first character in the sequence [first,last) shall be treated as
-// though it is not at the beginning of a line, so the character ^ in the
+// The first character in the sequence [first,last) shall be treated as
+// though it is not at the beginning of a line, so the character ^ in the
// regular expression shall not match [first,first).
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.const/re.matchflag/match_not_eol.pass.cpp b/test/std/re/re.const/re.matchflag/match_not_eol.pass.cpp
index 594c9fb98453..1c9b154f1fcc 100644
--- a/test/std/re/re.const/re.matchflag/match_not_eol.pass.cpp
+++ b/test/std/re/re.const/re.matchflag/match_not_eol.pass.cpp
@@ -11,12 +11,13 @@
// <regex>
// match_not_eol:
-// The last character in the sequence [first,last) shall be treated as
-// though it is not at the end of a line, so the character "$" in
+// The last character in the sequence [first,last) shall be treated as
+// though it is not at the end of a line, so the character "$" in
// the regular expression shall not match [last,last).
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.const/re.synopt/syntax_option_type.pass.cpp b/test/std/re/re.const/re.synopt/syntax_option_type.pass.cpp
index 1c4f824448a6..ad6111cc4ee2 100644
--- a/test/std/re/re.const/re.synopt/syntax_option_type.pass.cpp
+++ b/test/std/re/re.const/re.synopt/syntax_option_type.pass.cpp
@@ -31,6 +31,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.fail.cpp b/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.fail.cpp
index 208de0e43cec..24fb3787ed1f 100644
--- a/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.fail.cpp
+++ b/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.fail.cpp
@@ -17,20 +17,20 @@
// regex_constants::match_flag_type m =
// regex_constants::match_default) = delete;
-#if __cplusplus <= 201402L
-#error
-#else
-
#include <regex>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+#error
+#endif
int main()
{
{
const char phone_book[] = "555-1234, 555-2345, 555-3456";
std::cregex_iterator i(
- std::begin(phone_book), std::end(phone_book),
+ std::begin(phone_book), std::end(phone_book),
std::regex("\\d{3}-\\d{4}"));
}
}
-#endif
diff --git a/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp b/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp
index c9fc7a3cd1cc..c1cabff39d54 100644
--- a/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp
+++ b/test/std/re/re.iter/re.regiter/re.regiter.cnstr/cnstr.pass.cpp
@@ -17,6 +17,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp b/test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp
index 9d4766dc876f..cb44fb37bc89 100644
--- a/test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp
+++ b/test/std/re/re.iter/re.regiter/re.regiter.cnstr/default.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp b/test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp
index e4933fe16f8e..800f56434160 100644
--- a/test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp
+++ b/test/std/re/re.iter/re.regiter/re.regiter.deref/deref.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp b/test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp
index 3ec0d6c0c3b4..f3b57f6bc9da 100644
--- a/test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp
+++ b/test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.regiter/types.pass.cpp b/test/std/re/re.iter/re.regiter/types.pass.cpp
index db1d3eb958bf..5b79957bea24 100644
--- a/test/std/re/re.iter/re.regiter/types.pass.cpp
+++ b/test/std/re/re.iter/re.regiter/types.pass.cpp
@@ -24,6 +24,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.fail.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.fail.cpp
index 6753b0ad506b..8f90b23907dc 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.fail.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.fail.cpp
@@ -18,13 +18,14 @@
// regex_constants::match_flag_type m =
// regex_constants::match_default);
-#if __cplusplus <= 201402L
-#error
-#else
-
#include <regex>
#include <vector>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+#error
+#endif
int main()
{
@@ -36,4 +37,3 @@ int main()
std::regex("\\d{3}-\\d{4}"), indices);
}
}
-#endif
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.pass.cpp
index a51b8274bdd8..6d8c2f35e424 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.pass.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/array.pass.cpp
@@ -20,6 +20,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp
index 382815e0c1cc..e71f3a69217e 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.fail.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.fail.cpp
index e58183682ea4..9d538730e809 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.fail.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.fail.cpp
@@ -17,12 +17,13 @@
// regex_constants::match_flag_type m =
// regex_constants::match_default);
-#if __cplusplus <= 201402L
-#error
-#else
-
#include <regex>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+#error
+#endif
int main()
{
@@ -33,4 +34,3 @@ int main()
std::regex("\\d{3}-\\d{4}"), {-1, 0, 1});
}
}
-#endif
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp
index b40d7eb9224d..6cffc0da9a52 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.fail.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.fail.cpp
index d0a100a1afcc..f4601f3ed033 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.fail.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.fail.cpp
@@ -16,12 +16,13 @@
// regex_constants::match_flag_type m =
// regex_constants::match_default);
-#if __cplusplus <= 201402L
-#error
-#else
-
#include <regex>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+#error
+#endif
int main()
{
@@ -32,4 +33,3 @@ int main()
std::regex("\\d{3}-\\d{4}"), -1);
}
}
-#endif
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.pass.cpp
index d8111363c176..37fe2d9767ef 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.pass.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/int.pass.cpp
@@ -18,6 +18,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.fail.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.fail.cpp
index 94d8f9667d2c..d5d5f4c63ceb 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.fail.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.fail.cpp
@@ -18,12 +18,13 @@
// regex_constants::match_flag_type m =
// regex_constants::match_default);
-#if __cplusplus <= 201402L
-#error
-#else
-
#include <regex>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+#error
+#endif
int main()
{
@@ -37,4 +38,3 @@ int main()
std::regex("\\d{3}-\\d{4}"), v);
}
}
-#endif
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.pass.cpp
index b04f5804509f..473a706dd854 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.pass.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/vector.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp
index d6399f1148b4..49d1b1b7ed54 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.deref/deref.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.deref/deref.pass.cpp
index b096e3c08275..73ec62cfc67d 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.deref/deref.pass.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.deref/deref.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.incr/post.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.incr/post.pass.cpp
index 727ab7af9376..7d55bc1113fa 100644
--- a/test/std/re/re.iter/re.tokiter/re.tokiter.incr/post.pass.cpp
+++ b/test/std/re/re.iter/re.tokiter/re.tokiter.incr/post.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.iter/re.tokiter/types.pass.cpp b/test/std/re/re.iter/re.tokiter/types.pass.cpp
index 89287bdd1d00..b7777fbeefff 100644
--- a/test/std/re/re.iter/re.tokiter/types.pass.cpp
+++ b/test/std/re/re.iter/re.tokiter/types.pass.cpp
@@ -24,6 +24,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp
index 96cadf166001..39c3a22ef725 100644
--- a/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp
@@ -17,6 +17,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.assign/assign.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign.pass.cpp
index 9c5f834b9452..97208c68c8d6 100644
--- a/test/std/re/re.regex/re.regex.assign/assign.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/assign.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
@@ -25,7 +26,7 @@ int main()
assert(r2.flags() == std::regex::ECMAScript);
assert(r2.mark_count() == 2);
assert(std::regex_search("ab", r2));
-
+
bool caught = false;
try { r2.assign("(def", std::regex::extended); }
catch(std::regex_error &) { caught = true; }
diff --git a/test/std/re/re.regex/re.regex.assign/assign_iter_iter_flag.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign_iter_iter_flag.pass.cpp
index 529a64a239a0..7cd4845f3073 100644
--- a/test/std/re/re.regex/re.regex.assign/assign_iter_iter_flag.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/assign_iter_iter_flag.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
diff --git a/test/std/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp
index dd39dee13ffb..33b9cad18335 100644
--- a/test/std/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp
index 679cd9df17fc..7ec4f77a5052 100644
--- a/test/std/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp
index 46f984da04db..247d27721be7 100644
--- a/test/std/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp
@@ -17,6 +17,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.assign/copy.pass.cpp b/test/std/re/re.regex/re.regex.assign/copy.pass.cpp
index 2a616ff012c1..3f212f772a38 100644
--- a/test/std/re/re.regex/re.regex.assign/copy.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/copy.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.assign/il.pass.cpp b/test/std/re/re.regex/re.regex.assign/il.pass.cpp
index a9d8ada4ff0e..022170f2d136 100644
--- a/test/std/re/re.regex/re.regex.assign/il.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/il.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.assign/ptr.pass.cpp b/test/std/re/re.regex/re.regex.assign/ptr.pass.cpp
index 4c42f822a1e5..d2af1f9b3d1a 100644
--- a/test/std/re/re.regex/re.regex.assign/ptr.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/ptr.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.assign/string.pass.cpp b/test/std/re/re.regex/re.regex.assign/string.pass.cpp
index 7f09e5364ac4..65cc4a345ed8 100644
--- a/test/std/re/re.regex/re.regex.assign/string.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/string.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.const/constants.pass.cpp b/test/std/re/re.regex/re.regex.const/constants.pass.cpp
index 85297b91f433..e699de819b0d 100644
--- a/test/std/re/re.regex/re.regex.const/constants.pass.cpp
+++ b/test/std/re/re.regex/re.regex.const/constants.pass.cpp
@@ -27,6 +27,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
template <class _Tp>
void where(const _Tp &) {}
diff --git a/test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp b/test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
index 4b7e5e629294..3f1eaf6b959e 100644
--- a/test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
@@ -16,13 +16,14 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
-int main()
+int main()
{
using std::regex_constants::awk;
assert(std::regex_match("\4", std::regex("\\4", awk)));
assert(std::regex_match("\41", std::regex("\\41", awk)));
assert(std::regex_match("\141", std::regex("\\141", awk)));
- assert(std::regex_match("\1411", std::regex("\\1411", awk)));
+ assert(std::regex_match("\141" "1", std::regex("\\1411", awk)));
}
diff --git a/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp b/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
index 9459cd74ccff..3c7e9f5e33c7 100644
--- a/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
@@ -17,8 +17,9 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
-static bool error_escape_thrown(const char *pat)
+static bool error_escape_thrown(const char *pat)
{
bool result = false;
try {
@@ -29,7 +30,7 @@ static bool error_escape_thrown(const char *pat)
return result;
}
-int main()
+int main()
{
assert(error_escape_thrown("[\\a]"));
assert(error_escape_thrown("\\a"));
diff --git a/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp b/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp
index c21672f02c98..0692a59542f6 100644
--- a/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp
@@ -17,8 +17,9 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
-static bool error_badrepeat_thrown(const char *pat)
+static bool error_badrepeat_thrown(const char *pat)
{
bool result = false;
try {
@@ -29,7 +30,7 @@ static bool error_badrepeat_thrown(const char *pat)
return result;
}
-int main()
+int main()
{
assert(error_badrepeat_thrown("?a"));
assert(error_badrepeat_thrown("*a"));
diff --git a/test/std/re/re.regex/re.regex.construct/copy.pass.cpp b/test/std/re/re.regex/re.regex.construct/copy.pass.cpp
index c2788f0fa2c6..a266289c6a88 100644
--- a/test/std/re/re.regex/re.regex.construct/copy.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/copy.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.construct/default.pass.cpp b/test/std/re/re.regex/re.regex.construct/default.pass.cpp
index d959c1ec5820..f1d7bf7696d9 100644
--- a/test/std/re/re.regex/re.regex.construct/default.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/default.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp b/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp
index 70d28df370d1..c1554d6c3ebb 100644
--- a/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
diff --git a/test/std/re/re.regex/re.regex.construct/iter_iter.pass.cpp b/test/std/re/re.regex/re.regex.construct/iter_iter.pass.cpp
index a38e16234191..4a93d173e6fc 100644
--- a/test/std/re/re.regex/re.regex.construct/iter_iter.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/iter_iter.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "test_macros.h"
template <class Iter>
void
diff --git a/test/std/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp b/test/std/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp
index c4c440e6d246..347989c5de15 100644
--- a/test/std/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp
@@ -19,6 +19,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "test_macros.h"
template <class Iter>
void
diff --git a/test/std/re/re.regex/re.regex.construct/ptr.pass.cpp b/test/std/re/re.regex/re.regex.construct/ptr.pass.cpp
index b99b58b469cf..05fba020566b 100644
--- a/test/std/re/re.regex/re.regex.construct/ptr.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/ptr.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.regex/re.regex.construct/ptr_flg.pass.cpp b/test/std/re/re.regex/re.regex.construct/ptr_flg.pass.cpp
index 138e20efbf65..d37b81592b4e 100644
--- a/test/std/re/re.regex/re.regex.construct/ptr_flg.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/ptr_flg.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp b/test/std/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp
index d623a15936f4..a0ceb70514bf 100644
--- a/test/std/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.regex/re.regex.construct/string.pass.cpp b/test/std/re/re.regex/re.regex.construct/string.pass.cpp
index b58b8e03cd20..a8f2e9bf6c20 100644
--- a/test/std/re/re.regex/re.regex.construct/string.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/string.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class String>
void
diff --git a/test/std/re/re.regex/re.regex.construct/string_flg.pass.cpp b/test/std/re/re.regex/re.regex.construct/string_flg.pass.cpp
index 768de568e229..5f87af10224a 100644
--- a/test/std/re/re.regex/re.regex.construct/string_flg.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/string_flg.pass.cpp
@@ -17,6 +17,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class String>
void
diff --git a/test/std/re/re.regex/re.regex.locale/imbue.pass.cpp b/test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
index c7ad39414c65..85900488f235 100644
--- a/test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
+++ b/test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
@@ -19,6 +19,7 @@
#include <locale>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h" // locale name macros
int main()
diff --git a/test/std/re/re.regex/re.regex.nonmemb/re.regex.nmswap/swap.pass.cpp b/test/std/re/re.regex/re.regex.nonmemb/re.regex.nmswap/swap.pass.cpp
index 9d3c481686e7..7b231726557d 100644
--- a/test/std/re/re.regex/re.regex.nonmemb/re.regex.nmswap/swap.pass.cpp
+++ b/test/std/re/re.regex/re.regex.nonmemb/re.regex.nmswap/swap.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/re.regex.swap/swap.pass.cpp b/test/std/re/re.regex/re.regex.swap/swap.pass.cpp
index cda8ef3541a2..a04c64d4a471 100644
--- a/test/std/re/re.regex/re.regex.swap/swap.pass.cpp
+++ b/test/std/re/re.regex/re.regex.swap/swap.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.regex/types.pass.cpp b/test/std/re/re.regex/types.pass.cpp
index 02011ac56ebb..5c0a5920d201 100644
--- a/test/std/re/re.regex/types.pass.cpp
+++ b/test/std/re/re.regex/types.pass.cpp
@@ -20,6 +20,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.results/re.results.acc/begin_end.pass.cpp b/test/std/re/re.results/re.results.acc/begin_end.pass.cpp
index 80c06f299bd7..a5ed051265cc 100644
--- a/test/std/re/re.results/re.results.acc/begin_end.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/begin_end.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp b/test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp
index a983c8afc81a..67ec606e9060 100644
--- a/test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/re.results.acc/index.pass.cpp b/test/std/re/re.results/re.results.acc/index.pass.cpp
index 79d4b9a23788..8118d3c9c300 100644
--- a/test/std/re/re.results/re.results.acc/index.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/index.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test(std::regex_constants::syntax_option_type syntax)
diff --git a/test/std/re/re.results/re.results.acc/length.pass.cpp b/test/std/re/re.results/re.results.acc/length.pass.cpp
index 91020851a308..7bf689c5b790 100644
--- a/test/std/re/re.results/re.results.acc/length.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/length.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/re.results.acc/position.pass.cpp b/test/std/re/re.results/re.results.acc/position.pass.cpp
index 2698e2d91693..b7df2c7c21c9 100644
--- a/test/std/re/re.results/re.results.acc/position.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/position.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/re.results.acc/prefix.pass.cpp b/test/std/re/re.results/re.results.acc/prefix.pass.cpp
index 58cdabc24df8..0c8572a0d713 100644
--- a/test/std/re/re.results/re.results.acc/prefix.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/prefix.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/re.results.acc/str.pass.cpp b/test/std/re/re.results/re.results.acc/str.pass.cpp
index 2ebfeabb2078..512bd9e69a88 100644
--- a/test/std/re/re.results/re.results.acc/str.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/str.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/re.results.acc/suffix.pass.cpp b/test/std/re/re.results/re.results.acc/suffix.pass.cpp
index b842ea861e43..a78bb67b4f0d 100644
--- a/test/std/re/re.results/re.results.acc/suffix.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/suffix.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/re.results.all/get_allocator.pass.cpp b/test/std/re/re.results/re.results.all/get_allocator.pass.cpp
index 04367953ad29..c4fe96d4a8a9 100644
--- a/test/std/re/re.results/re.results.all/get_allocator.pass.cpp
+++ b/test/std/re/re.results/re.results.all/get_allocator.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class CharT, class Allocator>
diff --git a/test/std/re/re.results/re.results.const/allocator.pass.cpp b/test/std/re/re.results/re.results.const/allocator.pass.cpp
index a24c669f657d..73347d08c694 100644
--- a/test/std/re/re.results/re.results.const/allocator.pass.cpp
+++ b/test/std/re/re.results/re.results.const/allocator.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class CharT, class Allocator>
diff --git a/test/std/re/re.results/re.results.const/default.pass.cpp b/test/std/re/re.results/re.results.const/default.pass.cpp
index e10fbfd76cf0..2fa85533a0ae 100644
--- a/test/std/re/re.results/re.results.const/default.pass.cpp
+++ b/test/std/re/re.results/re.results.const/default.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.results/re.results.form/form1.pass.cpp b/test/std/re/re.results/re.results.form/form1.pass.cpp
index 5b04c684fef1..55b5ade790a5 100644
--- a/test/std/re/re.results/re.results.form/form1.pass.cpp
+++ b/test/std/re/re.results/re.results.form/form1.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
int main()
diff --git a/test/std/re/re.results/re.results.form/form2.pass.cpp b/test/std/re/re.results/re.results.form/form2.pass.cpp
index b18b7fb9f555..ab7a525f4893 100644
--- a/test/std/re/re.results/re.results.form/form2.pass.cpp
+++ b/test/std/re/re.results/re.results.form/form2.pass.cpp
@@ -21,6 +21,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "test_allocator.h"
diff --git a/test/std/re/re.results/re.results.form/form3.pass.cpp b/test/std/re/re.results/re.results.form/form3.pass.cpp
index 27f2388adce0..e4c2e3d20283 100644
--- a/test/std/re/re.results/re.results.form/form3.pass.cpp
+++ b/test/std/re/re.results/re.results.form/form3.pass.cpp
@@ -21,6 +21,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
int main()
diff --git a/test/std/re/re.results/re.results.form/form4.pass.cpp b/test/std/re/re.results/re.results.form/form4.pass.cpp
index 1d44c32f6a8b..2c8aa9b8f9b5 100644
--- a/test/std/re/re.results/re.results.form/form4.pass.cpp
+++ b/test/std/re/re.results/re.results.form/form4.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.results/re.results.nonmember/equal.pass.cpp b/test/std/re/re.results/re.results.nonmember/equal.pass.cpp
index 7902b8e642e4..0a32f2e258a9 100644
--- a/test/std/re/re.results/re.results.nonmember/equal.pass.cpp
+++ b/test/std/re/re.results/re.results.nonmember/equal.pass.cpp
@@ -23,6 +23,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/re.results.size/empty.pass.cpp b/test/std/re/re.results/re.results.size/empty.pass.cpp
index 6634d92830dc..f03f5f752b3d 100644
--- a/test/std/re/re.results/re.results.size/empty.pass.cpp
+++ b/test/std/re/re.results/re.results.size/empty.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.results/re.results.size/max_size.pass.cpp b/test/std/re/re.results/re.results.size/max_size.pass.cpp
index 0b31409275bf..1ba29b926d5e 100644
--- a/test/std/re/re.results/re.results.size/max_size.pass.cpp
+++ b/test/std/re/re.results/re.results.size/max_size.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.results/re.results.state/ready.pass.cpp b/test/std/re/re.results/re.results.state/ready.pass.cpp
index 8f586c3f32d6..1348016bbd91 100644
--- a/test/std/re/re.results/re.results.state/ready.pass.cpp
+++ b/test/std/re/re.results/re.results.state/ready.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test1()
diff --git a/test/std/re/re.results/re.results.swap/member_swap.pass.cpp b/test/std/re/re.results/re.results.swap/member_swap.pass.cpp
index 09b85c0ff5d2..cd1d72a2d4d1 100644
--- a/test/std/re/re.results/re.results.swap/member_swap.pass.cpp
+++ b/test/std/re/re.results/re.results.swap/member_swap.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/re.results.swap/non_member_swap.pass.cpp b/test/std/re/re.results/re.results.swap/non_member_swap.pass.cpp
index 3f5e34df44c5..81e6c819e54c 100644
--- a/test/std/re/re.results/re.results.swap/non_member_swap.pass.cpp
+++ b/test/std/re/re.results/re.results.swap/non_member_swap.pass.cpp
@@ -17,6 +17,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
void
test()
diff --git a/test/std/re/re.results/types.pass.cpp b/test/std/re/re.results/types.pass.cpp
index 4d553837efe8..0b76875feaee 100644
--- a/test/std/re/re.results/types.pass.cpp
+++ b/test/std/re/re.results/types.pass.cpp
@@ -27,6 +27,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp b/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp
index c14d5bcdefae..be05afd4cf88 100644
--- a/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.submatch/re.submatch.members/compare_sub_match.pass.cpp b/test/std/re/re.submatch/re.submatch.members/compare_sub_match.pass.cpp
index 0874742f1c9a..4b74f65d7826 100644
--- a/test/std/re/re.submatch/re.submatch.members/compare_sub_match.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.members/compare_sub_match.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp b/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp
index 48c05ca91d05..097a3918ed13 100644
--- a/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.submatch/re.submatch.members/default.pass.cpp b/test/std/re/re.submatch/re.submatch.members/default.pass.cpp
index 451466af83cd..1805f7eb3001 100644
--- a/test/std/re/re.submatch/re.submatch.members/default.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.members/default.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.submatch/re.submatch.members/length.pass.cpp b/test/std/re/re.submatch/re.submatch.members/length.pass.cpp
index 4874c0d05921..20095483d80b 100644
--- a/test/std/re/re.submatch/re.submatch.members/length.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.members/length.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.submatch/re.submatch.members/operator_string.pass.cpp b/test/std/re/re.submatch/re.submatch.members/operator_string.pass.cpp
index dd856a56d0b0..4c2877cd4db0 100644
--- a/test/std/re/re.submatch/re.submatch.members/operator_string.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.members/operator_string.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.submatch/re.submatch.members/str.pass.cpp b/test/std/re/re.submatch/re.submatch.members/str.pass.cpp
index ca5fd7d78ac7..9a821890178c 100644
--- a/test/std/re/re.submatch/re.submatch.members/str.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.members/str.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.submatch/re.submatch.op/compare.pass.cpp b/test/std/re/re.submatch/re.submatch.op/compare.pass.cpp
index 36376aa0563c..8000ab6b75ce 100644
--- a/test/std/re/re.submatch/re.submatch.op/compare.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.op/compare.pass.cpp
@@ -215,6 +215,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
@@ -282,6 +283,6 @@ int main()
test(std::string("1234"), std::string("123"));
test(std::wstring(L"123"), std::wstring(L"123"));
test(std::wstring(L"1234"), std::wstring(L"123"));
- test(std::string("123\00056", 6), std::string("123\00056", 6), false);
- test(std::wstring(L"123\00056", 6), std::wstring(L"123\00056", 6), false);
+ test(std::string("123\000" "56", 6), std::string("123\000" "56", 6), false);
+ test(std::wstring(L"123\000" L"56", 6), std::wstring(L"123\000" L"56", 6), false);
}
diff --git a/test/std/re/re.submatch/re.submatch.op/stream.pass.cpp b/test/std/re/re.submatch/re.submatch.op/stream.pass.cpp
index 050bb062e710..9f8c9869e12e 100644
--- a/test/std/re/re.submatch/re.submatch.op/stream.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.op/stream.pass.cpp
@@ -18,6 +18,7 @@
#include <regex>
#include <sstream>
#include <cassert>
+#include "test_macros.h"
template <class CharT>
void
diff --git a/test/std/re/re.submatch/types.pass.cpp b/test/std/re/re.submatch/types.pass.cpp
index 47c79149a8d3..e5a00ca0416c 100644
--- a/test/std/re/re.submatch/types.pass.cpp
+++ b/test/std/re/re.submatch/types.pass.cpp
@@ -26,6 +26,7 @@
#include <regex>
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/cmatch.pass.cpp b/test/std/re/re.syn/cmatch.pass.cpp
index 1364b7873ea5..bf467bcbc772 100644
--- a/test/std/re/re.syn/cmatch.pass.cpp
+++ b/test/std/re/re.syn/cmatch.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/cregex_iterator.pass.cpp b/test/std/re/re.syn/cregex_iterator.pass.cpp
index 7b6ac133f5ac..ed5839da0ee5 100644
--- a/test/std/re/re.syn/cregex_iterator.pass.cpp
+++ b/test/std/re/re.syn/cregex_iterator.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/cregex_token_iterator.pass.cpp b/test/std/re/re.syn/cregex_token_iterator.pass.cpp
index 36ee9b66ea9d..85dca0cf2602 100644
--- a/test/std/re/re.syn/cregex_token_iterator.pass.cpp
+++ b/test/std/re/re.syn/cregex_token_iterator.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/csub_match.pass.cpp b/test/std/re/re.syn/csub_match.pass.cpp
index e0de67b4feb7..2a87d8b6ef5c 100644
--- a/test/std/re/re.syn/csub_match.pass.cpp
+++ b/test/std/re/re.syn/csub_match.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/regex.pass.cpp b/test/std/re/re.syn/regex.pass.cpp
index a208442b966c..32fcb82f1a9c 100644
--- a/test/std/re/re.syn/regex.pass.cpp
+++ b/test/std/re/re.syn/regex.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/smatch.pass.cpp b/test/std/re/re.syn/smatch.pass.cpp
index 87323538968e..e2fc061133af 100644
--- a/test/std/re/re.syn/smatch.pass.cpp
+++ b/test/std/re/re.syn/smatch.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/sregex_iterator.pass.cpp b/test/std/re/re.syn/sregex_iterator.pass.cpp
index 7acd96194b0e..146316408ba6 100644
--- a/test/std/re/re.syn/sregex_iterator.pass.cpp
+++ b/test/std/re/re.syn/sregex_iterator.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/sregex_token_iterator.pass.cpp b/test/std/re/re.syn/sregex_token_iterator.pass.cpp
index 185fd627b4fb..aa85680c5a3b 100644
--- a/test/std/re/re.syn/sregex_token_iterator.pass.cpp
+++ b/test/std/re/re.syn/sregex_token_iterator.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/ssub_match.pass.cpp b/test/std/re/re.syn/ssub_match.pass.cpp
index b378339664c0..181b7a307b58 100644
--- a/test/std/re/re.syn/ssub_match.pass.cpp
+++ b/test/std/re/re.syn/ssub_match.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/wcmatch.pass.cpp b/test/std/re/re.syn/wcmatch.pass.cpp
index 3ca8ed51eabc..0eb125602305 100644
--- a/test/std/re/re.syn/wcmatch.pass.cpp
+++ b/test/std/re/re.syn/wcmatch.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/wcregex_iterator.pass.cpp b/test/std/re/re.syn/wcregex_iterator.pass.cpp
index 99469ecf82b0..20c0d0d546e8 100644
--- a/test/std/re/re.syn/wcregex_iterator.pass.cpp
+++ b/test/std/re/re.syn/wcregex_iterator.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/wcregex_token_iterator.pass.cpp b/test/std/re/re.syn/wcregex_token_iterator.pass.cpp
index f16911f2985a..01a7f3c746a9 100644
--- a/test/std/re/re.syn/wcregex_token_iterator.pass.cpp
+++ b/test/std/re/re.syn/wcregex_token_iterator.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/wcsub_match.pass.cpp b/test/std/re/re.syn/wcsub_match.pass.cpp
index 7e8c872b6033..f757d3f7c5cc 100644
--- a/test/std/re/re.syn/wcsub_match.pass.cpp
+++ b/test/std/re/re.syn/wcsub_match.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/wregex.pass.cpp b/test/std/re/re.syn/wregex.pass.cpp
index 635eac0176cc..23be43baa914 100644
--- a/test/std/re/re.syn/wregex.pass.cpp
+++ b/test/std/re/re.syn/wregex.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/wsmatch.pass.cpp b/test/std/re/re.syn/wsmatch.pass.cpp
index 092c7d16d7a7..1483808bd832 100644
--- a/test/std/re/re.syn/wsmatch.pass.cpp
+++ b/test/std/re/re.syn/wsmatch.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/wsregex_iterator.pass.cpp b/test/std/re/re.syn/wsregex_iterator.pass.cpp
index 0052716e46d8..436e6d717f8a 100644
--- a/test/std/re/re.syn/wsregex_iterator.pass.cpp
+++ b/test/std/re/re.syn/wsregex_iterator.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/wsregex_token_iterator.pass.cpp b/test/std/re/re.syn/wsregex_token_iterator.pass.cpp
index dc71991eb9b1..5ceb241f3dc1 100644
--- a/test/std/re/re.syn/wsregex_token_iterator.pass.cpp
+++ b/test/std/re/re.syn/wsregex_token_iterator.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.syn/wssub_match.pass.cpp b/test/std/re/re.syn/wssub_match.pass.cpp
index 2360a15513db..23b92bb2d4ee 100644
--- a/test/std/re/re.syn/wssub_match.pass.cpp
+++ b/test/std/re/re.syn/wssub_match.pass.cpp
@@ -13,6 +13,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.traits/default.pass.cpp b/test/std/re/re.traits/default.pass.cpp
index defadd95378b..b1e23587d21f 100644
--- a/test/std/re/re.traits/default.pass.cpp
+++ b/test/std/re/re.traits/default.pass.cpp
@@ -19,6 +19,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h" // locale name macros
int main()
diff --git a/test/std/re/re.traits/getloc.pass.cpp b/test/std/re/re.traits/getloc.pass.cpp
index 0b7810a2099d..929659d004b0 100644
--- a/test/std/re/re.traits/getloc.pass.cpp
+++ b/test/std/re/re.traits/getloc.pass.cpp
@@ -18,6 +18,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h" // locale name macros
int main()
diff --git a/test/std/re/re.traits/imbue.pass.cpp b/test/std/re/re.traits/imbue.pass.cpp
index 6988058a832c..04b4f5f7692b 100644
--- a/test/std/re/re.traits/imbue.pass.cpp
+++ b/test/std/re/re.traits/imbue.pass.cpp
@@ -19,6 +19,7 @@
#include <locale>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h" // locale name macros
int main()
diff --git a/test/std/re/re.traits/isctype.pass.cpp b/test/std/re/re.traits/isctype.pass.cpp
index ad69f05ae75e..3d1e7470a883 100644
--- a/test/std/re/re.traits/isctype.pass.cpp
+++ b/test/std/re/re.traits/isctype.pass.cpp
@@ -13,8 +13,13 @@
// bool isctype(charT c, char_class_type f) const;
+// TODO(EricWF): This test takes 40+ minutes to build with Clang 3.8 under ASAN or MSAN.
+// UNSUPPORTED: asan, msan
+
+
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.traits/length.pass.cpp b/test/std/re/re.traits/length.pass.cpp
index 473c233c531e..b80f9b5b400a 100644
--- a/test/std/re/re.traits/length.pass.cpp
+++ b/test/std/re/re.traits/length.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.traits/lookup_classname.pass.cpp b/test/std/re/re.traits/lookup_classname.pass.cpp
index 0b1b18eb5077..4f7cf61ebf99 100644
--- a/test/std/re/re.traits/lookup_classname.pass.cpp
+++ b/test/std/re/re.traits/lookup_classname.pass.cpp
@@ -18,6 +18,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class char_type>
@@ -33,6 +34,19 @@ test(const char_type* A,
int main()
{
+// if __regex_word is not distinct from all the classes, bad things happen
+// See https://llvm.org/bugs/show_bug.cgi?id=26476 for an example.
+ assert((std::ctype_base::space & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::print & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::cntrl & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::upper & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::lower & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::alpha & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::digit & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::punct & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::xdigit & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::blank & std::regex_traits<char>::__regex_word) == 0);
+
test("d", std::ctype_base::digit);
test("D", std::ctype_base::digit);
test("d", std::ctype_base::digit, true);
diff --git a/test/std/re/re.traits/lookup_collatename.pass.cpp b/test/std/re/re.traits/lookup_collatename.pass.cpp
index a7cd5f071561..3aeed7bddf75 100644
--- a/test/std/re/re.traits/lookup_collatename.pass.cpp
+++ b/test/std/re/re.traits/lookup_collatename.pass.cpp
@@ -23,8 +23,9 @@
#include <regex>
#include <iterator>
#include <cassert>
-#include "test_iterators.h"
+#include "test_macros.h"
+#include "test_iterators.h"
#include "platform_support.h" // locale name macros
template <class char_type>
diff --git a/test/std/re/re.traits/transform.pass.cpp b/test/std/re/re.traits/transform.pass.cpp
index 85235e045d88..57e6b753abef 100644
--- a/test/std/re/re.traits/transform.pass.cpp
+++ b/test/std/re/re.traits/transform.pass.cpp
@@ -19,8 +19,8 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
-
#include "platform_support.h" // locale name macros
int main()
diff --git a/test/std/re/re.traits/transform_primary.pass.cpp b/test/std/re/re.traits/transform_primary.pass.cpp
index 438cd75452bb..03b4f3985a60 100644
--- a/test/std/re/re.traits/transform_primary.pass.cpp
+++ b/test/std/re/re.traits/transform_primary.pass.cpp
@@ -20,8 +20,9 @@
#include <regex>
#include <cassert>
-#include "test_iterators.h"
+#include "test_macros.h"
+#include "test_iterators.h"
#include "platform_support.h" // locale name macros
int main()
diff --git a/test/std/re/re.traits/translate.pass.cpp b/test/std/re/re.traits/translate.pass.cpp
index c3523387c56b..7eaf30ea71c3 100644
--- a/test/std/re/re.traits/translate.pass.cpp
+++ b/test/std/re/re.traits/translate.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.traits/translate_nocase.pass.cpp b/test/std/re/re.traits/translate_nocase.pass.cpp
index f9fa38ddf26a..bf79629d33b4 100644
--- a/test/std/re/re.traits/translate_nocase.pass.cpp
+++ b/test/std/re/re.traits/translate_nocase.pass.cpp
@@ -25,6 +25,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h"
int main()
diff --git a/test/std/re/re.traits/types.pass.cpp b/test/std/re/re.traits/types.pass.cpp
index 50586a1f29f3..611ef04342fe 100644
--- a/test/std/re/re.traits/types.pass.cpp
+++ b/test/std/re/re.traits/types.pass.cpp
@@ -20,6 +20,7 @@
#include <regex>
#include <type_traits>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/re/re.traits/value.pass.cpp b/test/std/re/re.traits/value.pass.cpp
index 349a29cc6bc1..dfed66c35c46 100644
--- a/test/std/re/re.traits/value.pass.cpp
+++ b/test/std/re/re.traits/value.pass.cpp
@@ -15,6 +15,7 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
int main()
{
diff --git a/test/std/strings/basic.string.literals/literal.pass.cpp b/test/std/strings/basic.string.literals/literal.pass.cpp
index dbb5f681395b..d121e25ba270 100644
--- a/test/std/strings/basic.string.literals/literal.pass.cpp
+++ b/test/std/strings/basic.string.literals/literal.pass.cpp
@@ -7,12 +7,14 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
#include <string>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std::literals::string_literals;
static_assert ( std::is_same<decltype( "Hi"s), std::string>::value, "" );
@@ -20,28 +22,27 @@ int main()
static_assert ( std::is_same<decltype( L"Hi"s), std::wstring>::value, "" );
static_assert ( std::is_same<decltype( u"Hi"s), std::u16string>::value, "" );
static_assert ( std::is_same<decltype( U"Hi"s), std::u32string>::value, "" );
-
+
std::string foo;
std::wstring Lfoo;
std::u16string ufoo;
std::u32string Ufoo;
-
+
foo = ""s; assert( foo.size() == 0);
foo = u8""s; assert( foo.size() == 0);
Lfoo = L""s; assert(Lfoo.size() == 0);
ufoo = u""s; assert(ufoo.size() == 0);
Ufoo = U""s; assert(Ufoo.size() == 0);
-
+
foo = " "s; assert( foo.size() == 1);
foo = u8" "s; assert( foo.size() == 1);
Lfoo = L" "s; assert(Lfoo.size() == 1);
ufoo = u" "s; assert(ufoo.size() == 1);
Ufoo = U" "s; assert(Ufoo.size() == 1);
-
+
foo = "ABC"s; assert( foo == "ABC"); assert( foo == std::string ( "ABC"));
foo = u8"ABC"s; assert( foo == u8"ABC"); assert( foo == std::string (u8"ABC"));
Lfoo = L"ABC"s; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring ( L"ABC"));
ufoo = u"ABC"s; assert(ufoo == u"ABC"); assert(ufoo == std::u16string( u"ABC"));
Ufoo = U"ABC"s; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string( U"ABC"));
-#endif
}
diff --git a/test/std/strings/basic.string.literals/literal1.fail.cpp b/test/std/strings/basic.string.literals/literal1.fail.cpp
index 6ba0b30d458d..721440d8a3a5 100644
--- a/test/std/strings/basic.string.literals/literal1.fail.cpp
+++ b/test/std/strings/basic.string.literals/literal1.fail.cpp
@@ -7,16 +7,15 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
#include <string>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::string;
string foo = ""s; // should fail w/conversion operator not found
-#else
-#error
-#endif
}
diff --git a/test/std/strings/basic.string.literals/literal1.pass.cpp b/test/std/strings/basic.string.literals/literal1.pass.cpp
index f5143746b0bb..f0b7b463f85e 100644
--- a/test/std/strings/basic.string.literals/literal1.pass.cpp
+++ b/test/std/strings/basic.string.literals/literal1.pass.cpp
@@ -7,14 +7,15 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
#include <string>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std::literals;
std::string foo = ""s;
-#endif
}
diff --git a/test/std/strings/basic.string.literals/literal2.fail.cpp b/test/std/strings/basic.string.literals/literal2.fail.cpp
index 68f1d254e327..99f92fde9724 100644
--- a/test/std/strings/basic.string.literals/literal2.fail.cpp
+++ b/test/std/strings/basic.string.literals/literal2.fail.cpp
@@ -7,14 +7,13 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
#include <string>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
std::string foo = ""s; // should fail w/conversion operator not found
-#else
-#error
-#endif
}
diff --git a/test/std/strings/basic.string.literals/literal2.pass.cpp b/test/std/strings/basic.string.literals/literal2.pass.cpp
index 86d28e60e52b..3cc2936a115d 100644
--- a/test/std/strings/basic.string.literals/literal2.pass.cpp
+++ b/test/std/strings/basic.string.literals/literal2.pass.cpp
@@ -7,14 +7,15 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
#include <string>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std::literals::string_literals;
std::string foo = ""s;
-#endif
}
diff --git a/test/std/strings/basic.string.literals/literal3.pass.cpp b/test/std/strings/basic.string.literals/literal3.pass.cpp
index 98e3e40e058c..d6e8c8f88ecd 100644
--- a/test/std/strings/basic.string.literals/literal3.pass.cpp
+++ b/test/std/strings/basic.string.literals/literal3.pass.cpp
@@ -7,14 +7,15 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
#include <string>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std;
string foo = ""s;
-#endif
}
diff --git a/test/std/strings/basic.string/string.access/at.pass.cpp b/test/std/strings/basic.string/string.access/at.pass.cpp
index 87998e18c581..8dc0c57cb7b4 100644
--- a/test/std/strings/basic.string/string.access/at.pass.cpp
+++ b/test/std/strings/basic.string/string.access/at.pass.cpp
@@ -46,7 +46,7 @@ int main()
test(S("123"), 2);
test(S("123"), 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), 0);
diff --git a/test/std/strings/basic.string/string.access/back.pass.cpp b/test/std/strings/basic.string/string.access/back.pass.cpp
index e91521441b80..adf22bf0d27b 100644
--- a/test/std/strings/basic.string/string.access/back.pass.cpp
+++ b/test/std/strings/basic.string/string.access/back.pass.cpp
@@ -39,7 +39,7 @@ int main()
test(S("1"));
test(S("1234567890123456789012345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S("1"));
diff --git a/test/std/strings/basic.string/string.access/db_back.pass.cpp b/test/std/strings/basic.string/string.access/db_back.pass.cpp
index 2b31fabc7c70..e65ef2cef88d 100644
--- a/test/std/strings/basic.string/string.access/db_back.pass.cpp
+++ b/test/std/strings/basic.string/string.access/db_back.pass.cpp
@@ -33,7 +33,7 @@ int main()
assert(s.back() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s(1, '\0');
diff --git a/test/std/strings/basic.string/string.access/db_cback.pass.cpp b/test/std/strings/basic.string/string.access/db_cback.pass.cpp
index 7feb4239f07a..ee99aee10e32 100644
--- a/test/std/strings/basic.string/string.access/db_cback.pass.cpp
+++ b/test/std/strings/basic.string/string.access/db_cback.pass.cpp
@@ -31,7 +31,7 @@ int main()
assert(s.back() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
const S s;
diff --git a/test/std/strings/basic.string/string.access/db_cfront.pass.cpp b/test/std/strings/basic.string/string.access/db_cfront.pass.cpp
index 9f7785b85cda..13049624534f 100644
--- a/test/std/strings/basic.string/string.access/db_cfront.pass.cpp
+++ b/test/std/strings/basic.string/string.access/db_cfront.pass.cpp
@@ -31,7 +31,7 @@ int main()
assert(s.front() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
const S s;
diff --git a/test/std/strings/basic.string/string.access/db_cindex.pass.cpp b/test/std/strings/basic.string/string.access/db_cindex.pass.cpp
index 6294200104ba..f96ead7bf251 100644
--- a/test/std/strings/basic.string/string.access/db_cindex.pass.cpp
+++ b/test/std/strings/basic.string/string.access/db_cindex.pass.cpp
@@ -32,7 +32,7 @@ int main()
assert(s[1] == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
const S s;
diff --git a/test/std/strings/basic.string/string.access/db_front.pass.cpp b/test/std/strings/basic.string/string.access/db_front.pass.cpp
index ff675bc5c217..881a5ede3738 100644
--- a/test/std/strings/basic.string/string.access/db_front.pass.cpp
+++ b/test/std/strings/basic.string/string.access/db_front.pass.cpp
@@ -33,7 +33,7 @@ int main()
assert(s.front() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s(1, '\0');
diff --git a/test/std/strings/basic.string/string.access/db_index.pass.cpp b/test/std/strings/basic.string/string.access/db_index.pass.cpp
index b20e20188023..981a55d11037 100644
--- a/test/std/strings/basic.string/string.access/db_index.pass.cpp
+++ b/test/std/strings/basic.string/string.access/db_index.pass.cpp
@@ -32,7 +32,7 @@ int main()
assert(s[1] == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s;
diff --git a/test/std/strings/basic.string/string.access/front.pass.cpp b/test/std/strings/basic.string/string.access/front.pass.cpp
index ed80916f16f0..5400ddb39dc0 100644
--- a/test/std/strings/basic.string/string.access/front.pass.cpp
+++ b/test/std/strings/basic.string/string.access/front.pass.cpp
@@ -39,7 +39,7 @@ int main()
test(S("1"));
test(S("1234567890123456789012345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S("1"));
diff --git a/test/std/strings/basic.string/string.access/index.pass.cpp b/test/std/strings/basic.string/string.access/index.pass.cpp
index cd3162385160..b45a399320ba 100644
--- a/test/std/strings/basic.string/string.access/index.pass.cpp
+++ b/test/std/strings/basic.string/string.access/index.pass.cpp
@@ -36,7 +36,7 @@ int main()
const S s2 = S();
assert(s2[0] == '\0');
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("0123456789");
diff --git a/test/std/strings/basic.string/string.capacity/capacity.pass.cpp b/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
index c05346a633e9..4b09c096792c 100644
--- a/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
@@ -49,7 +49,7 @@ int main()
s.erase(50);
test(s);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s;
diff --git a/test/std/strings/basic.string/string.capacity/clear.pass.cpp b/test/std/strings/basic.string/string.capacity/clear.pass.cpp
index b73af7599344..e0254c0460e4 100644
--- a/test/std/strings/basic.string/string.capacity/clear.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/clear.pass.cpp
@@ -39,7 +39,7 @@ int main()
s.erase(50);
test(s);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s;
diff --git a/test/std/strings/basic.string/string.capacity/empty.pass.cpp b/test/std/strings/basic.string/string.capacity/empty.pass.cpp
index ac65f5144858..fbed5c36c3f4 100644
--- a/test/std/strings/basic.string/string.capacity/empty.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/empty.pass.cpp
@@ -31,7 +31,7 @@ int main()
test(S("123"));
test(S("12345678901234567890123456789012345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.capacity/length.pass.cpp b/test/std/strings/basic.string/string.capacity/length.pass.cpp
index d3ae1aaee036..13e966dc619e 100644
--- a/test/std/strings/basic.string/string.capacity/length.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/length.pass.cpp
@@ -31,7 +31,7 @@ int main()
test(S("123"));
test(S("12345678901234567890123456789012345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.capacity/max_size.pass.cpp b/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
index d857be28a6c9..fca14ddca561 100644
--- a/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -63,7 +63,7 @@ int main()
test(S("123"));
test(S("12345678901234567890123456789012345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp b/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
index 9c8f67950fb4..e92a0e1054f6 100644
--- a/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
@@ -37,7 +37,7 @@ int main()
test(S("123"));
test(S("12345678901234567890123456789012345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
index 569ca760c7ce..b2c254d1fb25 100644
--- a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
@@ -16,6 +16,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -25,7 +26,7 @@ test(S s)
typename S::size_type old_cap = s.capacity();
S s0 = s;
s.reserve();
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == s0);
assert(s.capacity() <= old_cap);
assert(s.capacity() >= s.size());
@@ -83,7 +84,7 @@ int main()
test(s, S::npos);
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
{
diff --git a/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp b/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
index 16eca38e8012..558941599578 100644
--- a/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
@@ -16,6 +16,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -25,7 +26,7 @@ test(S s, typename S::size_type n, S expected)
try
{
s.resize(n);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(n <= s.max_size());
assert(s == expected);
}
@@ -56,7 +57,7 @@ int main()
S("12345678901234567890123456789012345678901234567890\0\0\0\0\0\0\0\0\0\0", 60));
test(S(), S::npos, S("not going to happen"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), 0, S());
diff --git a/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp b/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
index cb01be01f34b..79f972b2fee3 100644
--- a/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
@@ -16,6 +16,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -25,7 +26,7 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected)
try
{
s.resize(n, c);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(n <= s.max_size());
assert(s == expected);
}
@@ -56,7 +57,7 @@ int main()
S("12345678901234567890123456789012345678901234567890aaaaaaaaaa"));
test(S(), S::npos, 'a', S("not going to happen"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), 0, 'a', S());
diff --git a/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp b/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
index aacbffd098f0..656ea1d11a7c 100644
--- a/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -23,7 +24,7 @@ test(S s)
typename S::size_type old_cap = s.capacity();
S s0 = s;
s.shrink_to_fit();
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == s0);
assert(s.capacity() <= old_cap);
assert(s.capacity() >= s.size());
@@ -44,7 +45,7 @@ int main()
s.erase(50);
test(s);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s;
diff --git a/test/std/strings/basic.string/string.capacity/size.pass.cpp b/test/std/strings/basic.string/string.capacity/size.pass.cpp
index 21b475a8113f..4657aea442f7 100644
--- a/test/std/strings/basic.string/string.capacity/size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/size.pass.cpp
@@ -31,7 +31,7 @@ int main()
test(S("123"), 3);
test(S("12345678901234567890123456789012345678901234567890"), 50);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), 0);
diff --git a/test/std/strings/basic.string/string.cons/alloc.pass.cpp b/test/std/strings/basic.string/string.cons/alloc.pass.cpp
index 1c4f2044834e..a803d331b8f6 100644
--- a/test/std/strings/basic.string/string.cons/alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/alloc.pass.cpp
@@ -29,7 +29,7 @@ test()
static_assert((noexcept(S()) == noexcept(typename S::allocator_type())), "" );
#endif
S s;
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s.data());
assert(s.size() == 0);
assert(s.capacity() >= s.size());
@@ -42,7 +42,7 @@ test()
static_assert((noexcept(S(typename S::allocator_type())) == std::is_nothrow_copy_constructible<typename S::allocator_type>::value), "" );
#endif
S s(typename S::allocator_type(5));
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s.data());
assert(s.size() == 0);
assert(s.capacity() >= s.size());
@@ -63,7 +63,7 @@ test2()
static_assert((noexcept(S()) == noexcept(typename S::allocator_type())), "" );
#endif
S s;
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s.data());
assert(s.size() == 0);
assert(s.capacity() >= s.size());
@@ -76,7 +76,7 @@ test2()
static_assert((noexcept(S(typename S::allocator_type())) == std::is_nothrow_copy_constructible<typename S::allocator_type>::value), "" );
#endif
S s(typename S::allocator_type{});
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s.data());
assert(s.size() == 0);
assert(s.capacity() >= s.size());
diff --git a/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp b/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
index 1c582bc51637..f6bacb70e4ce 100644
--- a/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -22,7 +23,7 @@ test(S s1, typename S::value_type s2)
{
typedef typename S::traits_type T;
s1 = s2;
- assert(s1.__invariants());
+ LIBCPP_ASSERT(s1.__invariants());
assert(s1.size() == 1);
assert(T::eq(s1[0], s2));
assert(s1.capacity() >= s1.size());
@@ -37,7 +38,7 @@ int main()
test(S("123456789"), 'a');
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), 'a');
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), 'a');
diff --git a/test/std/strings/basic.string/string.cons/copy.pass.cpp b/test/std/strings/basic.string/string.cons/copy.pass.cpp
index 9c9fc3230668..cc4deb992a8b 100644
--- a/test/std/strings/basic.string/string.cons/copy.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/copy.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -22,7 +23,7 @@ void
test(S s1)
{
S s2 = s1;
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == s1.get_allocator());
@@ -37,7 +38,7 @@ int main()
test(S("1", A(5)));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
diff --git a/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
index cf8021019a2e..b3447b94b803 100644
--- a/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -22,7 +23,7 @@ void
test(S s1, const typename S::allocator_type& a)
{
S s2(s1, a);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == a);
@@ -37,7 +38,7 @@ int main()
test(S("1"), A(5));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A(7));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
diff --git a/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp b/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
index ccb6c599974b..b1e9108e90ba 100644
--- a/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
@@ -15,6 +15,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -22,7 +23,7 @@ void
test(S s1, const S& s2)
{
s1 = s2;
- assert(s1.__invariants());
+ LIBCPP_ASSERT(s1.__invariants());
assert(s1 == s2);
assert(s1.capacity() >= s1.size());
}
@@ -47,7 +48,7 @@ int main()
"1234567890123456789012345678901234567890123456789012345678901234567890"),
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), S());
diff --git a/test/std/strings/basic.string/string.cons/default_noexcept.pass.cpp b/test/std/strings/basic.string/string.cons/default_noexcept.pass.cpp
index af117103d827..87698ec55103 100644
--- a/test/std/strings/basic.string/string.cons/default_noexcept.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/default_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string()
@@ -29,7 +31,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::string C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
@@ -42,5 +43,4 @@ int main()
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp b/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp
index b3cc127fbc46..c4ac1f1a47bb 100644
--- a/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// ~basic_string() // implied noexcept;
@@ -16,8 +18,6 @@
#include "test_allocator.h"
-#if __has_feature(cxx_noexcept)
-
template <class T>
struct some_alloc
{
@@ -26,11 +26,8 @@ struct some_alloc
~some_alloc() noexcept(false);
};
-#endif
-
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::string C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -43,5 +40,4 @@ int main()
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
-#endif
}
diff --git a/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp b/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp
index d6ff8504e9da..3007b9e8f68c 100644
--- a/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string(initializer_list<charT> il, const Allocator& a = Allocator());
@@ -19,7 +21,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::string s = {'a', 'b', 'c'};
assert(s == "abc");
@@ -29,7 +30,6 @@ int main()
s = {L'a', L'b', L'c'};
assert(s == L"abc");
}
-#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s = {'a', 'b', 'c'};
@@ -41,6 +41,4 @@ int main()
s = {L'a', L'b', L'c'};
assert(s == L"abc");
}
-#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp b/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
index 753076895359..20279c853eaf 100644
--- a/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string& operator=(initializer_list<charT> il);
@@ -18,19 +20,15 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::string s;
s = {'a', 'b', 'c'};
assert(s == "abc");
}
-#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s;
s = {'a', 'b', 'c'};
assert(s == "abc");
}
-#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
index 664cb80b10fe..cb0792ab23b3 100644
--- a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
@@ -17,6 +17,7 @@
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
#include "../input_iterator.h"
#include "min_allocator.h"
@@ -30,7 +31,7 @@ test(It first, It last)
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
S s2(first, last);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == std::distance(first, last));
unsigned i = 0;
for (It it = first; it != last; ++it, ++i)
@@ -47,7 +48,7 @@ test(It first, It last, const A& a)
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
typedef typename S::traits_type T;
S s2(first, last, a);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == std::distance(first, last));
unsigned i = 0;
for (It it = first; it != last; ++it, ++i)
@@ -86,7 +87,7 @@ int main()
test(input_iterator<const char*>(s), input_iterator<const char*>(s+50));
test(input_iterator<const char*>(s), input_iterator<const char*>(s+50), A(2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
const char* s = "12345678901234567890123456789012345678901234567890";
diff --git a/test/std/strings/basic.string/string.cons/move.pass.cpp b/test/std/strings/basic.string/string.cons/move.pass.cpp
index b94f189ecb46..9ed244406d01 100644
--- a/test/std/strings/basic.string/string.cons/move.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/move.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string(basic_string<charT,traits,Allocator>&& str);
@@ -14,8 +16,7 @@
#include <string>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -25,18 +26,15 @@ test(S s0)
{
S s1 = s0;
S s2 = std::move(s0);
- assert(s2.__invariants());
- assert(s0.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
+ LIBCPP_ASSERT(s0.__invariants());
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == s1.get_allocator());
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -44,7 +42,6 @@ int main()
test(S("1", A(5)));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)));
}
-#if __cplusplus >= 201103L
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -52,6 +49,4 @@ int main()
test(S("1", A()));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()));
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
index a232a46bd9fb..d4866921af7a 100644
--- a/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string(basic_string&& str, const Allocator& alloc);
@@ -14,8 +16,6 @@
#include <string>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -27,23 +27,16 @@ test(S s0, const typename S::allocator_type& a)
{
S s1 = s0;
S s2(std::move(s0), a);
- assert(s2.__invariants());
- assert(s0.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
+ LIBCPP_ASSERT(s0.__invariants());
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == a);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-// #if _LIBCPP_STD_VER <= 14
-// _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
-// #else
-// _NOEXCEPT;
-// #endif
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -70,8 +63,6 @@ int main()
S s2 (std::move(s1), A(1));
}
assert ( test_alloc_base::alloc_count == alloc_count );
-
-#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -84,6 +75,4 @@ int main()
test(S("1"), A());
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A());
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp b/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
index d7bd5e06bbe9..136a60fe627b 100644
--- a/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string& operator=(basic_string&& c)
@@ -36,7 +38,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -49,7 +51,7 @@ template <class T>
struct some_alloc3
{
typedef T value_type;
-
+
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
@@ -60,7 +62,6 @@ struct some_alloc3
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::string C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -90,6 +91,4 @@ int main()
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
#endif
-
-#endif
}
diff --git a/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp b/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
index 5bc1c8a9153f..006b5b9b4cb0 100644
--- a/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string<charT,traits,Allocator>&
@@ -15,8 +17,7 @@
#include <string>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -26,17 +27,14 @@ test(S s1, S s2)
{
S s0 = s2;
s1 = std::move(s2);
- assert(s1.__invariants());
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s1.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s1 == s0);
assert(s1.capacity() >= s1.size());
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::string S;
test(S(), S());
@@ -55,7 +53,6 @@ int main()
"1234567890123456789012345678901234567890123456789012345678901234567890"),
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
}
-#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), S());
@@ -74,6 +71,4 @@ int main()
"1234567890123456789012345678901234567890123456789012345678901234567890"),
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp b/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp
index b287a940cc82..9a7c65ca2cf5 100644
--- a/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string(basic_string&&)
@@ -29,7 +31,6 @@ struct some_alloc
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::string C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -46,5 +47,4 @@ int main()
static_assert( std::is_nothrow_move_constructible<C>::value, "");
#endif
}
-#endif
}
diff --git a/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
index f6e9e00e590f..b678247fb241 100644
--- a/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -28,7 +29,7 @@ test(const charT* s)
typedef typename S::allocator_type A;
unsigned n = T::length(s);
S s2(s);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == A());
@@ -43,7 +44,7 @@ test(const charT* s, const A& a)
typedef typename S::traits_type T;
unsigned n = T::length(s);
S s2(s, a);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == a);
@@ -68,7 +69,7 @@ int main()
test("123456798012345679801234567980123456798012345679801234567980");
test("123456798012345679801234567980123456798012345679801234567980", A(2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
diff --git a/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp b/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
index c691613379a2..506ab9374002 100644
--- a/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
@@ -15,6 +15,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -23,7 +24,7 @@ test(S s1, const typename S::value_type* s2)
{
typedef typename S::traits_type T;
s1 = s2;
- assert(s1.__invariants());
+ LIBCPP_ASSERT(s1.__invariants());
assert(s1.size() == T::length(s2));
assert(T::compare(s1.data(), s2, s1.size()) == 0);
assert(s1.capacity() >= s1.size());
@@ -49,7 +50,7 @@ int main()
"1234567890123456789012345678901234567890123456789012345678901234567890"),
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), "");
diff --git a/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
index f1f107af20bb..bcab9eb6789e 100644
--- a/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -27,7 +28,7 @@ test(const charT* s, unsigned n)
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
S s2(s, n);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == A());
@@ -41,7 +42,7 @@ test(const charT* s, unsigned n, const A& a)
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
typedef typename S::traits_type T;
S s2(s, n, a);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == a);
@@ -66,7 +67,7 @@ int main()
test("123456798012345679801234567980123456798012345679801234567980", 60);
test("123456798012345679801234567980123456798012345679801234567980", 60, A(2));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
diff --git a/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
index 4dfe9063a23e..60d41b1d35be 100644
--- a/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -27,7 +28,7 @@ test(unsigned n, charT c)
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
S s2(n, c);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
for (unsigned i = 0; i < n; ++i)
assert(s2[i] == c);
@@ -42,7 +43,7 @@ test(unsigned n, charT c, const A& a)
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
typedef typename S::traits_type T;
S s2(n, c, a);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
for (unsigned i = 0; i < n; ++i)
assert(s2[i] == c);
@@ -59,7 +60,7 @@ test(Tp n, Tp c)
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
S s2(n, c);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
for (unsigned i = 0; i < n; ++i)
assert(s2[i] == c);
@@ -75,7 +76,7 @@ test(Tp n, Tp c, const A& a)
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
typedef typename S::traits_type T;
S s2(n, c, a);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
for (unsigned i = 0; i < n; ++i)
assert(s2[i] == c);
@@ -104,7 +105,7 @@ int main()
test(100, 65);
test(100, 65, A(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
diff --git a/test/std/strings/basic.string/string.cons/substr.pass.cpp b/test/std/strings/basic.string/string.cons/substr.pass.cpp
index 2e42be13a842..a10239bb3414 100644
--- a/test/std/strings/basic.string/string.cons/substr.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/substr.pass.cpp
@@ -11,14 +11,21 @@
// <string>
// basic_string(const basic_string<charT,traits,Allocator>& str,
-// size_type pos, size_type n = npos,
+// size_type pos, size_type n,
+// const Allocator& a = Allocator());
+//
+// basic_string(const basic_string<charT,traits,Allocator>& str,
+// size_type pos,
// const Allocator& a = Allocator());
#include <string>
#include <stdexcept>
#include <algorithm>
+#include <vector>
+#include <scoped_allocator>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -31,7 +38,7 @@ test(S str, unsigned pos)
try
{
S s2(str, pos);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(pos <= str.size());
unsigned rlen = str.size() - pos;
assert(s2.size() == rlen);
@@ -54,7 +61,7 @@ test(S str, unsigned pos, unsigned n)
try
{
S s2(str, pos, n);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(pos <= str.size());
unsigned rlen = std::min<unsigned>(str.size() - pos, n);
assert(s2.size() == rlen);
@@ -77,7 +84,7 @@ test(S str, unsigned pos, unsigned n, const typename S::allocator_type& a)
try
{
S s2(str, pos, n, a);
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(pos <= str.size());
unsigned rlen = std::min<unsigned>(str.size() - pos, n);
assert(s2.size() == rlen);
@@ -91,6 +98,20 @@ test(S str, unsigned pos, unsigned n, const typename S::allocator_type& a)
}
}
+#if TEST_STD_VER >= 11
+void test2583()
+{ // LWG #2583
+ typedef std::basic_string<char, std::char_traits<char>, test_allocator<char> > StringA;
+ std::vector<StringA, std::scoped_allocator_adaptor<test_allocator<StringA>>> vs;
+ StringA s{"1234"};
+ vs.emplace_back(s, 2);
+
+ try { vs.emplace_back(s, 5); }
+ catch (const std::out_of_range&) { return; }
+ assert(false);
+}
+#endif
+
int main()
{
{
@@ -131,7 +152,7 @@ int main()
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 10, A(8));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 100, A(8));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -170,5 +191,7 @@ int main()
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 10, A());
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 100, A());
}
+
+ test2583();
#endif
}
diff --git a/test/std/strings/basic.string/string.iterators/begin.pass.cpp b/test/std/strings/basic.string/string.iterators/begin.pass.cpp
index 55f2eb30f80a..ea811113dfe9 100644
--- a/test/std/strings/basic.string/string.iterators/begin.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/begin.pass.cpp
@@ -38,7 +38,7 @@ int main()
test(S());
test(S("123"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp b/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp
index d0c6ddbb9508..fb4b4bdc3d8e 100644
--- a/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp
@@ -35,7 +35,7 @@ int main()
test(S());
test(S("123"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.iterators/cend.pass.cpp b/test/std/strings/basic.string/string.iterators/cend.pass.cpp
index 6b86d263245b..9ee56be783a2 100644
--- a/test/std/strings/basic.string/string.iterators/cend.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/cend.pass.cpp
@@ -31,7 +31,7 @@ int main()
test(S());
test(S("123"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp b/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp
index 6f29f433f314..90988a39a35e 100644
--- a/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp
@@ -35,7 +35,7 @@ int main()
test(S());
test(S("123"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.iterators/crend.pass.cpp b/test/std/strings/basic.string/string.iterators/crend.pass.cpp
index 1fb422c080ac..bb383787fe49 100644
--- a/test/std/strings/basic.string/string.iterators/crend.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/crend.pass.cpp
@@ -31,7 +31,7 @@ int main()
test(S());
test(S("123"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.iterators/db_iterators_2.pass.cpp b/test/std/strings/basic.string/string.iterators/db_iterators_2.pass.cpp
index 6cac1875ce81..e46368c7717a 100644
--- a/test/std/strings/basic.string/string.iterators/db_iterators_2.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/db_iterators_2.pass.cpp
@@ -32,7 +32,7 @@ int main()
bool b = s1.begin() < s2.begin();
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s1;
diff --git a/test/std/strings/basic.string/string.iterators/db_iterators_3.pass.cpp b/test/std/strings/basic.string/string.iterators/db_iterators_3.pass.cpp
index d90387e3a46d..3ed15d7c0c04 100644
--- a/test/std/strings/basic.string/string.iterators/db_iterators_3.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/db_iterators_3.pass.cpp
@@ -32,7 +32,7 @@ int main()
int i = s1.begin() - s2.begin();
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s1;
diff --git a/test/std/strings/basic.string/string.iterators/db_iterators_4.pass.cpp b/test/std/strings/basic.string/string.iterators/db_iterators_4.pass.cpp
index c4a2d0a4baf6..85ea2201f2a0 100644
--- a/test/std/strings/basic.string/string.iterators/db_iterators_4.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/db_iterators_4.pass.cpp
@@ -33,7 +33,7 @@ int main()
assert(i[1] == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C;
C c(1, '\0');
diff --git a/test/std/strings/basic.string/string.iterators/db_iterators_5.pass.cpp b/test/std/strings/basic.string/string.iterators/db_iterators_5.pass.cpp
index ce44cb1ba5b4..9702090e41f8 100644
--- a/test/std/strings/basic.string/string.iterators/db_iterators_5.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/db_iterators_5.pass.cpp
@@ -35,7 +35,7 @@ int main()
i += 2;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C;
C c(1, '\0');
diff --git a/test/std/strings/basic.string/string.iterators/db_iterators_6.pass.cpp b/test/std/strings/basic.string/string.iterators/db_iterators_6.pass.cpp
index 8fab8babc613..e42ba4cf15d7 100644
--- a/test/std/strings/basic.string/string.iterators/db_iterators_6.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/db_iterators_6.pass.cpp
@@ -34,7 +34,7 @@ int main()
--i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C;
C c(1, '\0');
diff --git a/test/std/strings/basic.string/string.iterators/db_iterators_7.pass.cpp b/test/std/strings/basic.string/string.iterators/db_iterators_7.pass.cpp
index d1cac07e222b..69a682142c14 100644
--- a/test/std/strings/basic.string/string.iterators/db_iterators_7.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/db_iterators_7.pass.cpp
@@ -34,7 +34,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C;
C c(1, '\0');
diff --git a/test/std/strings/basic.string/string.iterators/db_iterators_8.pass.cpp b/test/std/strings/basic.string/string.iterators/db_iterators_8.pass.cpp
index 914c77d48c5c..5472773e6dfe 100644
--- a/test/std/strings/basic.string/string.iterators/db_iterators_8.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/db_iterators_8.pass.cpp
@@ -32,7 +32,7 @@ int main()
char j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C;
C c(1, '\0');
diff --git a/test/std/strings/basic.string/string.iterators/end.pass.cpp b/test/std/strings/basic.string/string.iterators/end.pass.cpp
index 02180bbd73de..abd0c2d853dc 100644
--- a/test/std/strings/basic.string/string.iterators/end.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/end.pass.cpp
@@ -40,7 +40,7 @@ int main()
test(S());
test(S("123"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.iterators/iterators.pass.cpp b/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
index 386cededa53f..9466f1135102 100644
--- a/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
+
// <string>
// iterator begin();
@@ -21,7 +23,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
{ // N3644 testing
typedef std::string C;
C::iterator ii1{}, ii2{};
@@ -40,7 +41,7 @@ int main()
C::iterator ii4 = ii1;
C::const_iterator cii{};
assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
@@ -69,5 +70,4 @@ int main()
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
}
-#endif
}
diff --git a/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp b/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp
index 0111ad113638..698d613ca6ad 100644
--- a/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp
@@ -38,7 +38,7 @@ int main()
test(S());
test(S("123"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.iterators/rend.pass.cpp b/test/std/strings/basic.string/string.iterators/rend.pass.cpp
index 750173dc342e..c8c2d9ccadca 100644
--- a/test/std/strings/basic.string/string.iterators/rend.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/rend.pass.cpp
@@ -40,7 +40,7 @@ int main()
test(S());
test(S("123"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S());
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp
index 2abfbf0a172b..d30ca44695a8 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string& append(initializer_list<charT> il);
@@ -14,23 +16,20 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::string s("123");
s.append({'a', 'b', 'c'});
assert(s == "123abc");
}
-#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("123");
s.append({'a', 'b', 'c'});
assert(s == "123abc");
}
-#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
index 82e6fb5895e7..55fc63d06214 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
@@ -23,10 +23,11 @@ void
test(S s, It first, It last, S expected)
{
s.append(first, last);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
template <class S, class It>
void
test_exceptions(S s, It first, It last)
@@ -37,9 +38,10 @@ test_exceptions(S s, It first, It last)
assert(false);
}
catch (...) {}
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == aCopy);
}
+#endif
int main()
{
@@ -161,6 +163,7 @@ int main()
S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
}
#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
{ // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
@@ -174,4 +177,5 @@ int main()
test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
+#endif
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
index c0413d607e8f..7c45068a53e1 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
@@ -15,6 +15,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -22,7 +23,7 @@ void
test(S s, const typename S::value_type* str, S expected)
{
s.append(str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
index f3ea3b0a89d7..6c594ebac3be 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
@@ -16,6 +16,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -23,7 +24,7 @@ void
test(S s, const typename S::value_type* str, typename S::size_type n, S expected)
{
s.append(str, n);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
index d6116d3f4823..f2fb8782a21d 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -21,7 +22,7 @@ void
test(S s, typename S::value_type c, S expected)
{
s.push_back(c);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
index a049e6112a8a..1610ab5a17d1 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
@@ -15,6 +15,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -22,7 +23,7 @@ void
test(S s, typename S::size_type n, typename S::value_type c, S expected)
{
s.append(n, c);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
index e25627fa6a24..b58ed632893e 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
@@ -15,6 +15,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -22,7 +23,7 @@ void
test(S s, S str, S expected)
{
s.append(str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
index d67b0304b41a..9e8158c3e43e 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
@@ -18,6 +18,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -27,7 +28,7 @@ test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected)
try
{
s.append(str, pos, n);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= str.size());
assert(s == expected);
}
@@ -44,7 +45,7 @@ test_npos(S s, S str, typename S::size_type pos, S expected)
try
{
s.append(str, pos);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= str.size());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp
index 003af0eef827..a2114cf5a83b 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string& assign(initializer_list<charT> il);
@@ -14,23 +16,20 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::string s("123");
s.assign({'a', 'b', 'c'});
assert(s == "abc");
}
-#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("123");
s.assign({'a', 'b', 'c'});
assert(s == "abc");
}
-#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
index 690aebd4c2a6..e6a57519f34b 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
@@ -15,6 +15,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@@ -23,10 +24,11 @@ void
test(S s, It first, It last, S expected)
{
s.assign(first, last);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
template <class S, class It>
void
test_exceptions(S s, It first, It last)
@@ -35,11 +37,12 @@ test_exceptions(S s, It first, It last)
try {
s.assign(first, last);
assert(false);
- }
+ }
catch (...) {}
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == aCopy);
}
+#endif
int main()
{
@@ -101,7 +104,7 @@ int main()
test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52),
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -161,6 +164,7 @@ int main()
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
}
#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
{ // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
@@ -174,4 +178,5 @@ int main()
test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
+#endif
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
index 07dbcea704dc..386dee6d5808 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
@@ -15,6 +15,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -22,7 +23,7 @@ void
test(S s, const typename S::value_type* str, S expected)
{
s.assign(str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
index a9c71cec882b..0eeb9266f40f 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
@@ -16,6 +16,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -23,7 +24,7 @@ void
test(S s, const typename S::value_type* str, typename S::size_type n, S expected)
{
s.assign(str, n);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp
index b3d225a8d04a..6b89df98de72 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp
@@ -16,6 +16,7 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -23,7 +24,7 @@ void
test(S s, S str, S expected)
{
s.assign(std::move(str));
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
index 9dd19d877c90..a899e0dbe7b5 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
@@ -15,6 +15,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -22,7 +23,7 @@ void
test(S s, typename S::size_type n, typename S::value_type c, S expected)
{
s.assign(n, c);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
index 2bc5dd223e62..788512ba3d3e 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
@@ -15,17 +15,29 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
+#include "test_allocator.h"
template <class S>
void
test(S s, S str, S expected)
{
s.assign(str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
+template <class S>
+void
+testAlloc(S s, S str, const typename S::allocator_type& a)
+{
+ s.assign(str);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == str);
+ assert(s.get_allocator() == a);
+}
+
int main()
{
{
@@ -50,7 +62,22 @@ int main()
test(S("12345678901234567890"), S("1234567890"), S("1234567890"));
test(S("12345678901234567890"), S("12345678901234567890"),
S("12345678901234567890"));
+
+ testAlloc(S(), S(), std::allocator<char>());
+ testAlloc(S(), S("12345"), std::allocator<char>());
+ testAlloc(S(), S("1234567890"), std::allocator<char>());
+ testAlloc(S(), S("12345678901234567890"), std::allocator<char>());
+ }
+
+ { // LWG#5579 make sure assign takes the allocators where appropriate
+ typedef other_allocator<char> A; // has POCCA --> true
+ typedef std::basic_string<char, std::char_traits<char>, A> S;
+ testAlloc(S(A(5)), S(A(3)), A(3));
+ testAlloc(S(A(5)), S("1"), A());
+ testAlloc(S(A(5)), S("1", A(7)), A(7));
+ testAlloc(S(A(5)), S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), A(7));
}
+
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
@@ -74,9 +101,14 @@ int main()
test(S("12345678901234567890"), S("1234567890"), S("1234567890"));
test(S("12345678901234567890"), S("12345678901234567890"),
S("12345678901234567890"));
+
+ testAlloc(S(), S(), min_allocator<char>());
+ testAlloc(S(), S("12345"), min_allocator<char>());
+ testAlloc(S(), S("1234567890"), min_allocator<char>());
+ testAlloc(S(), S("12345678901234567890"), min_allocator<char>());
}
#endif
-#if __cplusplus > 201402L
+#if TEST_STD_VER > 14
{
typedef std::string S;
static_assert(noexcept(S().assign(S())), ""); // LWG#2063
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
index 275d249d304c..d9d3cb422ae5 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
@@ -18,6 +18,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -27,7 +28,7 @@ test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected)
try
{
s.assign(str, pos, n);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= str.size());
assert(s == expected);
}
@@ -44,7 +45,7 @@ test_npos(S s, S str, typename S::size_type pos, S expected)
try
{
s.assign(str, pos);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= str.size());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
index 69f001cf4f00..b66877652837 100644
--- a/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
@@ -17,6 +17,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -104,7 +105,7 @@ int main()
test(S("abcdefghijklmnopqrst"), s, 20, 1);
test(S("abcdefghijklmnopqrst"), s, 21, 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
char s[50];
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
index c44db71ae3b0..8de5fc7bab85 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -22,7 +23,7 @@ test(S s, typename S::difference_type pos, S expected)
{
typename S::const_iterator p = s.begin() + pos;
typename S::iterator i = s.erase(p);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
assert(i - s.begin() == pos);
}
@@ -44,7 +45,7 @@ int main()
test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst"));
test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S("abcde"), 0, S("bcde"));
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
index dbe6d7ba0e73..e4fe2cdfd022 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -23,7 +24,7 @@ test(S s, typename S::difference_type pos, typename S::difference_type n, S expe
typename S::const_iterator first = s.cbegin() + pos;
typename S::const_iterator last = s.cbegin() + pos + n;
typename S::iterator i = s.erase(first, last);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
assert(i - s.begin() == pos);
}
@@ -87,7 +88,7 @@ int main()
test(S("abcdefghijklmnopqrst"), 19, 1, S("abcdefghijklmnopqrs"));
test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghijklmnopqrst"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 0, 0, S(""));
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
index 790ce40b0a00..64f8e506b13e 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
@@ -11,13 +11,10 @@
// void pop_back();
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -25,7 +22,7 @@ void
test(S s, S expected)
{
s.pop_back();
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
@@ -37,7 +34,7 @@ int main()
test(S("abcdefghij"), S("abcdefghi"));
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S("abcde"), S("abcd"));
@@ -45,11 +42,4 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs"));
}
#endif
-#if _LIBCPP_DEBUG >= 1
- {
- std::string s;
- s.pop_back();
- assert(false);
- }
-#endif
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
index 11015cb973ed..5db97ec2cf5f 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
@@ -17,6 +17,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -28,7 +29,7 @@ test(S s, typename S::size_type pos, typename S::size_type n, S expected)
try
{
s.erase(pos, n);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
@@ -48,7 +49,7 @@ test(S s, typename S::size_type pos, S expected)
try
{
s.erase(pos);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
@@ -64,7 +65,7 @@ void
test(S s, S expected)
{
s.erase();
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
@@ -173,7 +174,7 @@ int main()
test(S("abcdefghij"), S(""));
test(S("abcdefghijklmnopqrst"), S(""));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 0, 0, S(""));
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
index 6b0a3aa006ee..6bd9b7e01c37 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
@@ -11,14 +11,11 @@
// iterator insert(const_iterator p, charT c);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <string>
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -28,7 +25,7 @@ test(S& s, typename S::const_iterator p, typename S::value_type c, S expected)
bool sufficient_cap = s.size() < s.capacity();
typename S::difference_type pos = p - s.begin();
typename S::iterator i = s.insert(p, c);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
assert(i - s.begin() == pos);
assert(*i == c);
@@ -76,13 +73,4 @@ int main()
test(s, s.begin()+6, 'C', S("a567ABC1432dcb"));
}
#endif
-#if _LIBCPP_DEBUG >= 1
- {
- typedef std::string S;
- S s;
- S s2;
- s.insert(s2.begin(), '1');
- assert(false);
- }
-#endif
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
index 4c29ab4ed093..bbae39419da4 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
@@ -28,11 +28,12 @@ test(S s, typename S::difference_type pos, It first, It last, S expected)
{
typename S::const_iterator p = s.cbegin() + pos;
typename S::iterator i = s.insert(p, first, last);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(i - s.begin() == pos);
assert(s == expected);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
template <class S, class It>
void
test_exceptions(S s, typename S::difference_type pos, It first, It last)
@@ -44,9 +45,10 @@ test_exceptions(S s, typename S::difference_type pos, It first, It last)
assert(false);
}
catch (...) {}
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == aCopy);
}
+#endif
int main()
{
@@ -142,6 +144,7 @@ int main()
S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
}
#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
{ // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
@@ -155,6 +158,7 @@ int main()
test_exceptions(S(), 0, TIter(s, s+10, 5, TIter::TADereference), TIter());
test_exceptions(S(), 0, TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
+#endif
#if _LIBCPP_DEBUG >= 1
{
std::string v;
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
index e6d1db6fc0df..c9cd0c2c9248 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
@@ -11,13 +11,10 @@
// iterator insert(const_iterator p, size_type n, charT c);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -27,7 +24,7 @@ test(S s, typename S::difference_type pos, typename S::size_type n,
{
typename S::const_iterator p = s.cbegin() + pos;
typename S::iterator i = s.insert(p, n, c);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(i - s.begin() == pos);
assert(s == expected);
}
@@ -170,12 +167,4 @@ int main()
test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111"));
}
#endif
-#if _LIBCPP_DEBUG >= 1
- {
- std::string s;
- std::string s2;
- s.insert(s2.begin(), 1, 'a');
- assert(false);
- }
-#endif
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
index 247b3308f96e..faab5bd92672 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -28,7 +29,7 @@ test(S s, typename S::size_type pos, const typename S::value_type* str, S expect
try
{
s.insert(pos, str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
index 41b81231075e..30d3df9f259f 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
@@ -17,6 +17,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -29,7 +30,7 @@ test(S s, typename S::size_type pos, const typename S::value_type* str,
try
{
s.insert(pos, str, n);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
index 945ec48012ba..04ea1d376940 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
@@ -17,6 +17,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -29,7 +30,7 @@ test(S s, typename S::size_type pos, typename S::size_type n,
try
{
s.insert(pos, n, str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
index 04b47ec78988..1945871b99ac 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
@@ -17,6 +17,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -28,7 +29,7 @@ test(S s, typename S::size_type pos, S str, S expected)
try
{
s.insert(pos, str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
index c3745c3749db..32485db478d8 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
@@ -19,6 +19,7 @@
#include <stdexcept>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -31,7 +32,7 @@ test(S s, typename S::size_type pos1, S str, typename S::size_type pos2,
try
{
s.insert(pos1, str, pos2, n);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
}
@@ -51,7 +52,7 @@ test_npos(S s, typename S::size_type pos1, S str, typename S::size_type pos2, S
try
{
s.insert(pos1, str, pos2);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
index 7384ae7f1d3c..f39ed036e149 100644
--- a/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -21,7 +22,7 @@ void
test(S s, typename S::value_type str, S expected)
{
s += str;
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
@@ -34,7 +35,7 @@ int main()
test(S("1234567890"), 'a', S("1234567890a"));
test(S("12345678901234567890"), 'a', S("12345678901234567890a"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), 'a', S("a"));
diff --git a/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp
index c291028998df..5b32af951624 100644
--- a/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string& operator+=(initializer_list<charT> il);
@@ -18,19 +20,15 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::string s("123");
s += {'a', 'b', 'c'};
assert(s == "123abc");
}
-#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("123");
s += {'a', 'b', 'c'};
assert(s == "123abc");
}
-#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
index 77b20d1bc080..c19fd2909011 100644
--- a/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -21,7 +22,7 @@ void
test(S s, const typename S::value_type* str, S expected)
{
s += str;
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
@@ -50,7 +51,7 @@ int main()
test(S("12345678901234567890"), "12345678901234567890",
S("1234567890123456789012345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), "", S());
diff --git a/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
index 33649792521c..1064855c1506 100644
--- a/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
@@ -15,6 +15,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -22,7 +23,7 @@ void
test(S s, S str, S expected)
{
s += str;
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
@@ -51,7 +52,7 @@ int main()
test(S("12345678901234567890"), S("12345678901234567890"),
S("1234567890123456789012345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), S(), S());
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
index 057964112aa1..cc37e79c7932 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
@@ -29,12 +29,13 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S ex
typename S::const_iterator last = s.begin() + pos1 + n1;
typename S::size_type xlen = last - first;
s.replace(first, last, f, l);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
typename S::size_type rlen = std::distance(f, l);
assert(s.size() == old_size - xlen + rlen);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
template <class S, class It>
void
test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l)
@@ -47,9 +48,10 @@ test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f,
assert(false);
}
catch (...) {}
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == aCopy);
}
+#endif
const char* str = "12345678901234567890";
@@ -990,6 +992,7 @@ int main()
test8<S>();
}
#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
{ // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
@@ -1003,4 +1006,5 @@ int main()
test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 5, TIter::TADereference), TIter());
test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
+#endif
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
index c7551b928ec1..730fc1a501cf 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
@@ -29,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S
typename S::const_iterator last = s.begin() + pos1 + n1;
typename S::size_type xlen = last - first;
s.replace(first, last, str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
typename S::size_type rlen = S::traits_type::length(str);
assert(s.size() == old_size - xlen + rlen);
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
index 087df7824ac2..4a910e499819 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
@@ -12,12 +12,11 @@
// basic_string<charT,traits,Allocator>&
// replace(const_iterator i1, const_iterator i2, const charT* s, size_type n);
-#include <stdio.h>
-
#include <string>
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -30,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S
typename S::const_iterator last = s.begin() + pos1 + n1;
typename S::size_type xlen = last - first;
s.replace(first, last, str, n2);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
index 8be8b5298237..4dbc8ab1f22c 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
@@ -12,12 +12,11 @@
// basic_string<charT,traits,Allocator>&
// replace(const_iterator i1, const_iterator i2, size_type n, charT c);
-#include <stdio.h>
-
#include <string>
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -30,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, typename S::size
typename S::const_iterator last = s.begin() + pos1 + n1;
typename S::size_type xlen = last - first;
s.replace(first, last, n2, c);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
index b85a1063ebe1..190e10d5c830 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
@@ -12,12 +12,11 @@
// basic_string<charT,traits,Allocator>&
// replace(const_iterator i1, const_iterator i2, const basic_string& str);
-#include <stdio.h>
-
#include <string>
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -29,7 +28,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
typename S::const_iterator last = s.begin() + pos1 + n1;
typename S::size_type xlen = last - first;
s.replace(first, last, str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
typename S::size_type rlen = str.size();
assert(s.size() == old_size - xlen + rlen);
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
index eb0e982ef16e..3beb074c0fd3 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
@@ -13,13 +13,12 @@
// basic_string<charT,traits,Allocator>&
// replace(size_type pos, size_type n1, const charT* s);
-#include <stdio.h>
-
#include <string>
#include <stdexcept>
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -32,7 +31,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
try
{
s.replace(pos, n1, str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos);
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
index 898ab2a144c1..d961e9e8f76f 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
@@ -13,13 +13,12 @@
// basic_string<charT,traits,Allocator>&
// replace(size_type pos, size_type n1, const charT* s, size_type n2);
-#include <stdio.h>
-
#include <string>
#include <stdexcept>
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -33,7 +32,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
try
{
s.replace(pos, n1, str, n2);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos);
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
index e616ecc04261..d4696fba8a83 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
@@ -18,6 +18,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -31,7 +32,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
try
{
s.replace(pos, n1, n2, c);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos);
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
index ea311dd1564f..1be45d8a6624 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
@@ -18,6 +18,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -29,7 +30,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
try
{
s.replace(pos1, n1, str);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos1 <= old_size);
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos1);
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
index 01f4a1f6ccef..3f4bf450d858 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
@@ -20,6 +20,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -33,7 +34,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1,
try
{
s.replace(pos1, n1, str, pos2, n2);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos1);
@@ -58,7 +59,7 @@ test_npos(S s, typename S::size_type pos1, typename S::size_type n1,
try
{
s.replace(pos1, n1, str, pos2);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos1);
diff --git a/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
index 4973bda4ddf0..fe2ee1fa6da9 100644
--- a/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -25,8 +26,8 @@ test(S s1, S s2)
S s1_ = s1;
S s2_ = s2;
s1.swap(s2);
- assert(s1.__invariants());
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s1.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s1 == s2_);
assert(s2 == s1_);
}
@@ -52,7 +53,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("1234567890"));
test(S("abcdefghijklmnopqrst"), S("12345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), S(""));
diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp
index 4a912eaec6fa..6011ea1586fc 100644
--- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp
@@ -48,7 +48,7 @@ int main()
assert(in.eof());
assert(s == L" ghij");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
std::istringstream in(" abc\n def\n ghij");
diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp
index 6596f2fffa79..79852337a033 100644
--- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp
@@ -54,7 +54,7 @@ int main()
assert(in.eof());
assert(s == L" ghij");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
std::istringstream in(" abc* def** ghij");
diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp
index 84f52bb2e50f..48d1854808c0 100644
--- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp
@@ -33,7 +33,7 @@ int main()
getline(std::wistringstream(L" abc* def* ghij"), s, L'*');
assert(s == L" abc");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("initial text");
diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp
index a3c9911abe9b..18c22f915ca0 100644
--- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp
@@ -33,7 +33,7 @@ int main()
getline(std::wistringstream(L" abc\n def\n ghij"), s);
assert(s == L" abc");
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("initial text");
diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp
index af806bc04570..30e7dc6c12e0 100644
--- a/test/std/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp
@@ -66,7 +66,7 @@ int main()
in >> s;
assert(in.fail());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
std::istringstream in("a bc defghij");
diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp
index 102e8ea08159..6489ddfca466 100644
--- a/test/std/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp
@@ -52,7 +52,7 @@ int main()
assert(out.good());
assert(L" " + s == out.str());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
std::basic_ostringstream<S::value_type, S::traits_type, S::allocator_type> out;
diff --git a/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
index cee538800dd0..a2e25196d26f 100644
--- a/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
@@ -18,6 +18,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -27,8 +28,8 @@ test(S s1, S s2)
S s1_ = s1;
S s2_ = s2;
swap(s1, s2);
- assert(s1.__invariants());
- assert(s2.__invariants());
+ LIBCPP_ASSERT(s1.__invariants());
+ LIBCPP_ASSERT(s2.__invariants());
assert(s1 == s2_);
assert(s2 == s1_);
}
@@ -54,7 +55,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("1234567890"));
test(S("abcdefghijklmnopqrst"), S("12345678901234567890"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), S(""));
diff --git a/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
index cfe03655a8a1..4ac13d10e670 100644
--- a/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// void swap(basic_string& c)
@@ -22,13 +24,14 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
struct some_alloc
{
typedef T value_type;
-
+
some_alloc() {}
some_alloc(const some_alloc&);
void deallocate(void*, unsigned) {}
@@ -40,7 +43,7 @@ template <class T>
struct some_alloc2
{
typedef T value_type;
-
+
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
@@ -51,7 +54,6 @@ struct some_alloc2
int main()
{
-#if __has_feature(cxx_noexcept)
{
typedef std::string C;
C c1, c2;
@@ -80,6 +82,4 @@ int main()
static_assert( noexcept(swap(c1, c2)), "");
}
#endif
-
-#endif
}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
index cc08982a5ca3..6d39d025c585 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
@@ -45,7 +45,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghij"), true);
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test("", S(""), false);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp
index b496d70dc2f0..67d18b7a9ca7 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp
@@ -45,7 +45,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghij", true);
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), "", false);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp
index 069b305111d4..27e97788c637 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp
@@ -46,7 +46,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true);
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), S(""), false);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
index 23a89c6fc8fb..9a8213e230fb 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
@@ -49,7 +49,7 @@ int main()
test0('a', S("12345"), S("a12345"));
test0('a', S("1234567890"), S("a1234567890"));
test0('a', S("12345678901234567890"), S("a12345678901234567890"));
-
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test1('a', S(""), S("a"));
@@ -59,14 +59,14 @@ int main()
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0('a', S(""), S("a"));
test0('a', S("12345"), S("a12345"));
test0('a', S("1234567890"), S("a1234567890"));
test0('a', S("12345678901234567890"), S("a12345678901234567890"));
-
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test1('a', S(""), S("a"));
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
index 665e86f2c239..88fa678ec44f 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
@@ -83,7 +83,7 @@ int main()
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0("", S(""), S(""));
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
index 12903fe8118e..b4c2c97043cc 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
@@ -59,7 +59,7 @@ int main()
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0(S(""), '1', S("1"));
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
index 63a7b769b787..3b669e7d9869 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
@@ -83,7 +83,7 @@ int main()
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0(S(""), "", S(""));
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
index 318b648d6eb0..1977b6f517ba 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
@@ -143,7 +143,7 @@ int main()
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0(S(""), S(""), S(""));
diff --git a/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp
index 19a5bdd977e4..19dd8bfbd92e 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp
@@ -45,7 +45,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghij"), false);
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test("", S(""), true);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp
index 22006bb1be68..f6e3ddec46e2 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp
@@ -45,7 +45,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghij", false);
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), "", true);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp
index 0bff70a977a6..c1d57b0bcc8b 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp
@@ -46,7 +46,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false);
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), S(""), true);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp
index f9fa204b9eea..363e6d36100b 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp
@@ -45,7 +45,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghij"), true);
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test("", S(""), false);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp
index daa6f40ae3c0..4b5f7c3689a2 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp
@@ -45,7 +45,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghij", true);
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), "", false);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp
index 95073bf7644c..01c7c5311b95 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp
@@ -46,7 +46,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true);
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), S(""), false);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp
index eab117a843fa..f4ab04d60d8a 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp
@@ -45,7 +45,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghij"), true);
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test("", S(""), true);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp
index 56b3b35b3d94..4042997f462f 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp
@@ -45,7 +45,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghij", true);
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), "", true);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp
index c02b202c49e6..cdcfc9d8d14a 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp
@@ -46,7 +46,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true);
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), S(""), true);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp
index 86f6a2db119a..e709aa4fbc42 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp
@@ -45,7 +45,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghij"), false);
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test("", S(""), false);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp
index b935da5426fd..8e4f2fab13a4 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp
@@ -45,7 +45,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghij", false);
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), "", false);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp
index 487e2056f2ca..c14e92a0003c 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp
@@ -46,7 +46,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false);
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), S(""), false);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
index 21959405194d..acab3592ec17 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
@@ -45,7 +45,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghij"), false);
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test("", S(""), true);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp
index bb1bce8d4043..f0f540a499c7 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp
@@ -45,7 +45,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghij", false);
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), "", true);
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp
index 2b975f160d5d..208f9623929d 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp
@@ -46,7 +46,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false);
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), S(""), true);
diff --git a/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp b/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp
index 3bdb800bf736..d6695b0b34bc 100644
--- a/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp
@@ -40,7 +40,7 @@ int main()
test(S("abcdefghij"));
test(S("abcdefghijklmnopqrst"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""));
diff --git a/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp b/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp
index 917248fa6916..9b66cb004990 100644
--- a/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp
@@ -10,15 +10,17 @@
// <string>
// const charT* data() const;
+// charT* data(); // C++17
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
void
-test(const S& s)
+test_const(const S& s)
{
typedef typename S::traits_type T;
const typename S::value_type* str = s.data();
@@ -31,22 +33,46 @@ test(const S& s)
assert(T::eq(str[0], typename S::value_type()));
}
+template <class S>
+void
+test_nonconst(S& s)
+{
+ typedef typename S::traits_type T;
+ typename S::value_type* str = s.data();
+ if (s.size() > 0)
+ {
+ assert(T::compare(str, &s[0], s.size()) == 0);
+ assert(T::eq(str[s.size()], typename S::value_type()));
+ }
+ else
+ assert(T::eq(str[0], typename S::value_type()));
+}
+
int main()
{
{
typedef std::string S;
- test(S(""));
- test(S("abcde"));
- test(S("abcdefghij"));
- test(S("abcdefghijklmnopqrst"));
+ test_const(S(""));
+ test_const(S("abcde"));
+ test_const(S("abcdefghij"));
+ test_const(S("abcdefghijklmnopqrst"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
- test(S(""));
- test(S("abcde"));
- test(S("abcdefghij"));
- test(S("abcdefghijklmnopqrst"));
+ test_const(S(""));
+ test_const(S("abcde"));
+ test_const(S("abcdefghij"));
+ test_const(S("abcdefghijklmnopqrst"));
+ }
+#endif
+#if TEST_STD_VER > 14
+ {
+ typedef std::string S;
+ S s1(""); test_nonconst(s1);
+ S s2("abcde"); test_nonconst(s2);
+ S s3("abcdefghij"); test_nonconst(s3);
+ S s4("abcdefghijklmnopqrst"); test_nonconst(s4);
}
#endif
}
diff --git a/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp b/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp
index 6ba040d2635d..e50c61fb162a 100644
--- a/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp
@@ -34,7 +34,7 @@ int main()
test(S("abcdefghij", A(2)), A(2));
test(S("abcdefghijklmnopqrst", A(3)), A(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
diff --git a/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp
index dda7428992a1..150973a7f4e4 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp
@@ -53,7 +53,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghij", 10);
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), "", 0);
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
index 2fef19a24df9..094c227030b8 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
@@ -362,7 +362,7 @@ int main()
test1<S>();
test2<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
index cc61a2e453c4..22aae785c19a 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
@@ -1304,7 +1304,7 @@ int main()
test10<S>();
test11<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
index 66417482fb58..90b4230f64da 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
@@ -362,7 +362,7 @@ int main()
test1<S>();
test2<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
index f5c067699233..3cbbea7b490b 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
@@ -5885,7 +5885,7 @@ int main()
test54<S>();
test55<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp
index 7de95a8cda56..3f6c169d223a 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp
@@ -53,7 +53,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghij"), 10);
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), S(""), 0);
diff --git a/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
index 590173eddf41..945f8805487d 100644
--- a/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
@@ -67,7 +67,7 @@ int main()
test(S("gfsmthlkon"), 'q', 0);
test(S("laenfsbridchgotmkqpj"), 'q', 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 'q', 0, S::npos);
diff --git a/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp
index 53d3a95292c2..0c239b323508 100644
--- a/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp
@@ -148,7 +148,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp
index 14ac4b2a153b..0296e2cbee38 100644
--- a/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp
@@ -375,7 +375,7 @@ int main()
test2<S>();
test3<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp
index 4fb072fa4744..b7df3461792b 100644
--- a/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp
@@ -147,7 +147,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp
index 32d0e86f3d84..494a1181f2ae 100644
--- a/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp
@@ -65,7 +65,7 @@ int main()
test(S("gfsmthlkon"), 'e', S::npos);
test(S("laenfsbridchgotmkqpj"), 'e', 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 'e', 0, S::npos);
diff --git a/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp
index 6dd176df0165..b2a05b29f134 100644
--- a/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp
@@ -148,7 +148,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp
index 9e98a6ad20f7..8b7f7b4a5884 100644
--- a/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp
@@ -375,7 +375,7 @@ int main()
test2<S>();
test3<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp
index e409edc25f48..765d1603af8c 100644
--- a/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp
@@ -147,7 +147,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp
index b130f9287ba3..3212389bb3a8 100644
--- a/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp
@@ -65,7 +65,7 @@ int main()
test(S("gfsmthlkon"), 'i', 9);
test(S("laenfsbridchgotmkqpj"), 'i', 19);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 'i', 0, S::npos);
diff --git a/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp
index 3e6bd9d093ea..7dc75184ff99 100644
--- a/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp
@@ -148,7 +148,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp
index 4db7762b2755..2024266df4a6 100644
--- a/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp
@@ -375,7 +375,7 @@ int main()
test2<S>();
test3<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp
index ba93adbe445e..f3377596ab3d 100644
--- a/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp
@@ -147,7 +147,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp
index 12765b71f28f..e0bbd82f6679 100644
--- a/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp
@@ -65,7 +65,7 @@ int main()
test(S("gfsmthlkon"), 'm', 3);
test(S("laenfsbridchgotmkqpj"), 'm', 15);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 'm', 0, S::npos);
diff --git a/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp
index f1b447c43f4b..c3d6044c4201 100644
--- a/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp
@@ -148,7 +148,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp
index 7f96e6351aa6..42a076aa4c56 100644
--- a/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp
@@ -375,7 +375,7 @@ int main()
test2<S>();
test3<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp
index 351c6727de2d..5cb2df7c6c7f 100644
--- a/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp
@@ -147,7 +147,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp
index 24e58fc5f1ad..a084348b3e63 100644
--- a/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp
@@ -65,7 +65,7 @@ int main()
test(S("abcdeabcde"), 'c', 2);
test(S("abcdeabcdeabcdeabcde"), 'c', 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 'c', 0, S::npos);
diff --git a/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp
index e00d7fd8a3dc..0257e125953f 100644
--- a/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp
@@ -154,7 +154,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp
index 3006c466eed3..9a380f72982d 100644
--- a/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp
@@ -375,7 +375,7 @@ int main()
test2<S>();
test3<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp
index a89df4e3ffa1..e519a7943ba9 100644
--- a/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp
@@ -147,7 +147,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp
index cbc0c9b35367..c53d77f348b8 100644
--- a/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp
@@ -65,7 +65,7 @@ int main()
test(S("abcdeabcde"), 'b', 6);
test(S("abcdeabcdeabcdeabcde"), 'b', 16);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 'b', 0, S::npos);
diff --git a/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp
index 450aebedd59c..ebcb0ea3859a 100644
--- a/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp
@@ -155,7 +155,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp
index 47baf40b265b..e8d0c6b73871 100644
--- a/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp
@@ -375,7 +375,7 @@ int main()
test2<S>();
test3<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp
index 05e6e5174232..ef571c284b81 100644
--- a/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp
@@ -147,7 +147,7 @@ int main()
test0<S>();
test1<S>();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
diff --git a/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp b/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
index dc01f4f47747..145e8dde58bf 100644
--- a/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
@@ -17,6 +17,7 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -26,7 +27,7 @@ test(const S& s, typename S::size_type pos, typename S::size_type n)
try
{
S str = s.substr(pos, n);
- assert(str.__invariants());
+ LIBCPP_ASSERT(str.__invariants());
assert(pos <= s.size());
typename S::size_type rlen = std::min(n, s.size() - pos);
assert(str.size() == rlen);
@@ -101,7 +102,7 @@ int main()
test(S("lsaijeqhtrbgcdmpfkno"), 20, 0);
test(S("dplqartnfgejichmoskb"), 21, 0);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 0, 0);
diff --git a/test/std/strings/basic.string/string.require/contiguous.pass.cpp b/test/std/strings/basic.string/string.require/contiguous.pass.cpp
index ca31ace0ef0b..49773fe491a2 100644
--- a/test/std/strings/basic.string/string.require/contiguous.pass.cpp
+++ b/test/std/strings/basic.string/string.require/contiguous.pass.cpp
@@ -41,7 +41,7 @@ int main()
test_contiguous(S("1", A(5)));
test_contiguous(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
diff --git a/test/std/strings/basic.string/types.pass.cpp b/test/std/strings/basic.string/types.pass.cpp
index dcb3bbc35ebf..a6832a158eca 100644
--- a/test/std/strings/basic.string/types.pass.cpp
+++ b/test/std/strings/basic.string/types.pass.cpp
@@ -79,7 +79,7 @@ int main()
std::char_traits<char> >::value), "");
static_assert((std::is_same<std::basic_string<char>::allocator_type,
std::allocator<char> >::value), "");
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::char_traits<char>, min_allocator<char> >();
#endif
}
diff --git a/test/std/strings/c.strings/cstring.pass.cpp b/test/std/strings/c.strings/cstring.pass.cpp
index 20f4050cfbdb..63f86d350610 100644
--- a/test/std/strings/c.strings/cstring.pass.cpp
+++ b/test/std/strings/c.strings/cstring.pass.cpp
@@ -34,17 +34,12 @@ int main()
static_assert((std::is_same<decltype(std::strncmp(cpc, cpc, s)), int>::value), "");
static_assert((std::is_same<decltype(std::strcoll(cpc, cpc)), int>::value), "");
static_assert((std::is_same<decltype(std::strxfrm(cp, cpc, s)), std::size_t>::value), "");
-// static_assert((std::is_same<decltype(std::memchr(vpc, 0, s)), const void*>::value), "");
static_assert((std::is_same<decltype(std::memchr(vp, 0, s)), void*>::value), "");
-// static_assert((std::is_same<decltype(std::strchr(cpc, 0)), const char*>::value), "");
static_assert((std::is_same<decltype(std::strchr(cp, 0)), char*>::value), "");
static_assert((std::is_same<decltype(std::strcspn(cpc, cpc)), std::size_t>::value), "");
-// static_assert((std::is_same<decltype(std::strpbrk(cpc, cpc)), const char*>::value), "");
static_assert((std::is_same<decltype(std::strpbrk(cp, cpc)), char*>::value), "");
-// static_assert((std::is_same<decltype(std::strrchr(cpc, 0)), const char*>::value), "");
static_assert((std::is_same<decltype(std::strrchr(cp, 0)), char*>::value), "");
static_assert((std::is_same<decltype(std::strspn(cpc, cpc)), std::size_t>::value), "");
-// static_assert((std::is_same<decltype(std::strstr(cpc, cpc)), const char*>::value), "");
static_assert((std::is_same<decltype(std::strstr(cp, cpc)), char*>::value), "");
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
static_assert((std::is_same<decltype(std::strtok(cp, cpc)), char*>::value), "");
@@ -52,4 +47,15 @@ int main()
static_assert((std::is_same<decltype(std::memset(vp, 0, s)), void*>::value), "");
static_assert((std::is_same<decltype(std::strerror(0)), char*>::value), "");
static_assert((std::is_same<decltype(std::strlen(cpc)), std::size_t>::value), "");
+
+ // These tests fail on systems whose C library doesn't provide a correct overload
+ // set for strchr, strpbrk, strrchr, strstr, and memchr, unless the compiler is
+ // a suitably recent version of Clang.
+#if !defined(__APPLE__) || defined(_LIBCPP_PREFERRED_OVERLOAD)
+ static_assert((std::is_same<decltype(std::memchr(vpc, 0, s)), const void*>::value), "");
+ static_assert((std::is_same<decltype(std::strchr(cpc, 0)), const char*>::value), "");
+ static_assert((std::is_same<decltype(std::strpbrk(cpc, cpc)), const char*>::value), "");
+ static_assert((std::is_same<decltype(std::strrchr(cpc, 0)), const char*>::value), "");
+ static_assert((std::is_same<decltype(std::strstr(cpc, cpc)), const char*>::value), "");
+#endif
}
diff --git a/test/std/strings/c.strings/cwchar.pass.cpp b/test/std/strings/c.strings/cwchar.pass.cpp
index 93d2bb1efa50..2b7c3c465f6d 100644
--- a/test/std/strings/c.strings/cwchar.pass.cpp
+++ b/test/std/strings/c.strings/cwchar.pass.cpp
@@ -10,6 +10,7 @@
// <cwchar>
#include <cwchar>
+#include <cstdarg>
#include <type_traits>
#ifndef NULL
@@ -35,13 +36,20 @@ int main()
std::tm *tm = 0;
std::wint_t w = 0;
::FILE* fp = 0;
-#ifdef __APPLE__
- __darwin_va_list va;
-#else
- __builtin_va_list va;
-#endif
+ std::va_list va;
+
char* ns = 0;
wchar_t* ws = 0;
+
+ ((void)mb); // Prevent unused warning
+ ((void)s); // Prevent unused warning
+ ((void)tm); // Prevent unused warning
+ ((void)w); // Prevent unused warning
+ ((void)fp); // Prevent unused warning
+ ((void)va); // Prevent unused warning
+ ((void)ns); // Prevent unused warning
+ ((void)ws); // Prevent unused warning
+
static_assert((std::is_same<decltype(std::fwprintf(fp, L"")), int>::value), "");
static_assert((std::is_same<decltype(std::fwscanf(fp, L"")), int>::value), "");
static_assert((std::is_same<decltype(std::swprintf(ws, s, L"")), int>::value), "");
@@ -73,19 +81,14 @@ int main()
static_assert((std::is_same<decltype(std::wcscoll(L"", L"")), int>::value), "");
static_assert((std::is_same<decltype(std::wcsncmp(L"", L"", s)), int>::value), "");
static_assert((std::is_same<decltype(std::wcsxfrm(ws, L"", s)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::wcschr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wcschr((wchar_t*)0, L' ')), wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wcscspn(L"", L"")), std::size_t>::value), "");
static_assert((std::is_same<decltype(std::wcslen(L"")), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::wcspbrk((const wchar_t*)0, L"")), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wcspbrk((wchar_t*)0, L"")), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcsrchr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wcsrchr((wchar_t*)0, L' ')), wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wcsspn(L"", L"")), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::wcsstr((const wchar_t*)0, L"")), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wcsstr((wchar_t*)0, L"")), wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wcstok(ws, L"", (wchar_t**)0)), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wmemchr((const wchar_t*)0, L' ', s)), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wmemchr((wchar_t*)0, L' ', s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wmemcmp(L"", L"", s)), int>::value), "");
static_assert((std::is_same<decltype(std::wmemcpy(ws, L"", s)), wchar_t*>::value), "");
@@ -101,6 +104,17 @@ int main()
static_assert((std::is_same<decltype(std::mbsrtowcs(ws, (const char**)0, s, &mb)), std::size_t>::value), "");
static_assert((std::is_same<decltype(std::wcsrtombs(ns, (const wchar_t**)0, s, &mb)), std::size_t>::value), "");
+ // These tests fail on systems whose C library doesn't provide a correct overload
+ // set for wcschr, wcspbrk, wcsrchr, wcsstr, and wmemchr, unless the compiler is
+ // a suitably recent version of Clang.
+#if !defined(__APPLE__) || defined(_LIBCPP_PREFERRED_OVERLOAD)
+ static_assert((std::is_same<decltype(std::wcschr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(std::wcspbrk((const wchar_t*)0, L"")), const wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(std::wcsrchr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(std::wcsstr((const wchar_t*)0, L"")), const wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(std::wmemchr((const wchar_t*)0, L' ', s)), const wchar_t*>::value), "");
+#endif
+
#ifndef _LIBCPP_HAS_NO_STDIN
static_assert((std::is_same<decltype(std::getwchar()), std::wint_t>::value), "");
static_assert((std::is_same<decltype(std::vwscanf(L"", va)), int>::value), "");
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/lt.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/lt.pass.cpp
index 3ff9c0f1ff92..9b552347fe9e 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/lt.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/lt.pass.cpp
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
@@ -18,11 +18,16 @@
int main()
{
- char c = '\0';
- assert(!std::char_traits<char>::lt('a', 'a'));
- assert( std::char_traits<char>::lt('A', 'a'));
- assert(!std::char_traits<char>::lt('A' + 127, 'a'));
- assert(!std::char_traits<char>::lt('A' - 127, 'a'));
- assert( std::char_traits<char>::lt('A', 'a' + 127));
- assert( std::char_traits<char>::lt('A', 'a' - 127));
+ assert( std::char_traits<char>::lt('\0', 'A'));
+ assert(!std::char_traits<char>::lt('A', '\0'));
+
+ assert(!std::char_traits<char>::lt('a', 'a'));
+ assert( std::char_traits<char>::lt('A', 'a'));
+ assert(!std::char_traits<char>::lt('a', 'A'));
+
+ assert( std::char_traits<char>::lt('a', 'z'));
+ assert( std::char_traits<char>::lt('A', 'Z'));
+
+ assert( std::char_traits<char>::lt(' ', 'A'));
+ assert( std::char_traits<char>::lt('A', '~'));
}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp
index af87052ff219..7f223af57414 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
char16_t c = u'\0';
std::char_traits<char16_t>::assign(c, u'a');
assert(c == u'a');
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp
index b5039072dbfd..7356097a6677 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::compare(u"", u"", 0) == 0);
assert(std::char_traits<char16_t>::compare(NULL, NULL, 0) == 0);
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
index 8216934658ce..1ae4cb8fe8d9 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
char16_t c = u'\0';
assert(std::char_traits<char16_t>::eq(u'a', u'a'));
assert(!std::char_traits<char16_t>::eq(u'a', u'A'));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq_int_type.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq_int_type.pass.cpp
index a20aa7d47189..42546f450fc7 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq_int_type.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq_int_type.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert( std::char_traits<char16_t>::eq_int_type(u'a', u'a'));
assert(!std::char_traits<char16_t>::eq_int_type(u'a', u'A'));
assert(!std::char_traits<char16_t>::eq_int_type(std::char_traits<char16_t>::eof(), u'A'));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp
index 9f6acca83e36..ff5a2a934a9f 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::length(u"") == 0);
assert(std::char_traits<char16_t>::length(u"a") == 1);
assert(std::char_traits<char16_t>::length(u"aa") == 2);
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
index 135ecc05e199..b27ee06f4a59 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
char16_t c = u'\0';
assert(!std::char_traits<char16_t>::lt(u'a', u'a'));
assert( std::char_traits<char16_t>::lt(u'A', u'a'));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/not_eof.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/not_eof.pass.cpp
index 3c213e6e0a37..af9378073bec 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/not_eof.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/not_eof.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::not_eof(u'a') == u'a');
assert(std::char_traits<char16_t>::not_eof(u'A') == u'A');
#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_char_type.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_char_type.pass.cpp
index ab47403dbe01..2a679d0cf420 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_char_type.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_char_type.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::to_char_type(u'a') == u'a');
assert(std::char_traits<char16_t>::to_char_type(u'A') == u'A');
#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_int_type.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_int_type.pass.cpp
index 11eb8f525466..93861461baaf 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_int_type.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_int_type.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::to_int_type(u'a') == u'a');
assert(std::char_traits<char16_t>::to_int_type(u'A') == u'A');
#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp
index 35dcd9602d3c..6cd55ea58bff 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
char32_t c = U'\0';
std::char_traits<char32_t>::assign(c, U'a');
assert(c == U'a');
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp
index 25f2099896a6..2671b5624100 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::compare(U"", U"", 0) == 0);
assert(std::char_traits<char32_t>::compare(NULL, NULL, 0) == 0);
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
index ffeff0cf45a4..0284d9f7933b 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
char32_t c = U'\0';
assert(std::char_traits<char32_t>::eq(U'a', U'a'));
assert(!std::char_traits<char32_t>::eq(U'a', U'A'));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp
index eb5c69661014..d39798c74bb6 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert( std::char_traits<char32_t>::eq_int_type(U'a', U'a'));
assert(!std::char_traits<char32_t>::eq_int_type(U'a', U'A'));
assert(!std::char_traits<char32_t>::eq_int_type(std::char_traits<char32_t>::eof(), U'A'));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp
index d80ce051d1fa..e0bee5dc5080 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::length(U"") == 0);
assert(std::char_traits<char32_t>::length(U"a") == 1);
assert(std::char_traits<char32_t>::length(U"aa") == 2);
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
index f667507f0457..9816df738709 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
char32_t c = U'\0';
assert(!std::char_traits<char32_t>::lt(U'a', U'a'));
assert( std::char_traits<char32_t>::lt(U'A', U'a'));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp
index d794417bfd7a..b83fd0fe07ff 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::not_eof(U'a') == U'a');
assert(std::char_traits<char32_t>::not_eof(U'A') == U'A');
#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp
index 1f67242b2aec..c9820424fb66 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::to_char_type(U'a') == U'a');
assert(std::char_traits<char32_t>::to_char_type(U'A') == U'A');
#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp
index a378186bdd6f..801c4cf7cddf 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp
@@ -16,10 +16,12 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::to_int_type(U'a') == U'a');
assert(std::char_traits<char32_t>::to_int_type(U'A') == U'A');
#endif
diff --git a/test/std/thread/futures/futures.async/async.pass.cpp b/test/std/thread/futures/futures.async/async.pass.cpp
index 2c1313b7a2f0..5cb824d48224 100644
--- a/test/std/thread/futures/futures.async/async.pass.cpp
+++ b/test/std/thread/futures/futures.async/async.pass.cpp
@@ -21,15 +21,22 @@
// future<typename result_of<F(Args...)>::type>
// async(launch policy, F&& f, Args&&... args);
+
#include <future>
+#include <atomic>
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
typedef std::chrono::high_resolution_clock Clock;
typedef std::chrono::milliseconds ms;
+std::atomic_bool invoked = ATOMIC_VAR_INIT(false);
+
int f0()
{
+ invoked = true;
std::this_thread::sleep_for(ms(200));
return 3;
}
@@ -38,163 +45,109 @@ int i = 0;
int& f1()
{
+ invoked = true;
std::this_thread::sleep_for(ms(200));
return i;
}
void f2()
{
+ invoked = true;
std::this_thread::sleep_for(ms(200));
}
-std::unique_ptr<int> f3(int i)
+std::unique_ptr<int> f3(int j)
{
+ invoked = true;
std::this_thread::sleep_for(ms(200));
- return std::unique_ptr<int>(new int(i));
+ return std::unique_ptr<int>(new int(j));
}
std::unique_ptr<int> f4(std::unique_ptr<int>&& p)
{
+ invoked = true;
std::this_thread::sleep_for(ms(200));
return std::move(p);
}
-void f5(int i)
+void f5(int j)
{
std::this_thread::sleep_for(ms(200));
- throw i;
+ throw j;
}
-int main()
-{
- {
- std::future<int> f = std::async(f0);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(f.get() == 3);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
- }
- {
- std::future<int> f = std::async(std::launch::async, f0);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(f.get() == 3);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
- }
- {
- std::future<int> f = std::async(std::launch::any, f0);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(f.get() == 3);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
- }
- {
- std::future<int> f = std::async(std::launch::deferred, f0);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(f.get() == 3);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 > ms(100));
- }
+template <class Ret, class CheckLamdba, class ...Args>
+void test(CheckLamdba&& getAndCheckFn, bool IsDeferred, Args&&... args) {
+ // Reset global state.
+ invoked = false;
- {
- std::future<int&> f = std::async(f1);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(&f.get() == &i);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
- }
- {
- std::future<int&> f = std::async(std::launch::async, f1);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(&f.get() == &i);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
- }
- {
- std::future<int&> f = std::async(std::launch::any, f1);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(&f.get() == &i);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
- }
- {
- std::future<int&> f = std::async(std::launch::deferred, f1);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(&f.get() == &i);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 > ms(100));
- }
+ // Create the future and wait
+ std::future<Ret> f = std::async(std::forward<Args>(args)...);
+ std::this_thread::sleep_for(ms(300));
- {
- std::future<void> f = std::async(f2);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- f.get();
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
- }
- {
- std::future<void> f = std::async(std::launch::async, f2);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- f.get();
- Clock::time_point t1 = Clock::now();
+ // Check that deferred async's have not invoked the function.
+ assert(invoked == !IsDeferred);
+
+ // Time the call to f.get() and check that the returned value matches
+ // what is expected.
+ Clock::time_point t0 = Clock::now();
+ assert(getAndCheckFn(f));
+ Clock::time_point t1 = Clock::now();
+
+ // If the async is deferred it should take more than 100ms, otherwise
+ // it should take less than 100ms.
+ if (IsDeferred) {
+ assert(t1-t0 > ms(100));
+ } else {
assert(t1-t0 < ms(100));
}
+}
+
+int main()
+{
+ // The default launch policy is implementation defined. libc++ defines
+ // it to be std::launch::async.
+ bool DefaultPolicyIsDeferred = false;
+ bool DPID = DefaultPolicyIsDeferred;
+
+ std::launch AnyPolicy = std::launch::async | std::launch::deferred;
+ LIBCPP_ASSERT(AnyPolicy == std::launch::any);
+
{
- std::future<void> f = std::async(std::launch::any, f2);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- f.get();
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
+ auto checkInt = [](std::future<int>& f) { return f.get() == 3; };
+ test<int>(checkInt, DPID, f0);
+ test<int>(checkInt, false, std::launch::async, f0);
+ test<int>(checkInt, true, std::launch::deferred, f0);
+ test<int>(checkInt, DPID, AnyPolicy, f0);
}
{
- std::future<void> f = std::async(std::launch::deferred, f2);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- f.get();
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 > ms(100));
+ auto checkIntRef = [&](std::future<int&>& f) { return &f.get() == &i; };
+ test<int&>(checkIntRef, DPID, f1);
+ test<int&>(checkIntRef, false, std::launch::async, f1);
+ test<int&>(checkIntRef, true, std::launch::deferred, f1);
+ test<int&>(checkIntRef, DPID, AnyPolicy, f1);
}
-
{
- std::future<std::unique_ptr<int>> f = std::async(f3, 3);
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(*f.get() == 3);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
+ auto checkVoid = [](std::future<void>& f) { f.get(); return true; };
+ test<void>(checkVoid, DPID, f2);
+ test<void>(checkVoid, false, std::launch::async, f2);
+ test<void>(checkVoid, true, std::launch::deferred, f2);
+ test<void>(checkVoid, DPID, AnyPolicy, f2);
}
-
{
- std::future<std::unique_ptr<int>> f =
- std::async(f4, std::unique_ptr<int>(new int(3)));
- std::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- assert(*f.get() == 3);
- Clock::time_point t1 = Clock::now();
- assert(t1-t0 < ms(100));
+ using Ret = std::unique_ptr<int>;
+ auto checkUPtr = [](std::future<Ret>& f) { return *f.get() == 3; };
+ test<Ret>(checkUPtr, DPID, f3, 3);
+ test<Ret>(checkUPtr, DPID, f4, std::unique_ptr<int>(new int(3)));
}
-
{
std::future<void> f = std::async(f5, 3);
std::this_thread::sleep_for(ms(300));
- try { f.get(); assert (false); } catch ( int ex ) {}
+ try { f.get(); assert (false); } catch ( int ) {}
}
-
{
std::future<void> f = std::async(std::launch::deferred, f5, 3);
std::this_thread::sleep_for(ms(300));
- try { f.get(); assert (false); } catch ( int ex ) {}
+ try { f.get(); assert (false); } catch ( int ) {}
}
-
}
diff --git a/test/std/thread/futures/futures.overview/future_errc.pass.cpp b/test/std/thread/futures/futures.overview/future_errc.pass.cpp
index 1e6fcb76a0e7..06397487a734 100644
--- a/test/std/thread/futures/futures.overview/future_errc.pass.cpp
+++ b/test/std/thread/futures/futures.overview/future_errc.pass.cpp
@@ -9,22 +9,32 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+// Libc++'s enum class emulation does not allow static_cast<Enum>(0) to work.
+
// <future>
// enum class future_errc
// {
-// future_already_retrieved = 1,
-// promise_already_satisfied,
-// no_state
-// broken_promise,
+// broken_promise = implementation-defined,
+// future_already_retrieved = implementation-defined,
+// promise_already_satisfied = implementation-defined,
+// no_state = implementation-defined
// };
#include <future>
int main()
{
- static_assert(static_cast<int>(std::future_errc::future_already_retrieved) == 1, "");
- static_assert(static_cast<int>(std::future_errc::promise_already_satisfied) == 2, "");
- static_assert(static_cast<int>(std::future_errc::no_state) == 3, "");
- static_assert(static_cast<int>(std::future_errc::broken_promise) == 4, "");
+ static_assert(std::future_errc::broken_promise != std::future_errc::future_already_retrieved, "");
+ static_assert(std::future_errc::broken_promise != std::future_errc::promise_already_satisfied, "");
+ static_assert(std::future_errc::broken_promise != std::future_errc::no_state, "");
+ static_assert(std::future_errc::future_already_retrieved != std::future_errc::promise_already_satisfied, "");
+ static_assert(std::future_errc::future_already_retrieved != std::future_errc::no_state, "");
+ static_assert(std::future_errc::promise_already_satisfied != std::future_errc::no_state, "");
+
+ static_assert(std::future_errc::broken_promise != static_cast<std::future_errc>(0), "");
+ static_assert(std::future_errc::future_already_retrieved != static_cast<std::future_errc>(0), "");
+ static_assert(std::future_errc::promise_already_satisfied != static_cast<std::future_errc>(0), "");
+ static_assert(std::future_errc::no_state != static_cast<std::future_errc>(0), "");
}
diff --git a/test/std/thread/futures/futures.overview/launch.pass.cpp b/test/std/thread/futures/futures.overview/launch.pass.cpp
index da54f7ee6732..a26b01f67b3e 100644
--- a/test/std/thread/futures/futures.overview/launch.pass.cpp
+++ b/test/std/thread/futures/futures.overview/launch.pass.cpp
@@ -15,28 +15,30 @@
// {
// async = 1,
// deferred = 2,
-// any = async | deferred
+// any = async | deferred /* EXTENSION */
// };
#include <future>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
- static_assert(static_cast<int>(std::launch::any) ==
+ LIBCPP_STATIC_ASSERT(static_cast<int>(std::launch::any) ==
(static_cast<int>(std::launch::async) | static_cast<int>(std::launch::deferred)), "");
#else
- static_assert(std::launch::any == (std::launch::async | std::launch::deferred), "");
+ LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async | std::launch::deferred), "");
static_assert(std::launch(0) == (std::launch::async & std::launch::deferred), "");
- static_assert(std::launch::any == (std::launch::async ^ std::launch::deferred), "");
- static_assert(std::launch::deferred == ~std::launch::async, "");
+ LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async ^ std::launch::deferred), "");
+ LIBCPP_STATIC_ASSERT(std::launch::deferred == ~std::launch::async, "");
std::launch x = std::launch::async;
x &= std::launch::deferred;
assert(x == std::launch(0));
x = std::launch::async;
x |= std::launch::deferred;
- assert(x == std::launch::any);
+ LIBCPP_ASSERT(x == std::launch::any);
x ^= std::launch::deferred;
assert(x == std::launch::async);
#endif
diff --git a/test/std/thread/futures/futures.promise/copy_assign.fail.cpp b/test/std/thread/futures/futures.promise/copy_assign.fail.cpp
index e150ba0df65a..0311cf9b6b00 100644
--- a/test/std/thread/futures/futures.promise/copy_assign.fail.cpp
+++ b/test/std/thread/futures/futures.promise/copy_assign.fail.cpp
@@ -6,6 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
// <future>
diff --git a/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp b/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
index 34becbc1259b..779fc5bfc7c4 100644
--- a/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
+++ b/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
@@ -6,6 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp b/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp
index 9cce3f59550a..e0c6e15d98d5 100644
--- a/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
-// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-no-exceptions
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp b/test/std/thread/futures/futures.task/futures.task.members/assign_copy.fail.cpp
index 6c6418594d00..9449e1490270 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/assign_copy.fail.cpp
@@ -6,7 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-
+//
+// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/assign_move.pass.cpp
index 3f11d670bede..3f11d670bede 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/assign_move.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp
index 7097d428962a..6d7d734bd5e7 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp
@@ -6,7 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-
+//
+// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// <future>
@@ -14,7 +15,7 @@
// class packaged_task<R(ArgTypes...)>
// template <class F>
// packaged_task(F&& f);
-// These constructors shall not participate in overload resolution if
+// These constructors shall not participate in overload resolution if
// decay<F>::type is the same type as std::packaged_task<R(ArgTypes...)>.
#include <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor2.fail.cpp
index feb7657bed37..984dcdc80b32 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/ctor2.fail.cpp
@@ -6,7 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-
+//
+// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// <future>
@@ -14,7 +15,7 @@
// class packaged_task<R(ArgTypes...)>
// template <class F, class Allocator>
// packaged_task(allocator_arg_t, const Allocator& a, F&& f);
-// These constructors shall not participate in overload resolution if
+// These constructors shall not participate in overload resolution if
// decay<F>::type is the same type as std::packaged_task<R(ArgTypes...)>.
#include <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor_copy.fail.cpp
index 97624f90f3df..ff07db9a2e6f 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/ctor_copy.fail.cpp
@@ -6,7 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-
+//
+// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor_default.pass.cpp
index ed147d74895b..ed147d74895b 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/ctor_default.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor_func.pass.cpp
index 14ac7614bb8e..14ac7614bb8e 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/ctor_func.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp
index 39784876b8c3..39784876b8c3 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor_move.pass.cpp
index d9951dca585a..d9951dca585a 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/ctor_move.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
index 7fafd1005649..7fafd1005649 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
index c8e5d6efd6b4..c8e5d6efd6b4 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
index 54ac64458248..54ac64458248 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
index 9ad1509517f6..9ad1509517f6 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
index 02a567500ee2..02a567500ee2 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/swap.pass.cpp
index eb0091c8e817..eb0091c8e817 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/swap.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp b/test/std/thread/futures/futures.task/futures.task.nonmembers/swap.pass.cpp
index d90d593a75bd..d90d593a75bd 100644
--- a/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.nonmembers/swap.pass.cpp
diff --git a/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp b/test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp
index bbe75de7f8a9..bbe75de7f8a9 100644
--- a/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp
diff --git a/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp b/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
index 781c9c9d6199..d20f0c38071f 100644
--- a/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
+++ b/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
@@ -6,6 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp b/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
index 0d7b5f5074d3..e1d85ac2cfdd 100644
--- a/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
+++ b/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
@@ -6,6 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
// <future>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp
index 246eb935c995..520c9730bdf7 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: libcpp-has-no-threads
+
// <mutex>
// template <class Mutex> class lock_guard;
@@ -14,35 +16,9 @@
// explicit lock_guard(mutex_type& m);
#include <mutex>
-#include <thread>
-#include <cstdlib>
-#include <cassert>
-
-std::mutex m;
-
-typedef std::chrono::system_clock Clock;
-typedef Clock::time_point time_point;
-typedef Clock::duration duration;
-typedef std::chrono::milliseconds ms;
-typedef std::chrono::nanoseconds ns;
-
-void f()
-{
- time_point t0 = Clock::now();
- time_point t1;
- {
- std::lock_guard<std::mutex> lg = m;
- t1 = Clock::now();
- }
- ns d = t1 - t0 - ms(250);
- assert(d < ns(2500000)); // within 2.5ms
-}
int main()
{
- m.lock();
- std::thread t(f);
- std::this_thread::sleep_for(ms(250));
- m.unlock();
- t.join();
+ std::mutex m;
+ std::lock_guard<std::mutex> lg = m; // expected-error{{no viable conversion}}
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp
new file mode 100644
index 000000000000..840af6788d04
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// <mutex>
+
+// template <class ...Mutex> class lock_guard;
+
+// lock_guard(Mutex&..., adopt_lock_t);
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include <mutex>
+#include <cassert>
+
+struct TestMutex {
+ bool locked = false;
+ TestMutex() = default;
+
+ void lock() { assert(!locked); locked = true; }
+ bool try_lock() { if (locked) return false; locked = true; return true; }
+ void unlock() { assert(locked); locked = false; }
+
+ TestMutex(TestMutex const&) = delete;
+ TestMutex& operator=(TestMutex const&) = delete;
+};
+
+int main()
+{
+ {
+ using LG = std::lock_guard<>;
+ LG lg(std::adopt_lock);
+ }
+ {
+ TestMutex m1, m2;
+ using LG = std::lock_guard<TestMutex, TestMutex>;
+ m1.lock(); m2.lock();
+ {
+ LG lg(m1, m2, std::adopt_lock);
+ assert(m1.locked && m2.locked);
+ }
+ assert(!m1.locked && !m2.locked);
+ }
+ {
+ TestMutex m1, m2, m3;
+ using LG = std::lock_guard<TestMutex, TestMutex, TestMutex>;
+ m1.lock(); m2.lock(); m3.lock();
+ {
+ LG lg(m1, m2, m3, std::adopt_lock);
+ assert(m1.locked && m2.locked && m3.locked);
+ }
+ assert(!m1.locked && !m2.locked && !m3.locked);
+ }
+
+}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp
new file mode 100644
index 000000000000..18193e000edc
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// <mutex>
+
+// template <class ...Mutex> class lock_guard;
+
+// lock_guard& operator=(lock_guard const&) = delete;
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include <mutex>
+
+int main()
+{
+ using M = std::mutex;
+ M m0, m1, m2;
+ M om0, om1, om2;
+ {
+ using LG = std::lock_guard<>;
+ LG lg1, lg2;
+ lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
+ }
+ {
+ using LG = std::lock_guard<M, M>;
+ LG lg1(m0, m1);
+ LG lg2(om0, om1);
+ lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
+ }
+ {
+ using LG = std::lock_guard<M, M, M>;
+ LG lg1(m0, m1, m2);
+ LG lg2(om0, om1, om2);
+ lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
+ }
+}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp
new file mode 100644
index 000000000000..6dc37e970fb6
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// <mutex>
+
+// template <class ...Mutex> class lock_guard;
+
+// lock_guard(lock_guard const&) = delete;
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include <mutex>
+
+int main()
+{
+ using M = std::mutex;
+ M m0, m1, m2;
+ {
+ using LG = std::lock_guard<>;
+ const LG Orig;
+ LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
+ }
+ {
+ using LG = std::lock_guard<M, M>;
+ const LG Orig(m0, m1);
+ LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
+ }
+ {
+ using LG = std::lock_guard<M, M, M>;
+ const LG Orig(m0, m1, m2);
+ LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
+ }
+}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
new file mode 100644
index 000000000000..866538a2834f
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// <mutex>
+
+// template <class ...Mutex> class lock_guard;
+
+// explicit lock_guard(Mutex&...);
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include <mutex>
+
+template <class LG>
+void test_conversion(LG) {}
+
+int main()
+{
+ using M = std::mutex;
+ M m0, m1, m2;
+ M n0, n1, n2;
+ {
+ using LG = std::lock_guard<>;
+ LG lg = {}; // expected-error{{chosen constructor is explicit in copy-initialization}}
+ test_conversion<LG>({}); // expected-error{{no matching function for call}}
+ ((void)lg);
+ }
+ {
+ using LG = std::lock_guard<M, M>;
+ LG lg = {m0, m1}; // expected-error{{chosen constructor is explicit in copy-initialization}}
+ test_conversion<LG>({n0, n1}); // expected-error{{no matching function for call}}
+ ((void)lg);
+ }
+ {
+ using LG = std::lock_guard<M, M, M>;
+ LG lg = {m0, m1, m2}; // expected-error{{chosen constructor is explicit in copy-initialization}}
+ test_conversion<LG>({n0, n1, n2}); // expected-error{{no matching function for call}}
+ }
+}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
new file mode 100644
index 000000000000..4910d837cae3
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
@@ -0,0 +1,115 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// <mutex>
+
+// template <class ...Mutex> class lock_guard;
+
+// explicit lock_guard(mutex_type& m);
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include <mutex>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct TestMutex {
+ bool locked = false;
+ TestMutex() = default;
+ ~TestMutex() { assert(!locked); }
+
+ void lock() { assert(!locked); locked = true; }
+ bool try_lock() { if (locked) return false; locked = true; return true; }
+ void unlock() { assert(locked); locked = false; }
+
+ TestMutex(TestMutex const&) = delete;
+ TestMutex& operator=(TestMutex const&) = delete;
+};
+
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+struct TestMutexThrows {
+ bool locked = false;
+ bool throws_on_lock = false;
+
+ TestMutexThrows() = default;
+ ~TestMutexThrows() { assert(!locked); }
+
+ void lock() {
+ assert(!locked);
+ if (throws_on_lock) {
+ throw 42;
+ }
+ locked = true;
+ }
+
+ bool try_lock() {
+ if (locked) return false;
+ lock();
+ return true;
+ }
+
+ void unlock() { assert(locked); locked = false; }
+
+ TestMutexThrows(TestMutexThrows const&) = delete;
+ TestMutexThrows& operator=(TestMutexThrows const&) = delete;
+};
+#endif // !defined(TEST_HAS_NO_EXCEPTIONS)
+
+int main()
+{
+ {
+ using LG = std::lock_guard<>;
+ LG lg;
+ }
+ {
+ using LG = std::lock_guard<TestMutex, TestMutex>;
+ TestMutex m1, m2;
+ {
+ LG lg(m1, m2);
+ assert(m1.locked && m2.locked);
+ }
+ assert(!m1.locked && !m2.locked);
+ }
+ {
+ using LG = std::lock_guard<TestMutex, TestMutex, TestMutex>;
+ TestMutex m1, m2, m3;
+ {
+ LG lg(m1, m2, m3);
+ assert(m1.locked && m2.locked && m3.locked);
+ }
+ assert(!m1.locked && !m2.locked && !m3.locked);
+ }
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ {
+ using MT = TestMutexThrows;
+ using LG = std::lock_guard<MT, MT>;
+ MT m1, m2;
+ m1.throws_on_lock = true;
+ try {
+ LG lg(m1, m2);
+ assert(false);
+ } catch (int) {}
+ assert(!m1.locked && !m2.locked);
+ }
+ {
+ using MT = TestMutexThrows;
+ using LG = std::lock_guard<MT, MT, MT>;
+ MT m1, m2, m3;
+ m2.throws_on_lock = true;
+ try {
+ LG lg(m1, m2, m3);
+ assert(false);
+ } catch (int) {}
+ assert(!m1.locked && !m2.locked && !m3.locked);
+ }
+#endif
+}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp
new file mode 100644
index 000000000000..3c134e0b8861
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <mutex>
+
+// template <class ...Mutex> class lock_guard;
+
+// Test that the variadic lock guard implementation compiles in all standard
+// dialects, including C++03, even though it is forward declared using
+// variadic templates.
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include "mutex.pass.cpp" // Use the existing non-variadic test
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
new file mode 100644
index 000000000000..2b06742a673e
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// <mutex>
+
+// template <class Mutex>
+// class lock_guard
+// {
+// public:
+// typedef Mutex mutex_type;
+// ...
+// };
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include <mutex>
+#include <type_traits>
+
+struct NAT {};
+
+template <class LG>
+auto test_typedef(int) -> typename LG::mutex_type;
+
+template <class LG>
+auto test_typedef(...) -> NAT;
+
+template <class LG>
+constexpr bool has_mutex_type() {
+ return !std::is_same<decltype(test_typedef<LG>(0)), NAT>::value;
+}
+
+int main()
+{
+ {
+ using T = std::lock_guard<>;
+ static_assert(!has_mutex_type<T>(), "");
+ }
+ {
+ using M1 = std::mutex;
+ using T = std::lock_guard<M1>;
+ static_assert(std::is_same<T::mutex_type, M1>::value, "");
+ }
+ {
+ using M1 = std::recursive_mutex;
+ using T = std::lock_guard<M1>;
+ static_assert(std::is_same<T::mutex_type, M1>::value, "");
+ }
+ {
+ using M1 = std::mutex;
+ using M2 = std::recursive_mutex;
+ using T = std::lock_guard<M1, M2>;
+ static_assert(!has_mutex_type<T>(), "");
+ }
+ {
+ using M1 = std::mutex;
+ using M2 = std::recursive_mutex;
+ using T = std::lock_guard<M1, M1, M2>;
+ static_assert(!has_mutex_type<T>(), "");
+ }
+ {
+ using M1 = std::mutex;
+ using T = std::lock_guard<M1, M1>;
+ static_assert(!has_mutex_type<T>(), "");
+ }
+ {
+ using M1 = std::recursive_mutex;
+ using T = std::lock_guard<M1, M1, M1>;
+ static_assert(!has_mutex_type<T>(), "");
+ }
+}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_assign.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_assign.fail.cpp
index 446807f3f333..79f43e860ca2 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_assign.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_assign.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
// template <class Mutex> class shared_lock;
@@ -15,20 +16,12 @@
#include <shared_mutex>
-#if _LIBCPP_STD_VER > 11
-
std::shared_timed_mutex m0;
std::shared_timed_mutex m1;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<std::shared_timed_mutex> lk0(m0);
std::shared_lock<std::shared_timed_mutex> lk1(m1);
lk1 = lk0;
-#else
-# error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_ctor.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_ctor.fail.cpp
index 370c1fa4e336..d6bf57947afe 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_ctor.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/copy_ctor.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
// template <class Mutex> class shared_lock;
@@ -15,16 +16,10 @@
#include <shared_mutex>
-#if _LIBCPP_STD_VER > 11
std::shared_timed_mutex m;
-#endif // _LIBCPP_STD_VER > 11
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<std::shared_timed_mutex> lk0(m);
std::shared_lock<std::shared_timed_mutex> lk = lk0;
-#else
-# error
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp
index 15c193c60b5d..bd707bb90ce1 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp
@@ -18,17 +18,33 @@
#include <shared_mutex>
#include <cassert>
+#include "nasty_containers.hpp"
-std::shared_timed_mutex m0;
-std::shared_timed_mutex m1;
int main()
{
- std::shared_lock<std::shared_timed_mutex> lk0(m0);
- std::shared_lock<std::shared_timed_mutex> lk1(m1);
+ {
+ typedef std::shared_timed_mutex M;
+ M m0;
+ M m1;
+ std::shared_lock<M> lk0(m0);
+ std::shared_lock<M> lk1(m1);
lk1 = std::move(lk0);
- assert(lk1.mutex() == &m0);
+ assert(lk1.mutex() == std::addressof(m0));
assert(lk1.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
+ }
+ {
+ typedef nasty_mutex M;
+ M m0;
+ M m1;
+ std::shared_lock<M> lk0(m0);
+ std::shared_lock<M> lk1(m1);
+ lk1 = std::move(lk0);
+ assert(lk1.mutex() == std::addressof(m0));
+ assert(lk1.owns_lock() == true);
+ assert(lk0.mutex() == nullptr);
+ assert(lk0.owns_lock() == false);
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp
index 4f4f6a5e9fbd..c29a3fb04d0f 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp
@@ -18,14 +18,28 @@
#include <shared_mutex>
#include <cassert>
+#include "nasty_containers.hpp"
int main()
{
- std::shared_timed_mutex m;
- std::shared_lock<std::shared_timed_mutex> lk0(m);
- std::shared_lock<std::shared_timed_mutex> lk = std::move(lk0);
- assert(lk.mutex() == &m);
+ {
+ typedef std::shared_timed_mutex M;
+ M m;
+ std::shared_lock<M> lk0(m);
+ std::shared_lock<M> lk = std::move(lk0);
+ assert(lk.mutex() == std::addressof(m));
assert(lk.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
+ }
+ {
+ typedef nasty_mutex M;
+ M m;
+ std::shared_lock<M> lk0(m);
+ std::shared_lock<M> lk = std::move(lk0);
+ assert(lk.mutex() == std::addressof(m));
+ assert(lk.owns_lock() == true);
+ assert(lk0.mutex() == nullptr);
+ assert(lk0.owns_lock() == false);
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp
index 995210221065..341f0ce7efd2 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp
@@ -18,12 +18,24 @@
#include <shared_mutex>
#include <cassert>
+#include "nasty_containers.hpp"
int main()
{
- std::shared_timed_mutex m;
- m.lock_shared();
- std::shared_lock<std::shared_timed_mutex> lk(m, std::adopt_lock);
- assert(lk.mutex() == &m);
+ {
+ typedef std::shared_timed_mutex M;
+ M m;
+ m.lock();
+ std::unique_lock<M> lk(m, std::adopt_lock);
+ assert(lk.mutex() == std::addressof(m));
assert(lk.owns_lock() == true);
+ }
+ {
+ typedef nasty_mutex M;
+ M m;
+ m.lock();
+ std::unique_lock<M> lk(m, std::adopt_lock);
+ assert(lk.mutex() == std::addressof(m));
+ assert(lk.owns_lock() == true);
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp
index d81796b95bf3..5fbb7244ef8e 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp
@@ -18,11 +18,22 @@
#include <shared_mutex>
#include <cassert>
+#include "nasty_containers.hpp"
int main()
{
- std::shared_timed_mutex m;
- std::shared_lock<std::shared_timed_mutex> lk(m, std::defer_lock);
- assert(lk.mutex() == &m);
+ {
+ typedef std::shared_timed_mutex M;
+ M m;
+ std::unique_lock<M> lk(m, std::defer_lock);
+ assert(lk.mutex() == std::addressof(m));
assert(lk.owns_lock() == false);
+ }
+ {
+ typedef nasty_mutex M;
+ M m;
+ std::unique_lock<M> lk(m, std::defer_lock);
+ assert(lk.mutex() == std::addressof(m));
+ assert(lk.owns_lock() == false);
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp
index 4f477449d6a2..8d864ea8e7da 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp
@@ -16,16 +16,18 @@
#include <mutex>
#include <cassert>
-std::mutex m0;
-std::mutex m1;
-
int main()
{
- std::unique_lock<std::mutex> lk0(m0);
- std::unique_lock<std::mutex> lk1(m1);
+ {
+ typedef std::mutex M;
+ M m0;
+ M m1;
+ std::unique_lock<M> lk0(m0);
+ std::unique_lock<M> lk1(m1);
lk1 = lk0;
assert(lk1.mutex() == &m0);
assert(lk1.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp
index 4888fe90d92c..067302127cad 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp
@@ -16,14 +16,16 @@
#include <mutex>
#include <cassert>
-std::mutex m;
-
int main()
{
- std::unique_lock<std::mutex> lk0(m);
- std::unique_lock<std::mutex> lk = lk0;
+ {
+ typedef std::mutex M;
+ M m;
+ std::unique_lock<M> lk0(m);
+ std::unique_lock<M> lk = lk0;
assert(lk.mutex() == &m);
assert(lk.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp
index 4dff853088ac..e5db685e46e7 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp
@@ -17,19 +17,34 @@
#include <mutex>
#include <cassert>
-
-std::mutex m0;
-std::mutex m1;
+#include "nasty_containers.hpp"
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- std::unique_lock<std::mutex> lk0(m0);
- std::unique_lock<std::mutex> lk1(m1);
+ {
+ typedef std::mutex M;
+ M m0;
+ M m1;
+ std::unique_lock<M> lk0(m0);
+ std::unique_lock<M> lk1(m1);
+ lk1 = std::move(lk0);
+ assert(lk1.mutex() == std::addressof(m0));
+ assert(lk1.owns_lock() == true);
+ assert(lk0.mutex() == nullptr);
+ assert(lk0.owns_lock() == false);
+ }
+ {
+ typedef nasty_mutex M;
+ M m0;
+ M m1;
+ std::unique_lock<M> lk0(m0);
+ std::unique_lock<M> lk1(m1);
lk1 = std::move(lk0);
- assert(lk1.mutex() == &m0);
+ assert(lk1.mutex() == std::addressof(m0));
assert(lk1.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
+ }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
index aa640ee6d746..427deabc5a59 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
@@ -17,17 +17,30 @@
#include <mutex>
#include <cassert>
-
-std::mutex m;
+#include "nasty_containers.hpp"
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- std::unique_lock<std::mutex> lk0(m);
- std::unique_lock<std::mutex> lk = std::move(lk0);
- assert(lk.mutex() == &m);
+ {
+ typedef std::mutex M;
+ M m;
+ std::unique_lock<M> lk0(m);
+ std::unique_lock<M> lk = std::move(lk0);
+ assert(lk.mutex() == std::addressof(m));
+ assert(lk.owns_lock() == true);
+ assert(lk0.mutex() == nullptr);
+ assert(lk0.owns_lock() == false);
+ }
+ {
+ typedef nasty_mutex M;
+ M m;
+ std::unique_lock<M> lk0(m);
+ std::unique_lock<M> lk = std::move(lk0);
+ assert(lk.mutex() == std::addressof(m));
assert(lk.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
+ }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp
index 9c3a7b6505a4..20f7d249b6f4 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp
@@ -17,12 +17,24 @@
#include <mutex>
#include <cassert>
+#include "nasty_containers.hpp"
int main()
{
- std::mutex m;
+ {
+ typedef std::mutex M;
+ M m;
m.lock();
- std::unique_lock<std::mutex> lk(m, std::adopt_lock);
- assert(lk.mutex() == &m);
+ std::unique_lock<M> lk(m, std::adopt_lock);
+ assert(lk.mutex() == std::addressof(m));
assert(lk.owns_lock() == true);
+ }
+ {
+ typedef nasty_mutex M;
+ M m;
+ m.lock();
+ std::unique_lock<M> lk(m, std::adopt_lock);
+ assert(lk.mutex() == std::addressof(m));
+ assert(lk.owns_lock() == true);
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp
index bf622311f013..242dacb1eb92 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp
@@ -17,11 +17,22 @@
#include <mutex>
#include <cassert>
+#include "nasty_containers.hpp"
int main()
{
- std::mutex m;
- std::unique_lock<std::mutex> lk(m, std::defer_lock);
- assert(lk.mutex() == &m);
+ {
+ typedef std::mutex M;
+ M m;
+ std::unique_lock<M> lk(m, std::defer_lock);
+ assert(lk.mutex() == std::addressof(m));
assert(lk.owns_lock() == false);
+ }
+ {
+ typedef nasty_mutex M;
+ M m;
+ std::unique_lock<M> lk(m, std::defer_lock);
+ assert(lk.mutex() == std::addressof(m));
+ assert(lk.owns_lock() == false);
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp
index 5c67a34ab52b..81995f6c8888 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11, c++14
// <shared_mutex>
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp
index c7cac6041c82..e4bee4bb7ad1 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11, c++14
// <shared_mutex>
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/assign.fail.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/assign.fail.cpp
index 528aaca6d9e1..0c5bfa804bea 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/assign.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/assign.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
// class shared_timed_mutex;
@@ -17,11 +18,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_timed_mutex m0;
std::shared_timed_mutex m1;
m1 = m0;
-#else
-# error
-#endif
}
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/copy.fail.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/copy.fail.cpp
index dbf01002e691..3656ec62ec17 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/copy.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/copy.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
// class shared_timed_mutex;
@@ -17,10 +18,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_timed_mutex m0;
std::shared_timed_mutex m1(m0);
-#else
-# error
-#endif
}
diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
index afc318cc3d7a..71b054fced88 100644
--- a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
@@ -21,6 +21,8 @@
#include <thread>
#include <cassert>
+#include "test_macros.h"
+
typedef std::chrono::milliseconds ms;
std::once_flag flg0;
@@ -171,7 +173,7 @@ public:
void operator()(int&) {}
};
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
// reference qualifiers on functions are a C++11 extension
struct RefQual
{
@@ -240,7 +242,7 @@ int main()
int i = 0;
std::call_once(f, NonCopyable(), i);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
// reference qualifiers on functions are a C++11 extension
{
std::once_flag f1, f2;
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
index 3de15af8929b..5dd6a40a0eb7 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
@@ -20,23 +20,30 @@
#include <thread>
#include <new>
+#include <atomic>
#include <cstdlib>
#include <cassert>
#include "test_macros.h"
-unsigned throw_one = 0xFFFF;
+std::atomic<unsigned> throw_one(0xFFFF);
+std::atomic<unsigned> outstanding_new(0);
+
void* operator new(std::size_t s) throw(std::bad_alloc)
{
if (throw_one == 0)
throw std::bad_alloc();
--throw_one;
- return std::malloc(s);
+ ++outstanding_new;
+ void* ret = std::malloc(s);
+ if (!ret) std::abort(); // placate MSVC's unchecked malloc warning
+ return ret;
}
void operator delete(void* p) throw()
{
+ --outstanding_new;
std::free(p);
}
@@ -94,27 +101,58 @@ public:
#endif
-int main()
-{
+// Test throwing std::bad_alloc
+//-----------------------------
+// Concerns:
+// A Each allocation performed during thread construction should be performed
+// in the parent thread so that std::terminate is not called if
+// std::bad_alloc is thrown by new.
+// B std::threads constructor should properly handle exceptions and not leak
+// memory.
+// Plan:
+// 1 Create a thread and count the number of allocations, 'N', it performs.
+// 2 For each allocation performed run a test where that allocation throws.
+// 2.1 check that the exception can be caught in the parent thread.
+// 2.2 Check that the functor has not been called.
+// 2.3 Check that no memory allocated by the creation of the thread is leaked.
+// 3 Finally check that a thread runs successfully if we throw after 'N+1'
+// allocations.
+void test_throwing_new_during_thread_creation() {
+ throw_one = 0xFFF;
{
std::thread t(f);
t.join();
- assert(f_run == true);
}
- f_run = false;
- {
- try
- {
- throw_one = 0;
+ const int numAllocs = 0xFFF - throw_one;
+ // i <= numAllocs means the last iteration is expected not to throw.
+ for (int i=0; i <= numAllocs; ++i) {
+ throw_one = i;
+ f_run = false;
+ unsigned old_outstanding = outstanding_new;
+ try {
std::thread t(f);
- assert(false);
- }
- catch (...)
- {
- throw_one = 0xFFFF;
- assert(!f_run);
+ assert(i == numAllocs); // Only final iteration will not throw.
+ t.join();
+ assert(f_run);
+ } catch (std::bad_alloc const&) {
+ assert(i < numAllocs);
+ assert(!f_run); // (2.2)
}
+ assert(old_outstanding == outstanding_new); // (2.3)
+ }
+ f_run = false;
+ throw_one = 0xFFF;
+}
+
+int main()
+{
+ test_throwing_new_during_thread_creation();
+ {
+ std::thread t(f);
+ t.join();
+ assert(f_run == true);
}
+
{
assert(G::n_alive == 0);
assert(!G::op_run);
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/constr.fail.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/constr.fail.cpp
index a331add96263..54fc0b80280c 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/constr.fail.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/constr.fail.cpp
@@ -12,7 +12,7 @@
// class thread
// template <class _Fp, class ..._Args,
// explicit thread(_Fp&& __f, _Args&&... __args);
-// This constructor shall not participate in overload resolution
+// This constructor shall not participate in overload resolution
// if decay<F>::type is the same type as std::thread.
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
index 726395d99044..3dd7c6a6014c 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
@@ -17,8 +17,11 @@
#include <thread>
#include <atomic>
+#include <system_error>
#include <cassert>
+#include "test_macros.h"
+
std::atomic_bool done(false);
class G
@@ -57,6 +60,8 @@ public:
int G::n_alive = 0;
bool G::op_run = false;
+void foo() {}
+
int main()
{
{
@@ -70,4 +75,16 @@ int main()
assert(G::n_alive == 1);
}
assert(G::n_alive == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ std::thread t0(foo);
+ assert(t0.joinable());
+ t0.detach();
+ assert(!t0.joinable());
+ try {
+ t0.detach();
+ } catch (std::system_error const&) {
+ }
+ }
+#endif
}
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
index 0512e49dcb33..f0c3ef74c9ab 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
@@ -19,6 +19,9 @@
#include <new>
#include <cstdlib>
#include <cassert>
+#include <system_error>
+
+#include "test_macros.h"
class G
{
@@ -42,6 +45,8 @@ public:
int G::n_alive = 0;
bool G::op_run = false;
+void foo() {}
+
int main()
{
{
@@ -50,5 +55,23 @@ int main()
assert(t0.joinable());
t0.join();
assert(!t0.joinable());
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ t0.join();
+ assert(false);
+ } catch (std::system_error const&) {
+ }
+#endif
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ std::thread t0(foo);
+ t0.detach();
+ try {
+ t0.join();
+ assert(false);
+ } catch (std::system_error const&) {
+ }
}
+#endif
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
index e165d9836db0..81c366e0668f 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
@@ -11,7 +11,9 @@
#include <memory>
#include <cassert>
-#if __cplusplus >= 201103L
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
// #include <memory>
//
// template <class Alloc>
@@ -20,7 +22,7 @@
// typedef Alloc allocator_type;
// typedef typename allocator_type::value_type
// value_type;
-//
+//
// typedef Alloc::pointer | value_type* pointer;
// typedef Alloc::const_pointer
// | pointer_traits<pointer>::rebind<const value_type>
@@ -37,7 +39,10 @@ void test_pointer()
{
typename std::allocator_traits<Alloc>::pointer vp;
typename std::allocator_traits<Alloc>::const_pointer cvp;
-
+
+ ((void)vp); // Prevent unused warning
+ ((void)cvp); // Prevent unused warning
+
static_assert(std::is_same<bool, decltype( vp == vp)>::value, "");
static_assert(std::is_same<bool, decltype( vp != vp)>::value, "");
static_assert(std::is_same<bool, decltype( vp > vp)>::value, "");
@@ -71,7 +76,10 @@ void test_void_pointer()
{
typename std::allocator_traits<Alloc>::void_pointer vp;
typename std::allocator_traits<Alloc>::const_void_pointer cvp;
-
+
+ ((void)vp); // Prevent unused warning
+ ((void)cvp); // Prevent unused warning
+
static_assert(std::is_same<bool, decltype( vp == vp)>::value, "");
static_assert(std::is_same<bool, decltype( vp != vp)>::value, "");
static_assert(std::is_same<bool, decltype( vp > vp)>::value, "");
@@ -110,7 +118,7 @@ int main()
test_void_pointer<std::scoped_allocator_adaptor<std::allocator<char>>> ();
test_void_pointer<std::scoped_allocator_adaptor<std::allocator<int>>> ();
- test_void_pointer<std::scoped_allocator_adaptor<std::allocator<Foo>>> ();
+ test_void_pointer<std::scoped_allocator_adaptor<std::allocator<Foo>>> ();
}
#else
int main() {}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp
index e19e731f6cf2..90fe944125b5 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp
@@ -32,7 +32,7 @@ int main()
static_assert( (std::is_same<
std::allocator_traits<min_allocator<int>>::is_always_equal, std::true_type>::value
), "" );
-
+
// wrapping one allocator
static_assert(
(std::is_same<
@@ -51,14 +51,14 @@ int main()
static_assert((
std::scoped_allocator_adaptor<A1<int>, A2<int>>::is_always_equal::value ==
( std::allocator_traits<A1<int>>::is_always_equal::value &&
- std::allocator_traits<A2<int>>::is_always_equal::value)
+ std::allocator_traits<A2<int>>::is_always_equal::value)
), "");
// wrapping two allocators (check the values instead of the types)
static_assert((
std::scoped_allocator_adaptor<A1<int>, min_allocator<int>>::is_always_equal::value ==
( std::allocator_traits<A1<int>>::is_always_equal::value &&
- std::allocator_traits<min_allocator<int>>::is_always_equal::value)
+ std::allocator_traits<min_allocator<int>>::is_always_equal::value)
), "");
@@ -66,8 +66,8 @@ int main()
static_assert((
std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::is_always_equal::value ==
( std::allocator_traits<A1<int>>::is_always_equal::value &&
- std::allocator_traits<A2<int>>::is_always_equal::value &&
- std::allocator_traits<A3<int>>::is_always_equal::value)
+ std::allocator_traits<A2<int>>::is_always_equal::value &&
+ std::allocator_traits<A3<int>>::is_always_equal::value)
), "");
diff --git a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp
index 8d4cb6abe84a..51dd67f9ffdc 100644
--- a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp
@@ -16,7 +16,7 @@
// bool
// operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
// const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
-//
+//
// template <class OuterA1, class OuterA2, class... InnerAllocs>
// bool
// operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
diff --git a/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
index 3c093fc093c3..ce544c78b676 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(f2(3,2) == 5);
assert(f2(3.0, 2) == 5);
assert(f2(3, 2.5) == 5.5);
-
+
constexpr int foo = std::plus<int> () (3, 2);
static_assert ( foo == 5, "" );
diff --git a/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
index 72b4b4a0a1fe..b85f439ba7a0 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
#include <functional>
#include <string>
@@ -22,9 +23,8 @@ public:
};
-int main () {
-#if _LIBCPP_STD_VER > 11
-
+int main ()
+{
static_assert ( !is_transparent<std::plus<int>>::value, "" );
static_assert ( !is_transparent<std::plus<std::string>>::value, "" );
static_assert ( is_transparent<std::plus<void>>::value, "" );
@@ -54,8 +54,6 @@ int main () {
static_assert ( !is_transparent<std::negate<std::string>>::value, "" );
static_assert ( is_transparent<std::negate<void>>::value, "" );
static_assert ( is_transparent<std::negate<>>::value, "" );
-
-#endif
return 0;
- }
+}
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp
new file mode 100644
index 000000000000..5e347c4c5715
--- /dev/null
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <functional>
+
+// template<CopyConstructible Fn, CopyConstructible... Types>
+// unspecified bind(Fn, Types...);
+// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
+// unspecified bind(Fn, Types...);
+
+// https://llvm.org/bugs/show_bug.cgi?id=23141
+#include <functional>
+#include <type_traits>
+
+struct Fun
+{
+ template<typename T, typename U>
+ void operator()(T &&, U &&) const
+ {
+ static_assert(std::is_same<U, int &>::value, "");
+ }
+};
+
+int main()
+{
+ std::bind(Fun{}, std::placeholders::_1, 42)("hello");
+}
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
new file mode 100644
index 000000000000..63d3c9b0de92
--- /dev/null
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
@@ -0,0 +1,131 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <functional>
+
+// template<CopyConstructible Fn, CopyConstructible... Types>
+// unspecified bind(Fn, Types...);
+// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
+// unspecified bind(Fn, Types...);
+
+// Check that the call operators have the proper return type and that they
+// only SFINAE away when too few arguments are provided. Otherwise they should
+// be well formed and should ignore any additional arguments.
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int dummy = 42;
+
+int return_value(int) { return dummy; }
+int& return_lvalue(int) { return dummy; }
+const int& return_const_lvalue(int) { return dummy; }
+int&& return_rvalue(int) { return std::move(dummy); }
+const int&& return_const_rvalue(int) { return std::move(dummy); }
+
+template <class Bind, class ...Args>
+auto CheckCallImp(int)
+ -> decltype((std::declval<Bind>()(std::declval<Args>()...)), std::true_type{});
+
+template <class Bind, class ...>
+auto CheckCallImp(long) -> std::false_type;
+
+template <class ...Args>
+constexpr bool CheckCall() {
+ return decltype(CheckCallImp<Args...>(0))::value;
+}
+
+template <class Expect, class Fn>
+void do_test(Fn* func) {
+ using namespace std::placeholders;
+ auto ret = std::bind(func, _1);
+ auto ret_r = std::bind<Expect>(func, _1);
+ using Bind = decltype(ret);
+ using BindR = decltype(ret_r);
+
+ using Ret = decltype(ret(42));
+ using Ret2 = decltype(ret(42, 43)); // Test that the extra argument is discarded.
+ using RetR = decltype(ret_r(42));
+ using RetR2 = decltype(ret_r(42, 43));
+
+ static_assert(std::is_same<Ret, Expect>::value, "");
+ static_assert(std::is_same<Ret2, Expect>::value, "");
+ static_assert(std::is_same<RetR, Expect>::value, "");
+ static_assert(std::is_same<RetR2, Expect>::value, "");
+
+ Expect exp = ret(100); // the input value is ignored. dummy is returned.
+ Expect exp2 = ret(101, 102);
+ Expect exp_r = ret_r(100);
+ Expect exp_r2 = ret_r(101, 102);
+
+ assert(exp == 42);
+ assert(exp2 == 42);
+ assert(exp_r == 42);
+ assert(exp_r2 == 42);
+
+ if ((std::is_reference<Expect>::value)) {
+ assert(&exp == &dummy);
+ assert(&exp2 == &dummy);
+ assert(&exp_r == &dummy);
+ assert(&exp_r2 == &dummy);
+ }
+ // Check that the call operator SFINAE's away when too few arguments
+ // are provided but is well-formed otherwise.
+ {
+ static_assert(!CheckCall<Bind>(), "");
+ static_assert(CheckCall<Bind, int>(), "");
+ static_assert(CheckCall<Bind, int, int>(), "");
+ static_assert(!CheckCall<BindR>(), "");
+ static_assert(CheckCall<BindR, int>(), "");
+ static_assert(CheckCall<BindR, int, int>(), "");
+ }
+}
+
+
+// Test but with an explicit return type which differs from the real one.
+template <class Expect, class Fn>
+void do_test_r(Fn* func) {
+ using namespace std::placeholders;
+ auto ret = std::bind<Expect>(func, _1);
+ using Bind = decltype(ret);
+ using Ret = decltype(ret(42));
+ using Ret2 = decltype(ret(42, 43)); // Test that the extra argument is discarded.
+ static_assert(std::is_same<Ret, Expect>::value, "");
+ static_assert(std::is_same<Ret2, Expect>::value, "");
+ Expect exp = ret(100); // the input value is ignored
+ Expect exp2 = ret(101, 102);
+ assert(exp == 42);
+ assert(exp2 == 42);
+ // Check that the call operator SFINAE's away when too few arguments
+ // are provided but is well-formed otherwise.
+ {
+ static_assert(!CheckCall<Bind>(), "");
+ static_assert(CheckCall<Bind, int>(), "");
+ static_assert(CheckCall<Bind, int, int>(), "");
+ }
+}
+
+int main()
+{
+ do_test<int>(return_value);
+ do_test<int&>(return_lvalue);
+ do_test<const int&>(return_const_lvalue);
+ do_test<int&&>(return_rvalue);
+ do_test<const int&&>(return_const_rvalue);
+
+ do_test_r<long>(return_value);
+ do_test_r<long>(return_lvalue);
+ do_test_r<long>(return_const_lvalue);
+ do_test_r<long>(return_rvalue);
+ do_test_r<long>(return_const_rvalue);
+
+}
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
index 4577d0bf4d54..a0c686de77ba 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
@@ -23,7 +23,7 @@
struct DummyUnaryFunction
{
template <typename S>
- int operator()(S const & s) const { return 0; }
+ int operator()(S const &) const { return 0; }
};
struct BadUnaryFunction
@@ -39,7 +39,7 @@ struct BadUnaryFunction
}
};
-int main(int argc, char* argv[])
+int main()
{
// Check that BadUnaryFunction::operator()(S const &) is not
// instantiated when checking if BadUnaryFunction is a nested bind
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
index f69afbf57667..dbbd184c7833 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
@@ -286,4 +286,5 @@ int main()
test_void_1();
test_int_1();
test_void_2();
+ test3();
}
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
index 246186040c56..68986ac1aeb3 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
@@ -10,10 +10,14 @@
// <functional>
// placeholders
+// The placeholders are constexpr in C++17 and beyond.
+// libc++ provides constexpr placeholders in C++11 and beyond.
#include <functional>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
void
test(const T& t)
@@ -28,6 +32,30 @@ test(const T& t)
static_assert(std::is_nothrow_move_constructible<T>::value, "");
}
+#if TEST_STD_VER >= 11
+constexpr decltype(std::placeholders::_1) default1{};
+constexpr decltype(std::placeholders::_2) default2{};
+constexpr decltype(std::placeholders::_3) default3{};
+constexpr decltype(std::placeholders::_4) default4{};
+constexpr decltype(std::placeholders::_5) default5{};
+constexpr decltype(std::placeholders::_6) default6{};
+constexpr decltype(std::placeholders::_7) default7{};
+constexpr decltype(std::placeholders::_8) default8{};
+constexpr decltype(std::placeholders::_9) default9{};
+constexpr decltype(std::placeholders::_10) default10{};
+
+constexpr decltype(std::placeholders::_1) cp1 = std::placeholders::_1;
+constexpr decltype(std::placeholders::_2) cp2 = std::placeholders::_2;
+constexpr decltype(std::placeholders::_3) cp3 = std::placeholders::_3;
+constexpr decltype(std::placeholders::_4) cp4 = std::placeholders::_4;
+constexpr decltype(std::placeholders::_5) cp5 = std::placeholders::_5;
+constexpr decltype(std::placeholders::_6) cp6 = std::placeholders::_6;
+constexpr decltype(std::placeholders::_7) cp7 = std::placeholders::_7;
+constexpr decltype(std::placeholders::_8) cp8 = std::placeholders::_8;
+constexpr decltype(std::placeholders::_9) cp9 = std::placeholders::_9;
+constexpr decltype(std::placeholders::_10) cp10 = std::placeholders::_10;
+#endif // TEST_STD_VER >= 11
+
int main()
{
test(std::placeholders::_1);
diff --git a/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp b/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp
index 48800a366a81..d5788986dd25 100644
--- a/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp
+++ b/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <functional>
// bit_not
@@ -17,7 +18,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
typedef std::bit_not<int> F;
const F f = F();
static_assert((std::is_same<F::argument_type, int>::value), "" );
@@ -43,5 +43,4 @@ int main()
constexpr int bar = std::bit_not<> () (0xEA95) & 0xFFFF;
static_assert ( bar == 0x156A, "" );
-#endif
}
diff --git a/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp b/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp
index 9f8e15dd55fe..db7168c44f8b 100644
--- a/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
#include <functional>
#include <string>
@@ -23,8 +24,6 @@ public:
int main () {
-#if _LIBCPP_STD_VER > 11
-
static_assert ( !is_transparent<std::bit_and<int>>::value, "" );
static_assert ( !is_transparent<std::bit_and<std::string>>::value, "" );
static_assert ( is_transparent<std::bit_and<void>>::value, "" );
@@ -44,8 +43,6 @@ int main () {
static_assert ( !is_transparent<std::bit_not<std::string>>::value, "" );
static_assert ( is_transparent<std::bit_not<void>>::value, "" );
static_assert ( is_transparent<std::bit_not<>>::value, "" );
-
-#endif
return 0;
- }
+}
diff --git a/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp b/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
index 60415ec75d60..d4d99756fecc 100644
--- a/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
+++ b/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::equal_to<int> F;
@@ -24,7 +26,7 @@ int main()
static_assert((std::is_same<bool, F::result_type>::value), "" );
assert(f(36, 36));
assert(!f(36, 6));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::equal_to<> F2;
const F2 f2 = F2();
assert(f2(36, 36));
diff --git a/test/std/utilities/function.objects/comparisons/greater.pass.cpp b/test/std/utilities/function.objects/comparisons/greater.pass.cpp
index 164f09aa605c..50bdcceee1c9 100644
--- a/test/std/utilities/function.objects/comparisons/greater.pass.cpp
+++ b/test/std/utilities/function.objects/comparisons/greater.pass.cpp
@@ -15,6 +15,9 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
int main()
{
typedef std::greater<int> F;
@@ -25,7 +28,12 @@ int main()
assert(!f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
-#if _LIBCPP_STD_VER > 11
+ {
+ // test total ordering of int* for greater<int*> and
+ // greater<void>.
+ do_pointer_comparison_test<int, std::greater>();
+ }
+#if TEST_STD_VER > 11
typedef std::greater<> F2;
const F2 f2 = F2();
assert(!f2(36, 36));
diff --git a/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp b/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
index e89c14e24625..0aacb81e9cb4 100644
--- a/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
+++ b/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
@@ -15,6 +15,9 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
int main()
{
typedef std::greater_equal<int> F;
@@ -25,7 +28,12 @@ int main()
assert(f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
-#if _LIBCPP_STD_VER > 11
+ {
+ // test total ordering of int* for greater_equal<int*> and
+ // greater_equal<void>.
+ do_pointer_comparison_test<int, std::greater_equal>();
+ }
+#if TEST_STD_VER > 11
typedef std::greater_equal<> F2;
const F2 f2 = F2();
assert(f2(36, 36));
diff --git a/test/std/utilities/function.objects/comparisons/less.pass.cpp b/test/std/utilities/function.objects/comparisons/less.pass.cpp
index 74fe166a0cd9..191d58d6e544 100644
--- a/test/std/utilities/function.objects/comparisons/less.pass.cpp
+++ b/test/std/utilities/function.objects/comparisons/less.pass.cpp
@@ -15,6 +15,9 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
int main()
{
typedef std::less<int> F;
@@ -25,7 +28,11 @@ int main()
assert(!f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
-#if _LIBCPP_STD_VER > 11
+ {
+ // test total ordering of int* for less<int*> and less<void>.
+ do_pointer_comparison_test<int, std::less>();
+ }
+#if TEST_STD_VER > 11
typedef std::less<> F2;
const F2 f2 = F2();
assert(!f2(36, 36));
diff --git a/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp b/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp
index e6ba1f7f8a21..a6aca5d19569 100644
--- a/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp
+++ b/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp
@@ -15,6 +15,9 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
int main()
{
typedef std::less_equal<int> F;
@@ -25,7 +28,12 @@ int main()
assert(f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
-#if _LIBCPP_STD_VER > 11
+ {
+ // test total ordering of int* for less_equal<int*> and
+ // less_equal<void>.
+ do_pointer_comparison_test<int, std::less_equal>();
+ }
+#if TEST_STD_VER > 11
typedef std::less_equal<> F2;
const F2 f2 = F2();
assert( f2(36, 36));
diff --git a/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp b/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
index 3e710b3e0c70..777c25d520a9 100644
--- a/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
+++ b/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::not_equal_to<int> F;
@@ -24,7 +26,7 @@ int main()
static_assert((std::is_same<bool, F::result_type>::value), "" );
assert(!f(36, 36));
assert(f(36, 6));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::not_equal_to<> F2;
const F2 f2 = F2();
assert(!f2(36, 36));
diff --git a/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp b/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp
new file mode 100644
index 000000000000..66d783a6e357
--- /dev/null
+++ b/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp
@@ -0,0 +1,39 @@
+#ifndef POINTER_COMPARISON_TEST_HELPER_HPP
+#define POINTER_COMPARISON_TEST_HELPER_HPP
+
+#include <vector>
+#include <memory>
+#include <cstdint>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T, template<class> class CompareTemplate>
+void do_pointer_comparison_test() {
+ typedef CompareTemplate<T*> Compare;
+ typedef CompareTemplate<std::uintptr_t> UIntCompare;
+#if TEST_STD_VER > 11
+ typedef CompareTemplate<void> VoidCompare;
+#else
+ typedef Compare VoidCompare;
+#endif
+ std::vector<std::shared_ptr<T> > pointers;
+ const std::size_t test_size = 100;
+ for (int i=0; i < test_size; ++i)
+ pointers.push_back(std::shared_ptr<T>(new T()));
+ Compare comp;
+ UIntCompare ucomp;
+ VoidCompare vcomp;
+ for (int i=0; i < test_size; ++i) {
+ for (int j=0; j < test_size; ++j) {
+ T* lhs = pointers[i].get();
+ T* rhs = pointers[j].get();
+ std::uintptr_t lhs_uint = reinterpret_cast<std::uintptr_t>(lhs);
+ std::uintptr_t rhs_uint = reinterpret_cast<std::uintptr_t>(rhs);
+ assert(comp(lhs, rhs) == ucomp(lhs_uint, rhs_uint));
+ assert(vcomp(lhs, rhs) == ucomp(lhs_uint, rhs_uint));
+ }
+ }
+}
+
+#endif // POINTER_COMPARISON_TEST_HELPER_HPP
diff --git a/test/std/utilities/function.objects/comparisons/transparent.pass.cpp b/test/std/utilities/function.objects/comparisons/transparent.pass.cpp
index 41ce4bcae65f..f353fe7a72a6 100644
--- a/test/std/utilities/function.objects/comparisons/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/comparisons/transparent.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
#include <functional>
#include <string>
@@ -22,9 +23,8 @@ public:
};
-int main () {
-#if _LIBCPP_STD_VER > 11
-
+int main ()
+{
static_assert ( !is_transparent<std::less<int>>::value, "" );
static_assert ( !is_transparent<std::less<std::string>>::value, "" );
static_assert ( is_transparent<std::less<void>>::value, "" );
@@ -55,7 +55,5 @@ int main () {
static_assert ( is_transparent<std::greater_equal<void>>::value, "" );
static_assert ( is_transparent<std::greater_equal<>>::value, "" );
-#endif
-
return 0;
- }
+}
diff --git a/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp b/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
index 97b0b4d158a0..d1ae6b7809ce 100644
--- a/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
+++ b/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
@@ -174,6 +174,32 @@ void bullet_one_two_tests() {
}
{
TestClass cl_obj(42);
+ std::reference_wrapper<TestClass> cl(cl_obj);
+ test_b12<int&(NonCopyable&&) &, int&>(cl);
+ test_b12<int const&(NonCopyable&&) const &, int const&>(cl);
+ test_b12<int volatile&(NonCopyable&&) volatile &, int volatile&>(cl);
+ test_b12<int const volatile&(NonCopyable&&) const volatile &, int const volatile&>(cl);
+
+ test_b12<int&(NonCopyable&&) &, int&>(std::move(cl));
+ test_b12<int const&(NonCopyable&&) const &, int const&>(std::move(cl));
+ test_b12<int volatile&(NonCopyable&&) volatile &, int volatile&>(std::move(cl));
+ test_b12<int const volatile&(NonCopyable&&) const volatile &, int const volatile&>(std::move(cl));
+ }
+ {
+ DerivedFromTestClass cl_obj(42);
+ std::reference_wrapper<DerivedFromTestClass> cl(cl_obj);
+ test_b12<int&(NonCopyable&&) &, int&>(cl);
+ test_b12<int const&(NonCopyable&&) const &, int const&>(cl);
+ test_b12<int volatile&(NonCopyable&&) volatile &, int volatile&>(cl);
+ test_b12<int const volatile&(NonCopyable&&) const volatile &, int const volatile&>(cl);
+
+ test_b12<int&(NonCopyable&&) &, int&>(std::move(cl));
+ test_b12<int const&(NonCopyable&&) const &, int const&>(std::move(cl));
+ test_b12<int volatile&(NonCopyable&&) volatile &, int volatile&>(std::move(cl));
+ test_b12<int const volatile&(NonCopyable&&) const volatile &, int const volatile&>(std::move(cl));
+ }
+ {
+ TestClass cl_obj(42);
TestClass *cl = &cl_obj;
test_b12<int&(NonCopyable&&) &, int&>(cl);
test_b12<int const&(NonCopyable&&) const &, int const&>(cl);
@@ -219,6 +245,22 @@ void bullet_three_four_tests() {
}
{
typedef TestClass Fn;
+ Fn cl(42);
+ test_b34<int&>(std::reference_wrapper<Fn>(cl));
+ test_b34<int const&>(std::reference_wrapper<Fn const>(cl));
+ test_b34<int volatile&>(std::reference_wrapper<Fn volatile>(cl));
+ test_b34<int const volatile&>(std::reference_wrapper<Fn const volatile>(cl));
+ }
+ {
+ typedef DerivedFromTestClass Fn;
+ Fn cl(42);
+ test_b34<int&>(std::reference_wrapper<Fn>(cl));
+ test_b34<int const&>(std::reference_wrapper<Fn const>(cl));
+ test_b34<int volatile&>(std::reference_wrapper<Fn volatile>(cl));
+ test_b34<int const volatile&>(std::reference_wrapper<Fn const volatile>(cl));
+ }
+ {
+ typedef TestClass Fn;
Fn cl_obj(42);
Fn* cl = &cl_obj;
test_b34<int&>(cl);
@@ -262,8 +304,46 @@ void bullet_five_tests() {
}
}
+struct CopyThrows {
+ CopyThrows() {}
+ CopyThrows(CopyThrows const&) {}
+ CopyThrows(CopyThrows&&) noexcept {}
+};
+
+struct NoThrowCallable {
+ void operator()() noexcept {}
+ void operator()(CopyThrows) noexcept {}
+};
+
+struct ThrowsCallable {
+ void operator()() {}
+};
+
+struct MemberObj {
+ int x;
+};
+
+void noexcept_test() {
+ {
+ NoThrowCallable obj; ((void)obj); // suppress unused warning
+ CopyThrows arg; ((void)arg); // suppress unused warning
+ static_assert(noexcept(std::invoke(obj)), "");
+ static_assert(!noexcept(std::invoke(obj, arg)), "");
+ static_assert(noexcept(std::invoke(obj, std::move(arg))), "");
+ }
+ {
+ ThrowsCallable obj; ((void)obj); // suppress unused warning
+ static_assert(!noexcept(std::invoke(obj)), "");
+ }
+ {
+ MemberObj obj{42}; ((void)obj); // suppress unused warning.
+ static_assert(noexcept(std::invoke(&MemberObj::x, obj)), "");
+ }
+}
+
int main() {
bullet_one_two_tests();
bullet_three_four_tests();
bullet_five_tests();
+ noexcept_test();
}
diff --git a/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp b/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp
index f371223ee84c..465e001c3deb 100644
--- a/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp
+++ b/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp
@@ -15,6 +15,8 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
struct A
{
char test0() {return 'a';}
@@ -69,7 +71,7 @@ int main()
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
-#if __has_feature(cxx_noexcept)
+#if TEST_STD_VER >= 11
static_assert((noexcept(std::mem_fn(&A::test0))), ""); // LWG#2489
#endif
}
diff --git a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
new file mode 100644
index 000000000000..c12fa7920974
--- /dev/null
+++ b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
@@ -0,0 +1,589 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template <class F> unspecified not_fn(F&& f);
+
+#include <functional>
+#include <type_traits>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "type_id.h"
+
+
+///////////////////////////////////////////////////////////////////////////////
+// CALLABLE TEST TYPES
+///////////////////////////////////////////////////////////////////////////////
+
+bool returns_true() { return true; }
+
+template <class Ret = bool>
+struct MoveOnlyCallable {
+ MoveOnlyCallable(MoveOnlyCallable const&) = delete;
+ MoveOnlyCallable(MoveOnlyCallable&& other)
+ : value(other.value)
+ { other.value = !other.value; }
+
+ template <class ...Args>
+ Ret operator()(Args&&...) { return Ret{value}; }
+
+ explicit MoveOnlyCallable(bool x) : value(x) {}
+ Ret value;
+};
+
+template <class Ret = bool>
+struct CopyCallable {
+ CopyCallable(CopyCallable const& other)
+ : value(other.value) {}
+
+ CopyCallable(CopyCallable&& other)
+ : value(other.value) { other.value = !other.value; }
+
+ template <class ...Args>
+ Ret operator()(Args&&...) { return Ret{value}; }
+
+ explicit CopyCallable(bool x) : value(x) {}
+ Ret value;
+};
+
+
+template <class Ret = bool>
+struct ConstCallable {
+ ConstCallable(ConstCallable const& other)
+ : value(other.value) {}
+
+ ConstCallable(ConstCallable&& other)
+ : value(other.value) { other.value = !other.value; }
+
+ template <class ...Args>
+ Ret operator()(Args&&...) const { return Ret{value}; }
+
+ explicit ConstCallable(bool x) : value(x) {}
+ Ret value;
+};
+
+
+
+template <class Ret = bool>
+struct NoExceptCallable {
+ NoExceptCallable(NoExceptCallable const& other)
+ : value(other.value) {}
+
+ template <class ...Args>
+ Ret operator()(Args&&...) noexcept { return Ret{value}; }
+
+ template <class ...Args>
+ Ret operator()(Args&&...) const noexcept { return Ret{value}; }
+
+ explicit NoExceptCallable(bool x) : value(x) {}
+ Ret value;
+};
+
+struct CopyAssignableWrapper {
+ CopyAssignableWrapper(CopyAssignableWrapper const&) = default;
+ CopyAssignableWrapper(CopyAssignableWrapper&&) = default;
+ CopyAssignableWrapper& operator=(CopyAssignableWrapper const&) = default;
+ CopyAssignableWrapper& operator=(CopyAssignableWrapper &&) = default;
+
+ template <class ...Args>
+ bool operator()(Args&&...) { return value; }
+
+ explicit CopyAssignableWrapper(bool x) : value(x) {}
+ bool value;
+};
+
+
+struct MoveAssignableWrapper {
+ MoveAssignableWrapper(MoveAssignableWrapper const&) = delete;
+ MoveAssignableWrapper(MoveAssignableWrapper&&) = default;
+ MoveAssignableWrapper& operator=(MoveAssignableWrapper const&) = delete;
+ MoveAssignableWrapper& operator=(MoveAssignableWrapper &&) = default;
+
+ template <class ...Args>
+ bool operator()(Args&&...) { return value; }
+
+ explicit MoveAssignableWrapper(bool x) : value(x) {}
+ bool value;
+};
+
+struct MemFunCallable {
+ explicit MemFunCallable(bool x) : value(x) {}
+
+ bool return_value() const { return value; }
+ bool return_value_nc() { return value; }
+ bool value;
+};
+
+enum CallType : unsigned {
+ CT_None,
+ CT_NonConst = 1,
+ CT_Const = 2,
+ CT_LValue = 4,
+ CT_RValue = 8
+};
+
+inline constexpr CallType operator|(CallType LHS, CallType RHS) {
+ return static_cast<CallType>(static_cast<unsigned>(LHS) | static_cast<unsigned>(RHS));
+}
+
+struct ForwardingCallObject {
+
+ template <class ...Args>
+ bool operator()(Args&&... args) & {
+ set_call<Args&&...>(CT_NonConst | CT_LValue);
+ return true;
+ }
+
+ template <class ...Args>
+ bool operator()(Args&&... args) const & {
+ set_call<Args&&...>(CT_Const | CT_LValue);
+ return true;
+ }
+
+ // Don't allow the call operator to be invoked as an rvalue.
+ template <class ...Args>
+ bool operator()(Args&&... args) && {
+ set_call<Args&&...>(CT_NonConst | CT_RValue);
+ return true;
+ }
+
+ template <class ...Args>
+ bool operator()(Args&&... args) const && {
+ set_call<Args&&...>(CT_Const | CT_RValue);
+ return true;
+ }
+
+ template <class ...Args>
+ static void set_call(CallType type) {
+ assert(last_call_type == CT_None);
+ assert(last_call_args == nullptr);
+ last_call_type = type;
+ last_call_args = &makeArgumentID<Args...>();
+ }
+
+ template <class ...Args>
+ static bool check_call(CallType type) {
+ bool result =
+ last_call_type == type
+ && last_call_args
+ && *last_call_args == makeArgumentID<Args...>();
+ last_call_type = CT_None;
+ last_call_args = nullptr;
+ return result;
+ }
+
+ static CallType last_call_type;
+ static TypeID const* last_call_args;
+};
+
+CallType ForwardingCallObject::last_call_type = CT_None;
+TypeID const* ForwardingCallObject::last_call_args = nullptr;
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// BOOL TEST TYPES
+///////////////////////////////////////////////////////////////////////////////
+
+struct EvilBool {
+ static int bang_called;
+
+ EvilBool(EvilBool const&) = default;
+ EvilBool(EvilBool&&) = default;
+
+ friend EvilBool operator!(EvilBool const& other) {
+ ++bang_called;
+ return EvilBool{!other.value};
+ }
+
+private:
+ friend struct MoveOnlyCallable<EvilBool>;
+ friend struct CopyCallable<EvilBool>;
+ friend struct NoExceptCallable<EvilBool>;
+
+ explicit EvilBool(bool x) : value(x) {}
+ EvilBool& operator=(EvilBool const& other) = default;
+
+public:
+ bool value;
+};
+
+int EvilBool::bang_called = 0;
+
+struct ExplicitBool {
+ ExplicitBool(ExplicitBool const&) = default;
+ ExplicitBool(ExplicitBool&&) = default;
+
+ explicit operator bool() const { return value; }
+
+private:
+ friend struct MoveOnlyCallable<ExplicitBool>;
+ friend struct CopyCallable<ExplicitBool>;
+
+ explicit ExplicitBool(bool x) : value(x) {}
+ ExplicitBool& operator=(bool x) {
+ value = x;
+ return *this;
+ }
+
+ bool value;
+};
+
+
+struct NoExceptEvilBool {
+ NoExceptEvilBool(NoExceptEvilBool const&) = default;
+ NoExceptEvilBool(NoExceptEvilBool&&) = default;
+ NoExceptEvilBool& operator=(NoExceptEvilBool const& other) = default;
+
+ explicit NoExceptEvilBool(bool x) : value(x) {}
+
+ friend NoExceptEvilBool operator!(NoExceptEvilBool const& other) noexcept {
+ return NoExceptEvilBool{!other.value};
+ }
+
+ bool value;
+};
+
+
+
+void constructor_tests()
+{
+ {
+ using T = MoveOnlyCallable<bool>;
+ T value(true);
+ using RetT = decltype(std::not_fn(std::move(value)));
+ static_assert(std::is_move_constructible<RetT>::value, "");
+ static_assert(!std::is_copy_constructible<RetT>::value, "");
+ static_assert(!std::is_move_assignable<RetT>::value, "");
+ static_assert(!std::is_copy_assignable<RetT>::value, "");
+ auto ret = std::not_fn(std::move(value));
+ // test it was moved from
+ assert(value.value == false);
+ // test that ret() negates the original value 'true'
+ assert(ret() == false);
+ assert(ret(0, 0.0, "blah") == false);
+ // Move ret and test that it was moved from and that ret2 got the
+ // original value.
+ auto ret2 = std::move(ret);
+ assert(ret() == true);
+ assert(ret2() == false);
+ assert(ret2(42) == false);
+ }
+ {
+ using T = CopyCallable<bool>;
+ T value(false);
+ using RetT = decltype(std::not_fn(value));
+ static_assert(std::is_move_constructible<RetT>::value, "");
+ static_assert(std::is_copy_constructible<RetT>::value, "");
+ static_assert(!std::is_move_assignable<RetT>::value, "");
+ static_assert(!std::is_copy_assignable<RetT>::value, "");
+ auto ret = std::not_fn(value);
+ // test that value is unchanged (copied not moved)
+ assert(value.value == false);
+ // test 'ret' has the original value
+ assert(ret() == true);
+ assert(ret(42, 100) == true);
+ // move from 'ret' and check that 'ret2' has the original value.
+ auto ret2 = std::move(ret);
+ assert(ret() == false);
+ assert(ret2() == true);
+ assert(ret2("abc") == true);
+ }
+ {
+ using T = CopyAssignableWrapper;
+ T value(true);
+ T value2(false);
+ using RetT = decltype(std::not_fn(value));
+ static_assert(std::is_move_constructible<RetT>::value, "");
+ static_assert(std::is_copy_constructible<RetT>::value, "");
+ static_assert(std::is_move_assignable<RetT>::value, "");
+ static_assert(std::is_copy_assignable<RetT>::value, "");
+ auto ret = std::not_fn(value);
+ assert(ret() == false);
+ auto ret2 = std::not_fn(value2);
+ assert(ret2() == true);
+ ret = ret2;
+ assert(ret() == true);
+ assert(ret2() == true);
+ }
+ {
+ using T = MoveAssignableWrapper;
+ T value(true);
+ T value2(false);
+ using RetT = decltype(std::not_fn(std::move(value)));
+ static_assert(std::is_move_constructible<RetT>::value, "");
+ static_assert(!std::is_copy_constructible<RetT>::value, "");
+ static_assert(std::is_move_assignable<RetT>::value, "");
+ static_assert(!std::is_copy_assignable<RetT>::value, "");
+ auto ret = std::not_fn(std::move(value));
+ assert(ret() == false);
+ auto ret2 = std::not_fn(std::move(value2));
+ assert(ret2() == true);
+ ret = std::move(ret2);
+ assert(ret() == true);
+ }
+}
+
+void return_type_tests()
+{
+ using std::is_same;
+ {
+ using T = CopyCallable<bool>;
+ auto ret = std::not_fn(T{false});
+ static_assert(is_same<decltype(ret()), bool>::value, "");
+ static_assert(is_same<decltype(ret("abc")), bool>::value, "");
+ assert(ret() == true);
+ }
+ {
+ using T = CopyCallable<ExplicitBool>;
+ auto ret = std::not_fn(T{true});
+ static_assert(is_same<decltype(ret()), bool>::value, "");
+ static_assert(is_same<decltype(ret(std::string("abc"))), bool>::value, "");
+ assert(ret() == false);
+ }
+ {
+ using T = CopyCallable<EvilBool>;
+ auto ret = std::not_fn(T{false});
+ static_assert(is_same<decltype(ret()), EvilBool>::value, "");
+ EvilBool::bang_called = 0;
+ auto value_ret = ret();
+ assert(EvilBool::bang_called == 1);
+ assert(value_ret.value == true);
+ ret();
+ assert(EvilBool::bang_called == 2);
+ }
+}
+
+// Other tests only test using objects with call operators. Test various
+// other callable types here.
+void other_callable_types_test()
+{
+ { // test with function pointer
+ auto ret = std::not_fn(returns_true);
+ assert(ret() == false);
+ }
+ { // test with lambda
+ auto returns_value = [](bool value) { return value; };
+ auto ret = std::not_fn(returns_value);
+ assert(ret(true) == false);
+ assert(ret(false) == true);
+ }
+ { // test with pointer to member function
+ MemFunCallable mt(true);
+ const MemFunCallable mf(false);
+ auto ret = std::not_fn(&MemFunCallable::return_value);
+ assert(ret(mt) == false);
+ assert(ret(mf) == true);
+ assert(ret(&mt) == false);
+ assert(ret(&mf) == true);
+ }
+ { // test with pointer to member function
+ MemFunCallable mt(true);
+ MemFunCallable mf(false);
+ auto ret = std::not_fn(&MemFunCallable::return_value_nc);
+ assert(ret(mt) == false);
+ assert(ret(mf) == true);
+ assert(ret(&mt) == false);
+ assert(ret(&mf) == true);
+ }
+ { // test with pointer to member data
+ MemFunCallable mt(true);
+ const MemFunCallable mf(false);
+ auto ret = std::not_fn(&MemFunCallable::value);
+ assert(ret(mt) == false);
+ assert(ret(mf) == true);
+ assert(ret(&mt) == false);
+ assert(ret(&mf) == true);
+ }
+}
+
+void throws_in_constructor_test()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ struct ThrowsOnCopy {
+ ThrowsOnCopy(ThrowsOnCopy const&) {
+ throw 42;
+ }
+ ThrowsOnCopy() = default;
+ bool operator()() const { assert(false); }
+ };
+ {
+ ThrowsOnCopy cp;
+ try {
+ std::not_fn(cp);
+ assert(false);
+ } catch (int const& value) {
+ assert(value == 42);
+ }
+ }
+#endif
+}
+
+void call_operator_sfinae_test() {
+ { // wrong number of arguments
+ using T = decltype(std::not_fn(returns_true));
+ static_assert(std::is_callable<T()>::value, ""); // callable only with no args
+ static_assert(!std::is_callable<T(bool)>::value, "");
+ }
+ { // violates const correctness (member function pointer)
+ using T = decltype(std::not_fn(&MemFunCallable::return_value_nc));
+ static_assert(std::is_callable<T(MemFunCallable&)>::value, "");
+ static_assert(!std::is_callable<T(const MemFunCallable&)>::value, "");
+ }
+ { // violates const correctness (call object)
+ using Obj = CopyCallable<bool>;
+ using NCT = decltype(std::not_fn(Obj{true}));
+ using CT = const NCT;
+ static_assert(std::is_callable<NCT()>::value, "");
+ static_assert(!std::is_callable<CT()>::value, "");
+ }
+ { // returns bad type with no operator!
+ auto fn = [](auto x) { return x; };
+ using T = decltype(std::not_fn(fn));
+ static_assert(std::is_callable<T(bool)>::value, "");
+ static_assert(!std::is_callable<T(std::string)>::value, "");
+ }
+}
+
+void call_operator_forwarding_test()
+{
+ using Fn = ForwardingCallObject;
+ auto obj = std::not_fn(Fn{});
+ const auto& c_obj = obj;
+ { // test zero args
+ obj();
+ assert(Fn::check_call<>(CT_NonConst | CT_LValue));
+ std::move(obj)();
+ assert(Fn::check_call<>(CT_NonConst | CT_RValue));
+ c_obj();
+ assert(Fn::check_call<>(CT_Const | CT_LValue));
+ std::move(c_obj)();
+ assert(Fn::check_call<>(CT_Const | CT_RValue));
+ }
+ { // test value categories
+ int x = 42;
+ const int cx = 42;
+ obj(x);
+ assert(Fn::check_call<int&>(CT_NonConst | CT_LValue));
+ obj(cx);
+ assert(Fn::check_call<const int&>(CT_NonConst | CT_LValue));
+ obj(std::move(x));
+ assert(Fn::check_call<int&&>(CT_NonConst | CT_LValue));
+ obj(std::move(cx));
+ assert(Fn::check_call<const int&&>(CT_NonConst | CT_LValue));
+ obj(42);
+ assert(Fn::check_call<int&&>(CT_NonConst | CT_LValue));
+ }
+ { // test value categories - rvalue
+ int x = 42;
+ const int cx = 42;
+ std::move(obj)(x);
+ assert(Fn::check_call<int&>(CT_NonConst | CT_RValue));
+ std::move(obj)(cx);
+ assert(Fn::check_call<const int&>(CT_NonConst | CT_RValue));
+ std::move(obj)(std::move(x));
+ assert(Fn::check_call<int&&>(CT_NonConst | CT_RValue));
+ std::move(obj)(std::move(cx));
+ assert(Fn::check_call<const int&&>(CT_NonConst | CT_RValue));
+ std::move(obj)(42);
+ assert(Fn::check_call<int&&>(CT_NonConst | CT_RValue));
+ }
+ { // test value categories - const call
+ int x = 42;
+ const int cx = 42;
+ c_obj(x);
+ assert(Fn::check_call<int&>(CT_Const | CT_LValue));
+ c_obj(cx);
+ assert(Fn::check_call<const int&>(CT_Const | CT_LValue));
+ c_obj(std::move(x));
+ assert(Fn::check_call<int&&>(CT_Const | CT_LValue));
+ c_obj(std::move(cx));
+ assert(Fn::check_call<const int&&>(CT_Const | CT_LValue));
+ c_obj(42);
+ assert(Fn::check_call<int&&>(CT_Const | CT_LValue));
+ }
+ { // test value categories - const call rvalue
+ int x = 42;
+ const int cx = 42;
+ std::move(c_obj)(x);
+ assert(Fn::check_call<int&>(CT_Const | CT_RValue));
+ std::move(c_obj)(cx);
+ assert(Fn::check_call<const int&>(CT_Const | CT_RValue));
+ std::move(c_obj)(std::move(x));
+ assert(Fn::check_call<int&&>(CT_Const | CT_RValue));
+ std::move(c_obj)(std::move(cx));
+ assert(Fn::check_call<const int&&>(CT_Const | CT_RValue));
+ std::move(c_obj)(42);
+ assert(Fn::check_call<int&&>(CT_Const | CT_RValue));
+ }
+ { // test multi arg
+ int x = 42;
+ const double y = 3.14;
+ std::string s = "abc";
+ obj(42, std::move(y), s, std::string{"foo"});
+ Fn::check_call<int&&, const double&&, std::string&, std::string&&>(CT_NonConst | CT_LValue);
+ std::move(obj)(42, std::move(y), s, std::string{"foo"});
+ Fn::check_call<int&&, const double&&, std::string&, std::string&&>(CT_NonConst | CT_RValue);
+ c_obj(42, std::move(y), s, std::string{"foo"});
+ Fn::check_call<int&&, const double&&, std::string&, std::string&&>(CT_Const | CT_LValue);
+ std::move(c_obj)(42, std::move(y), s, std::string{"foo"});
+ Fn::check_call<int&&, const double&&, std::string&, std::string&&>(CT_Const | CT_RValue);
+ }
+}
+
+void call_operator_noexcept_test()
+{
+ {
+ using T = ConstCallable<bool>;
+ T value(true);
+ auto ret = std::not_fn(value);
+ static_assert(!noexcept(ret()), "call should not be noexcept");
+ auto const& cret = ret;
+ static_assert(!noexcept(cret()), "call should not be noexcept");
+ }
+ {
+ using T = NoExceptCallable<bool>;
+ T value(true);
+ auto ret = std::not_fn(value);
+ static_assert(noexcept(!_VSTD::__invoke(value)), "");
+ static_assert(noexcept(ret()), "call should be noexcept");
+ auto const& cret = ret;
+ static_assert(noexcept(cret()), "call should be noexcept");
+ }
+ {
+ using T = NoExceptCallable<NoExceptEvilBool>;
+ T value(true);
+ auto ret = std::not_fn(value);
+ static_assert(noexcept(ret()), "call should not be noexcept");
+ auto const& cret = ret;
+ static_assert(noexcept(cret()), "call should not be noexcept");
+ }
+ {
+ using T = NoExceptCallable<EvilBool>;
+ T value(true);
+ auto ret = std::not_fn(value);
+ static_assert(!noexcept(ret()), "call should not be noexcept");
+ auto const& cret = ret;
+ static_assert(!noexcept(cret()), "call should not be noexcept");
+ }
+}
+
+int main()
+{
+ constructor_tests();
+ return_type_tests();
+ other_callable_types_test();
+ throws_in_constructor_test();
+ call_operator_sfinae_test(); // somewhat of an extension
+ call_operator_forwarding_test();
+ call_operator_noexcept_test();
+}
diff --git a/test/std/utilities/function.objects/func.require/INVOKE_tested_elsewhere.pass.cpp b/test/std/utilities/function.objects/func.require/INVOKE_tested_elsewhere.pass.cpp
new file mode 100644
index 000000000000..d61c3773e539
--- /dev/null
+++ b/test/std/utilities/function.objects/func.require/INVOKE_tested_elsewhere.pass.cpp
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// INVOKE (f, t1, t2, ..., tN)
+
+// The tests for INVOKE (f, t1, t2, ..., tN) live in the "test/libcxx" tree
+// since they require calling the implementation specific "__invoke" and
+// "__invoke_constexpr" functions.
+
+int main() {}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
index aa6b743b5236..403d646f4216 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <functional>
// class function<R(ArgTypes...)>
@@ -14,8 +16,10 @@
// template<class A> function(allocator_arg_t, const A&, function&&);
#include <functional>
+#include <memory>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "count_new.hpp"
@@ -46,23 +50,57 @@ public:
int A::count = 0;
+int g(int) { return 0; }
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(globalMemCounter.checkOutstandingNewEq(0));
{
- std::function<int(int)> f = A();
- assert(A::count == 1);
- assert(globalMemCounter.checkOutstandingNewEq(1));
- assert(f.target<A>());
- assert(f.target<int(*)(int)>() == 0);
- std::function<int(int)> f2(std::allocator_arg, bare_allocator<A>(), std::move(f));
- assert(A::count == 1);
- assert(globalMemCounter.checkOutstandingNewEq(1));
- assert(f2.target<A>());
- assert(f2.target<int(*)(int)>() == 0);
- assert(f.target<A>() == 0);
- assert(f.target<int(*)(int)>() == 0);
+ std::function<int(int)> f = A();
+ assert(A::count == 1);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(f.target<A>());
+ assert(f.target<int(*)(int)>() == 0);
+ std::function<int(int)> f2(std::allocator_arg, bare_allocator<A>(), std::move(f));
+ assert(A::count == 1);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(f2.target<A>());
+ assert(f2.target<int(*)(int)>() == 0);
+ assert(f.target<A>() == 0);
+ assert(f.target<int(*)(int)>() == 0);
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
+ // Test that moving a function constructed from a reference wrapper
+ // is done without allocating.
+ DisableAllocationGuard g;
+ using Ref = std::reference_wrapper<A>;
+ A a;
+ Ref aref(a);
+ std::function<int(int)> f(aref);
+ assert(A::count == 1);
+ assert(f.target<A>() == nullptr);
+ assert(f.target<Ref>());
+ std::function<int(int)> f2(std::allocator_arg, std::allocator<void>{},
+ std::move(f));
+ assert(A::count == 1);
+ assert(f2.target<A>() == nullptr);
+ assert(f2.target<Ref>());
+ assert(f.target<Ref>()); // f is unchanged because the target is small
+ }
+ {
+ // Test that moving a function constructed from a function pointer
+ // is done without allocating
+ DisableAllocationGuard guard;
+ using Ptr = int(*)(int);
+ Ptr p = g;
+ std::function<int(int)> f(p);
+ assert(f.target<A>() == nullptr);
+ assert(f.target<Ptr>());
+ std::function<int(int)> f2(std::allocator_arg, std::allocator<void>(),
+ std::move(f));
+ assert(f2.target<A>() == nullptr);
+ assert(f2.target<Ptr>());
+ assert(f.target<Ptr>()); // f is unchanged because the target is small
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
index f603da9dd131..387b371a9331 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
@@ -14,9 +14,11 @@
// function(const function& f);
#include <functional>
+#include <memory>
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
#include "count_new.hpp"
class A
@@ -98,21 +100,53 @@ int main()
assert(g.target<A>() == 0);
assert(!g);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ { // Test rvalue references
+ std::function<int(int)> f = A();
+ assert(A::count == 1);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(f.target<A>());
+ assert(f.target<int(*)(int)>() == 0);
+ std::function<int(int)> f2 = std::move(f);
+ assert(A::count == 1);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(f2.target<A>());
+ assert(f2.target<int(*)(int)>() == 0);
+ assert(f.target<A>() == 0);
+ assert(f.target<int(*)(int)>() == 0);
+ }
assert(globalMemCounter.checkOutstandingNewEq(0));
{
- std::function<int(int)> f = A();
- assert(A::count == 1);
- assert(globalMemCounter.checkOutstandingNewEq(1));
- assert(f.target<A>());
- assert(f.target<int(*)(int)>() == 0);
- std::function<int(int)> f2 = std::move(f);
- assert(A::count == 1);
- assert(globalMemCounter.checkOutstandingNewEq(1));
- assert(f2.target<A>());
- assert(f2.target<int(*)(int)>() == 0);
- assert(f.target<A>() == 0);
- assert(f.target<int(*)(int)>() == 0);
+ // Test that moving a function constructed from a reference wrapper
+ // is done without allocating.
+ DisableAllocationGuard g;
+ using Ref = std::reference_wrapper<A>;
+ A a;
+ Ref aref(a);
+ std::function<int(int)> f(aref);
+ assert(A::count == 1);
+ assert(f.target<A>() == nullptr);
+ assert(f.target<Ref>());
+ std::function<int(int)> f2(std::move(f));
+ assert(A::count == 1);
+ assert(f2.target<A>() == nullptr);
+ assert(f2.target<Ref>());
+ assert(f.target<Ref>()); // f is unchanged because the target is small
+ }
+ {
+ // Test that moving a function constructed from a function pointer
+ // is done without allocating
+ DisableAllocationGuard guard;
+ using Ptr = int(*)(int);
+ Ptr p = g;
+ std::function<int(int)> f(p);
+ assert(f.target<A>() == nullptr);
+ assert(f.target<Ptr>());
+ std::function<int(int)> f2(std::move(f));
+ assert(f2.target<A>() == nullptr);
+ assert(f2.target<Ptr>());
+ assert(f.target<Ptr>()); // f is unchanged because the target is small
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // TEST_STD_VER >= 11
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp
index e9ecfa5539ce..cb45b30a9fd4 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp
@@ -12,10 +12,12 @@
// class function<R(ArgTypes...)>
// template<class F, class A> void assign(F&&, const A&);
+// This call was removed post-C++14
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
class A
@@ -49,6 +51,7 @@ int A::count = 0;
int main()
{
+#if TEST_STD_VER <= 14
{
std::function<int(int)> f;
f.assign(A(), test_allocator<A>());
@@ -57,4 +60,5 @@ int main()
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
+#endif
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
index eb4eac65cd2c..e48b8f986916 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
@@ -14,7 +14,7 @@
// public:
// typedef R result_type;
// typedef T1 argument_type; // iff sizeof...(ArgTypes) == 1 and
-// // the type in ArgTypes is T1
+// // the type in ArgTypes is T1
// typedef T1 first_argument_type; // iff sizeof...(ArgTypes) == 2 and
// // ArgTypes contains T1 and T2
// typedef T2 second_argument_type; // iff sizeof...(ArgTypes) == 2 and
diff --git a/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp b/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp
index 6e3b7a2eee24..00e513ec546f 100644
--- a/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
#include <functional>
#include <string>
@@ -22,9 +23,8 @@ public:
};
-int main () {
-#if _LIBCPP_STD_VER > 11
-
+int main ()
+{
static_assert ( !is_transparent<std::logical_and<int>>::value, "" );
static_assert ( !is_transparent<std::logical_and<std::string>>::value, "" );
static_assert ( is_transparent<std::logical_and<void>>::value, "" );
@@ -39,8 +39,6 @@ int main () {
static_assert ( !is_transparent<std::logical_not<std::string>>::value, "" );
static_assert ( is_transparent<std::logical_not<void>>::value, "" );
static_assert ( is_transparent<std::logical_not<>>::value, "" );
-
-#endif
return 0;
- }
+}
diff --git a/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp b/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp
index 61e0bfa162d8..3c00bd20ac64 100644
--- a/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp
@@ -14,6 +14,9 @@
// Test that reference wrapper meets the requirements of TriviallyCopyable,
// CopyConstructible and CopyAssignable.
+// Test fails due to use of is_trivially_* trait.
+// XFAIL: gcc-4.9
+
#include <functional>
#include <type_traits>
#include <string>
@@ -51,8 +54,8 @@ int main()
{
test<int>();
test<double>();
- test<std::string>();
+ test<std::string>();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- test<MoveOnly>();
+ test<MoveOnly>();
#endif
}
diff --git a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
index bd92a4ac4d2e..8aa2c1df8935 100644
--- a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
@@ -12,7 +12,9 @@
// make sure that we can hash enumeration values
// Not very portable
-#if __cplusplus >= 201402L
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 14
#include <functional>
#include <cassert>
@@ -35,7 +37,7 @@ test()
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
typedef typename std::underlying_type<T>::type under_type;
-
+
H h1;
std::hash<under_type> h2;
for (int i = 0; i <= 5; ++i)
diff --git a/test/std/utilities/function.objects/unord.hash/floating.pass.cpp b/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
index f1f198f23599..643e2d8c5d86 100644
--- a/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
@@ -35,7 +35,7 @@ test()
std::size_t t0 = h(0.);
std::size_t tn0 = h(-0.);
- std::size_t tp1 = h(0.1);
+ std::size_t tp1 = h(static_cast<T>(0.1));
std::size_t t1 = h(1);
std::size_t tn1 = h(-1);
std::size_t pinf = h(INFINITY);
diff --git a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
index c20f31ff2c99..8954f4f3664b 100644
--- a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
@@ -16,14 +16,14 @@
// size_t operator()(T val) const;
// };
-// Not very portable
-
#include <functional>
#include <cassert>
#include <type_traits>
#include <cstddef>
#include <limits>
+#include "test_macros.h"
+
template <class T>
void
test()
@@ -37,7 +37,11 @@ test()
{
T t(i);
if (sizeof(T) <= sizeof(std::size_t))
- assert(h(t) == t);
+ {
+ const std::size_t result = h(t);
+ LIBCPP_ASSERT(result == t);
+ ((void)result); // Prevent unused warning
+ }
}
}
@@ -67,7 +71,7 @@ int main()
test<int16_t>();
test<int32_t>();
test<int64_t>();
-
+
test<int_fast8_t>();
test<int_fast16_t>();
test<int_fast32_t>();
@@ -80,12 +84,12 @@ int main()
test<intmax_t>();
test<intptr_t>();
-
+
test<uint8_t>();
test<uint16_t>();
test<uint32_t>();
test<uint64_t>();
-
+
test<uint_fast8_t>();
test<uint_fast16_t>();
test<uint_fast32_t>();
@@ -98,4 +102,9 @@ int main()
test<uintmax_t>();
test<uintptr_t>();
+
+#ifndef _LIBCPP_HAS_NO_INT128
+ test<__int128_t>();
+ test<__uint128_t>();
+#endif
}
diff --git a/test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp b/test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp
index 8ca5a96a4fac..653fbc43d301 100644
--- a/test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp
+++ b/test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <utility>
// class make_integer_sequence
@@ -16,19 +17,13 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
template <typename AtContainer, typename T, T... I>
-auto extract ( const AtContainer &t, const std::integer_sequence<T, I...> idx )
+auto extract ( const AtContainer &t, const std::integer_sequence<T, I...> )
-> decltype ( std::make_tuple ( std::get<I>(t)... ))
{ return std::make_tuple ( std::get<I>(t)... ); }
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
-
// Make a couple of sequences
using int3 = std::make_integer_sequence<int, 3>; // generates int: 0,1,2
using size7 = std::make_integer_sequence<size_t, 7>; // generates size_t: 0,1,2,3,4,5,6
@@ -36,20 +31,20 @@ int main()
using size2 = std::index_sequence_for<int, size_t>; // generates size_t: 0,1
using intmix = std::integer_sequence<int, 9, 8, 7, 2>; // generates int: 9,8,7,2
using sizemix = std::index_sequence<1, 1, 2, 3, 5>; // generates size_t: 1,1,2,3,5
-
+
// Make sure they're what we expect
static_assert ( std::is_same<int3::value_type, int>::value, "int3 type wrong" );
static_assert ( int3::size () == 3, "int3 size wrong" );
-
+
static_assert ( std::is_same<size7::value_type, size_t>::value, "size7 type wrong" );
static_assert ( size7::size () == 7, "size7 size wrong" );
-
+
static_assert ( std::is_same<size4::value_type, size_t>::value, "size4 type wrong" );
static_assert ( size4::size () == 4, "size4 size wrong" );
-
+
static_assert ( std::is_same<size2::value_type, size_t>::value, "size2 type wrong" );
static_assert ( size2::size () == 2, "size2 size wrong" );
-
+
static_assert ( std::is_same<intmix::value_type, int>::value, "intmix type wrong" );
static_assert ( intmix::size () == 4, "intmix size wrong" );
@@ -57,7 +52,7 @@ int main()
static_assert ( sizemix::size () == 5, "sizemix size wrong" );
auto tup = std::make_tuple ( 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 );
-
+
// Use them
auto t3 = extract ( tup, int3() );
static_assert ( std::tuple_size<decltype(t3)>::value == int3::size (), "t3 size wrong");
@@ -82,5 +77,4 @@ int main()
auto tsizemix = extract ( tup, sizemix ());
static_assert ( std::tuple_size<decltype(tsizemix)>::value == sizemix::size (), "tsizemix size wrong");
assert ( tsizemix == std::make_tuple ( 11, 11, 12, 13, 15 ));
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp b/test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp
index 4b2d1acb5e6b..b689160babaa 100644
--- a/test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp
+++ b/test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp
@@ -13,7 +13,7 @@
// struct integer_sequence
// {
// typedef T type;
-//
+//
// static constexpr size_t size() noexcept;
// };
diff --git a/test/std/utilities/intseq/intseq.intseq/integer_seq.pass.cpp b/test/std/utilities/intseq/intseq.intseq/integer_seq.pass.cpp
index 5c789f5db274..841a234334b7 100644
--- a/test/std/utilities/intseq/intseq.intseq/integer_seq.pass.cpp
+++ b/test/std/utilities/intseq/intseq.intseq/integer_seq.pass.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <utility>
// template<class T, T... I>
// struct integer_sequence
// {
// typedef T type;
-//
+//
// static constexpr size_t size() noexcept;
// };
@@ -24,26 +25,22 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
-
// Make a few of sequences
using int3 = std::integer_sequence<int, 3, 2, 1>;
using size1 = std::integer_sequence<std::size_t, 7>;
using ushort2 = std::integer_sequence<unsigned short, 4, 6>;
using bool0 = std::integer_sequence<bool>;
-
+
// Make sure they're what we expect
static_assert ( std::is_same<int3::value_type, int>::value, "int3 type wrong" );
static_assert ( int3::size() == 3, "int3 size wrong" );
-
+
static_assert ( std::is_same<size1::value_type, std::size_t>::value, "size1 type wrong" );
static_assert ( size1::size() == 1, "size1 size wrong" );
-
+
static_assert ( std::is_same<ushort2::value_type, unsigned short>::value, "ushort2 type wrong" );
static_assert ( ushort2::size() == 2, "ushort2 size wrong" );
-
+
static_assert ( std::is_same<bool0::value_type, bool>::value, "bool0 type wrong" );
static_assert ( bool0::size() == 0, "bool0 size wrong" );
-
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
index 352c7c8d0caf..bbc6b470174d 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
@@ -21,6 +21,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -61,7 +63,7 @@ int main()
const B<int> b = {};
assert(std::allocator_traits<B<int> >::max_size(b) == 100);
}
-#if __cplusplus >= 201103
+#if TEST_STD_VER >= 11
{
std::allocator<int> a;
static_assert(noexcept(std::allocator_traits<std::allocator<int>>::max_size(a)) == true, "");
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp
index 20348d20c10c..10fbfe141ae5 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct Ptr {};
@@ -47,9 +49,19 @@ struct C
typedef CPtr<const T> const_pointer;
};
+template <class T>
+struct D {
+ typedef T value_type;
+private:
+ typedef void 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), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::const_pointer, const char*>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp
index 4b4045a51bae..8365d22613ee 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp
@@ -21,6 +21,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct Ptr {};
@@ -47,9 +49,21 @@ struct C
typedef CPtr<const void> const_void_pointer;
};
+
+template <class T>
+struct D
+{
+ typedef T value_type;
+private:
+ typedef int 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), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::const_void_pointer, const void*>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp
index 085c911b0703..c728909477b5 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -43,13 +45,24 @@ struct C
struct const_void_pointer {};
};
+
+template <class T>
+struct D
+{
+ typedef T value_type;
+private:
+ typedef void difference_type;
+};
+
namespace std
{
template <>
struct pointer_traits<C<char>::pointer>
{
- typedef signed char difference_type;
+ typedef C<char>::pointer pointer;
+ typedef char element_type;
+ typedef signed char difference_type;
};
}
@@ -59,4 +72,7 @@ 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), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::difference_type, signed char>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::difference_type, std::ptrdiff_t>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp
index 60ba09499342..ff1ae2c051b6 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct Ptr {};
@@ -35,8 +37,18 @@ struct B
typedef T value_type;
};
+template <class T>
+struct C {
+ typedef T value_type;
+private:
+ typedef void pointer;
+};
+
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), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<C<char> >::pointer, char*>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp
index 604e890efaae..0112ab371a83 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -33,8 +35,20 @@ struct B
typedef T value_type;
};
+
+template <class T>
+struct C
+{
+ typedef T value_type;
+private:
+ typedef std::true_type propagate_on_container_copy_assignment;
+};
+
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), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<C<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp
index 1d2b18686d0f..64de15c2cd48 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -33,8 +35,21 @@ struct B
typedef T value_type;
};
+
+template <class T>
+struct C
+{
+ typedef T value_type;
+private:
+ typedef std::true_type propagate_on_container_move_assignment;
+};
+
+
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), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<C<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp
index 6730d1ae261a..a62336fa6cb0 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -33,8 +35,19 @@ struct B
typedef T value_type;
};
+template <class T>
+struct C
+{
+ typedef T value_type;
+private:
+ typedef std::true_type propagate_on_container_swap;
+};
+
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), "");
+ #if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<C<char> >::propagate_on_container_swap, std::false_type>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp
index 50611b99da9a..8097a66fc9d6 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct ReboundA {};
@@ -61,19 +63,39 @@ struct E
template <class U> struct rebind {typedef ReboundA<U> otter;};
};
+template <class T>
+struct F {
+ typedef T value_type;
+private:
+ template <class>
+ struct rebind { typedef void other; };
+};
+
+template <class T>
+struct G {
+ typedef T value_type;
+ template <class>
+ struct rebind {
+ private:
+ typedef void other;
+ };
+};
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
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<F<char> >::rebind_alloc<double>, F<double> >::value), "");
+ static_assert((std::is_same<std::allocator_traits<G<char> >::rebind_alloc<double>, G<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 // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp
index e9c175fe86a5..00ed50727c98 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -42,6 +44,14 @@ struct C
struct const_void_pointer {};
};
+template <class T>
+struct D {
+ typedef T value_type;
+ typedef short difference_type;
+private:
+ typedef void size_type;
+};
+
namespace std
{
@@ -60,4 +70,7 @@ int main()
std::make_unsigned<std::ptrdiff_t>::type>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::size_type,
unsigned char>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::size_type, unsigned short>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp
index 74cd3475f664..2c3623793db6 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp
@@ -20,6 +20,7 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
template <class T>
struct Ptr {};
@@ -47,9 +48,21 @@ struct C
typedef CPtr<void> void_pointer;
};
+
+template <class T>
+struct D
+{
+ typedef T value_type;
+private:
+ typedef 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), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::void_pointer, void*>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp b/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
index 0477d9912e6e..bd32bc34e7a0 100644
--- a/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
+++ b/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
@@ -14,6 +14,8 @@
#include <memory>
#include <vector>
+#include "test_macros.h"
+
struct A
{
};
@@ -23,6 +25,19 @@ struct B
typedef int allocator_type;
};
+struct C {
+ static int allocator_type;
+};
+
+struct D {
+ static int allocator_type() { return 0; }
+};
+
+struct E {
+private:
+ typedef int allocator_type;
+};
+
int main()
{
static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
@@ -30,4 +45,9 @@ int main()
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), "");
+ static_assert((!std::uses_allocator<C, decltype(C::allocator_type)>::value), "");
+ static_assert((!std::uses_allocator<D, decltype(D::allocator_type)>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((!std::uses_allocator<E, int>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
new file mode 100644
index 000000000000..dc0bdd047c61
--- /dev/null
+++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: libcpp-no-exceptions
+// <memory>
+
+// allocator:
+// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
+
+#include <memory>
+#include <cassert>
+
+template <typename T>
+void test_max(size_t count)
+{
+ std::allocator<T> a;
+ try {
+ a.allocate(count);
+ assert(false);
+ } catch (const std::exception &) {
+ }
+}
+
+int main()
+{
+ { // Bug 26812 -- allocating too large
+ typedef double T;
+ std::allocator<T> a;
+ test_max<T> (a.max_size() + 1); // just barely too large
+ test_max<T> (a.max_size() * 2); // significantly too large
+ test_max<T> (((size_t) -1) / sizeof(T) + 1); // multiply will overflow
+ test_max<T> ((size_t) -1); // way too large
+ }
+
+ {
+ typedef const double T;
+ std::allocator<T> a;
+ test_max<T> (a.max_size() + 1); // just barely too large
+ test_max<T> (a.max_size() * 2); // significantly too large
+ test_max<T> (((size_t) -1) / sizeof(T) + 1); // multiply will overflow
+ test_max<T> ((size_t) -1); // way too large
+ }
+}
diff --git a/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp b/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
index 5a8f7a28a042..e1612ae05421 100644
--- a/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
+++ b/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
@@ -10,7 +10,9 @@
#include <memory>
#include <cassert>
-#if __cplusplus >= 201103L
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
// #include <memory>
//
// template <class Alloc>
@@ -19,7 +21,7 @@
// typedef Alloc allocator_type;
// typedef typename allocator_type::value_type
// value_type;
-//
+//
// typedef Alloc::pointer | value_type* pointer;
// typedef Alloc::const_pointer
// | pointer_traits<pointer>::rebind<const value_type>
@@ -36,7 +38,10 @@ void test_pointer()
{
typename std::allocator_traits<Alloc>::pointer vp;
typename std::allocator_traits<Alloc>::const_pointer cvp;
-
+
+ ((void)vp); // Prevent unused warning
+ ((void)cvp); // Prevent unused warning
+
static_assert(std::is_same<bool, decltype( vp == vp)>::value, "");
static_assert(std::is_same<bool, decltype( vp != vp)>::value, "");
static_assert(std::is_same<bool, decltype( vp > vp)>::value, "");
@@ -70,7 +75,10 @@ void test_void_pointer()
{
typename std::allocator_traits<Alloc>::void_pointer vp;
typename std::allocator_traits<Alloc>::const_void_pointer cvp;
-
+
+ ((void)vp); // Prevent unused warning
+ ((void)cvp); // Prevent unused warning
+
static_assert(std::is_same<bool, decltype( vp == vp)>::value, "");
static_assert(std::is_same<bool, decltype( vp != vp)>::value, "");
static_assert(std::is_same<bool, decltype( vp > vp)>::value, "");
@@ -105,11 +113,11 @@ int main()
{
test_pointer<std::allocator<char>> ();
test_pointer<std::allocator<int>> ();
- test_pointer<std::allocator<Foo>> ();
+ test_pointer<std::allocator<Foo>> ();
test_void_pointer<std::allocator<char>> ();
test_void_pointer<std::allocator<int>> ();
- test_void_pointer<std::allocator<Foo>> ();
+ test_void_pointer<std::allocator<Foo>> ();
}
#else
int main() {}
diff --git a/test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp b/test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp
index 4efe61342420..27b2d08b0061 100644
--- a/test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp
+++ b/test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
struct A
{
typedef short element_type;
@@ -39,10 +41,26 @@ struct D
typedef char difference_type;
};
+template <class T>
+struct E
+{
+ static int difference_type;
+};
+
+template <class T>
+struct F {
+private:
+ typedef int 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), "");
+ static_assert((std::is_same<std::pointer_traits<E<int> >::difference_type, std::ptrdiff_t>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::pointer_traits<F<int>>::difference_type, std::ptrdiff_t>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp b/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
index 0ee1e8c93a67..48399d5355d6 100644
--- a/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
+++ b/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
struct A
{
typedef char element_type;
@@ -40,10 +42,27 @@ struct D
{
};
+template <class T, class U>
+struct E
+{
+ static int element_type;
+};
+
+template <class T>
+struct F {
+private:
+ typedef int element_type;
+};
+
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), "");
+ static_assert((std::is_same<std::pointer_traits<E<double, int> >::element_type, double>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::pointer_traits<F<double>>::element_type, double>::value), "");
+#endif
+
}
diff --git a/test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp b/test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp
index 4a1455c53ef6..74c124901211 100644
--- a/test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp
+++ b/test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -29,7 +31,7 @@ template <class T> struct B1 {};
template <class T>
struct B
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
template <class U> using rebind = B1<U>;
#else
template <class U> struct rebind {typedef B1<U> other;};
@@ -46,24 +48,58 @@ template <class T, class U> struct D1 {};
template <class T, class U>
struct D
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
template <class V> using rebind = D1<V, U>;
#else
template <class V> struct rebind {typedef D1<V, U> other;};
#endif
};
+template <class T, class U>
+struct E
+{
+ template <class>
+ void rebind() {}
+};
+
+
+#if TEST_STD_VER >= 11
+template <class T, class U>
+struct F {
+private:
+ template <class>
+ using rebind = void;
+};
+#endif
+
+#if TEST_STD_VER >= 14
+template <class T, class U>
+struct G
+{
+ template <class>
+ static constexpr int rebind = 42;
+};
+#endif
+
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
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<E<char, int> >::rebind<double>, E<double, int> >::value), "");
+ static_assert((std::is_same<std::pointer_traits<F<char, int> >::rebind<double>, F<double, int> >::value), "");
+
+#if TEST_STD_VER >= 14
+ static_assert((std::is_same<std::pointer_traits<G<char, int> >::rebind<double>, G<double, int> >::value), "");
+#endif
+#else // TEST_STD_VER < 11
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
+ static_assert((std::is_same<std::pointer_traits<E<char, int> >::rebind<double>::other, E<double, int> >::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp
new file mode 100644
index 000000000000..a371f8eda1a8
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: gcc
+
+// <memory>
+
+// template <ObjectType T> constexpr T* addressof(T& r);
+
+#include <memory>
+#include <cassert>
+
+struct Pointer {
+ constexpr Pointer(void* v) : value(v) {}
+ void* value;
+};
+
+struct A
+{
+ constexpr A() : n(42) {}
+ void operator&() const { }
+ int n;
+};
+
+constexpr int i = 0;
+constexpr double d = 0.0;
+constexpr A a{};
+
+int main()
+{
+ static_assert(std::addressof(i) == &i, "");
+ static_assert(std::addressof(d) == &d, "");
+ constexpr const A* ap = std::addressof(a);
+ static_assert(&ap->n == &a.n, "");
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
index 8bb818319a37..1debd6d75ff0 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
@@ -36,7 +36,7 @@ struct Nasty
Nasty() : i_ ( counter_++ ) {}
Nasty * operator &() const { return NULL; }
int i_;
- static int counter_;
+ static int counter_;
};
int Nasty::counter_ = 0;
@@ -76,5 +76,5 @@ int main()
assert( p[i].i_ == i);
}
}
-
+
}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
index ae438ef7d561..83aa19471ada 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
@@ -36,7 +36,7 @@ struct Nasty
Nasty() : i_ ( counter_++ ) {}
Nasty * operator &() const { return NULL; }
int i_;
- static int counter_;
+ static int counter_;
};
int Nasty::counter_ = 0;
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
index 22aa8b98b8c9..5f90a3792064 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
@@ -35,7 +35,7 @@ struct Nasty
Nasty() : i_ ( counter_++ ) {}
Nasty * operator &() const { return NULL; }
int i_;
- static int counter_;
+ static int counter_;
};
int Nasty::counter_ = 0;
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
index 95c45dd50541..3816a2528688 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
@@ -36,7 +36,7 @@ struct Nasty
Nasty() : i_ ( counter_++ ) {}
Nasty * operator &() const { return NULL; }
int i_;
- static int counter_;
+ static int counter_;
};
int Nasty::counter_ = 0;
diff --git a/test/std/utilities/memory/storage.iterator/raw_storag_iterator.base.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
index 27b620569b83..62a3be80d8b6 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storag_iterator.base.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
@@ -13,6 +13,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int A_constructed = 0;
struct A
@@ -29,7 +31,7 @@ public:
int main()
{
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
typedef std::aligned_storage<3*sizeof(A), std::alignment_of<A>::value>::type
Storage;
Storage buffer;
diff --git a/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
index 914802423ce7..914802423ce7 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp
index b2fb58f529f3..30b4ecb94e18 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
#include <memory>
#include <string>
#include <cassert>
@@ -23,23 +24,21 @@ private:
int main()
{
-#if _LIBCPP_STD_VER > 11
{
auto p1 = std::make_unique<int[]>(5);
for ( int i = 0; i < 5; ++i )
assert ( p1[i] == 0 );
}
-
+
{
auto p2 = std::make_unique<std::string[]>(5);
for ( int i = 0; i < 5; ++i )
assert ( p2[i].size () == 0 );
}
-
+
{
auto p3 = std::make_unique<foo[]>(7);
for ( int i = 0; i < 7; ++i )
assert ( p3[i].get () == 3 );
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp
index 26eb59bbfd71..07aa659bd9b0 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp
@@ -13,5 +13,5 @@
int main()
{
- auto up4 = std::make_unique<int[5]>(11, 22, 33, 44, 55); // deleted
+ auto up4 = std::make_unique<int[5]>(11, 22, 33, 44, 55); // deleted
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp
index 7326ed226557..ace2e4fc7137 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp
@@ -7,20 +7,20 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
#include <memory>
#include <string>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
{
std::unique_ptr<int> p1 = std::make_unique<int>(1);
assert ( *p1 == 1 );
p1 = std::make_unique<int> ();
assert ( *p1 == 0 );
}
-
+
{
std::unique_ptr<std::string> p2 = std::make_unique<std::string> ( "Meow!" );
assert ( *p2 == "Meow!" );
@@ -29,5 +29,4 @@ int main()
p2 = std::make_unique<std::string> ( 6, 'z' );
assert ( *p2 == "zzzzzz" );
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp
new file mode 100644
index 000000000000..a611b1a12f05
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// default_delete[]
+
+// template <class U>
+// default_delete(const default_delete<U[]>&);
+//
+// This constructor shall not participate in overload resolution unless
+// U(*)[] is convertible to T(*)[].
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ std::default_delete<int[]> d1;
+ std::default_delete<const int[]> d2 = d1;
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
index 2d62bccdce50..2b0b5f0d945d 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
@@ -40,4 +40,10 @@ int main()
assert(s.get_deleter().state() == 0);
}
assert(A::count == 0);
+
+ { // LWG#2520 says that nullptr is a valid input as well as null
+ std::unique_ptr<A[], Deleter<A[]> > s1(NULL, Deleter<A[]>());
+ std::unique_ptr<A[], Deleter<A[]> > s2(nullptr, Deleter<A[]>());
+ }
+ assert(A::count == 0);
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp
index 914076b50f42..a92fdbc1d2c4 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp
@@ -55,4 +55,10 @@ int main()
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
+ {
+ Deleter d;
+ std::unique_ptr<A[], Deleter> s(nullptr, d);
+ assert(s.get() == nullptr);
+ assert(s.get_deleter().state() == 5);
+ }
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp
index a6f535f38f08..dd27401731a6 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp
@@ -57,4 +57,9 @@ int main()
assert(s.get_deleter().state() == 6);
}
assert(A::count == 0);
+ {
+ Deleter d;
+ std::unique_ptr<A[], Deleter&> s(nullptr, d);
+ assert(s.get() == nullptr);
+ }
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp
index a4c917c1af76..02f44d357561 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp
@@ -55,4 +55,9 @@ int main()
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
+ {
+ Deleter d;
+ std::unique_ptr<A[], const Deleter&> s(nullptr, d);
+ assert(s.get() == nullptr);
+ }
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
index 8721062c6d02..380f2e100eb6 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
@@ -16,11 +16,22 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
struct Deleter
{
struct pointer {};
};
+struct D2 {
+private:
+ typedef void pointer;
+};
+
+struct D3 {
+ static long pointer;
+};
+
int main()
{
{
@@ -31,4 +42,14 @@ int main()
typedef std::unique_ptr<int, Deleter> P;
static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
}
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unique_ptr<int, D2> P;
+ static_assert(std::is_same<P::pointer, int*>::value, "");
+ }
+ {
+ typedef std::unique_ptr<int, D3> P;
+ static_assert(std::is_same<P::pointer, int*>::value, "");
+ }
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp
index 44b746fbcfd8..c525137d4841 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp
@@ -16,6 +16,7 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
#include "../deleter.h"
struct A
@@ -34,6 +35,16 @@ struct A
int A::count = 0;
+template <class T>
+struct NonSwappableDeleter {
+ explicit NonSwappableDeleter(int) {}
+ NonSwappableDeleter& operator=(NonSwappableDeleter const&) { return *this; }
+ void operator()(T*) const {}
+private:
+ NonSwappableDeleter(NonSwappableDeleter const&);
+
+};
+
int main()
{
{
@@ -74,4 +85,18 @@ int main()
assert(A::count == 6);
}
assert(A::count == 0);
+#if TEST_STD_VER >= 11
+ {
+ // test that unique_ptr's specialized swap is disabled when the deleter
+ // is non-swappable. Instead we should pick up the generic swap(T, T)
+ // and perform 3 move constructions.
+ typedef NonSwappableDeleter<int> D;
+ D d(42);
+ int x = 42;
+ int y = 43;
+ std::unique_ptr<int, D&> p(&x, d);
+ std::unique_ptr<int, D&> p2(&y, d);
+ std::swap(p, p2);
+ }
+#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
index 77af13fa90d1..b9f8ee0746c3 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
@@ -18,11 +18,16 @@
// public:
// shared_ptr<T> shared_from_this();
// shared_ptr<T const> shared_from_this() const;
+// weak_ptr<T> weak_from_this() noexcept; // C++17
+// weak_ptr<T const> weak_from_this() const noexecpt; // C++17
// };
#include <memory>
#include <cassert>
+#include "test_macros.h"
+#include "count_new.hpp"
+
struct T
: public std::enable_shared_from_this<T>
{
@@ -32,12 +37,31 @@ struct Y : T {};
struct Z : Y {};
+void nullDeleter(void*) {}
+
+struct Foo : virtual public std::enable_shared_from_this<Foo>
+{
+ virtual ~Foo() {}
+};
+
+struct Bar : public Foo {
+ Bar(int) {}
+};
+
+
int main()
{
{ // https://llvm.org/bugs/show_bug.cgi?id=18843
std::shared_ptr<T const> t1(new T);
std::shared_ptr<T const> t2(std::make_shared<T>());
}
+ { // https://llvm.org/bugs/show_bug.cgi?id=27115
+ int x = 42;
+ std::shared_ptr<Bar> t1(new Bar(42));
+ assert(t1->shared_from_this() == t1);
+ std::shared_ptr<Bar> t2(std::make_shared<Bar>(x));
+ assert(t2->shared_from_this() == t2);
+ }
{
std::shared_ptr<Y> p(new Z);
std::shared_ptr<T> q = p->shared_from_this();
@@ -50,4 +74,89 @@ int main()
assert(p == q);
assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share ownership
}
+ // Test LWG issue 2529. Only reset '__weak_ptr_' when it's already expired.
+ // http://cplusplus.github.io/LWG/lwg-active.html#2529.
+ // Test two different ways:
+ // * Using 'weak_from_this().expired()' in C++17.
+ // * Using 'shared_from_this()' in all dialects.
+ {
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ T* ptr = new T;
+ std::shared_ptr<T> s(ptr);
+ {
+ // Don't re-initialize the "enabled_shared_from_this" base
+ // because it already references a non-expired shared_ptr.
+ std::shared_ptr<T> s2(ptr, &nullDeleter);
+ }
+#if TEST_STD_VER > 14
+ // The enabled_shared_from_this base should still be referencing
+ // the original shared_ptr.
+ assert(!ptr->weak_from_this().expired());
+#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ try {
+ std::shared_ptr<T> new_s = ptr->shared_from_this();
+ assert(new_s == s);
+ } catch (std::bad_weak_ptr const&) {
+ assert(false);
+ } catch (...) {
+ assert(false);
+ }
+ }
+#endif
+ s.reset();
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ }
+ // Test LWG issue 2529 again. This time check that an expired pointer
+ // is replaced.
+ {
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ T* ptr = new T;
+ std::weak_ptr<T> weak;
+ {
+ std::shared_ptr<T> s(ptr, &nullDeleter);
+ assert(ptr->shared_from_this() == s);
+ weak = s;
+ assert(!weak.expired());
+ }
+ assert(weak.expired());
+ weak.reset();
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ ptr->shared_from_this();
+ assert(false);
+ } catch (std::bad_weak_ptr const&) {
+ } catch (...) { assert(false); }
+#endif
+ {
+ std::shared_ptr<T> s2(ptr, &nullDeleter);
+ assert(ptr->shared_from_this() == s2);
+ }
+ delete ptr;
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ }
+ // Test weak_from_this_methods
+#if TEST_STD_VER > 14
+ {
+ T* ptr = new T;
+ const T* cptr = ptr;
+
+ static_assert(noexcept(ptr->weak_from_this()), "Operation must be noexcept");
+ static_assert(noexcept(cptr->weak_from_this()), "Operation must be noexcept");
+
+ std::weak_ptr<T> my_weak = ptr->weak_from_this();
+ assert(my_weak.expired());
+
+ std::weak_ptr<T const> my_const_weak = cptr->weak_from_this();
+ assert(my_const_weak.expired());
+
+ // Enable shared_from_this with ptr.
+ std::shared_ptr<T> sptr(ptr);
+ my_weak = ptr->weak_from_this();
+ assert(!my_weak.expired());
+ assert(my_weak.lock().get() == ptr);
+ }
+#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
index 2d586e9c7fdd..3bad537e3431 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
@@ -23,12 +23,15 @@
// atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v,
// shared_ptr<T> w);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> v(new int(3));
@@ -49,5 +52,4 @@ int main()
assert(*v == 4);
assert(*w == 2);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
index 34da04cc1810..5cc1234ad34e 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
@@ -24,12 +24,15 @@
// shared_ptr<T> w, memory_order success,
// memory_order failure);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> v(new int(3));
@@ -54,5 +57,4 @@ int main()
assert(*v == 4);
assert(*w == 2);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
index 50b96e551fd3..a89c0dbd2207 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
@@ -23,12 +23,15 @@
// atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v,
// shared_ptr<T> w);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> v(new int(3));
@@ -49,5 +52,4 @@ int main()
assert(*v == 4);
assert(*w == 2);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
index d304319d251d..821cea6868e4 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
@@ -24,12 +24,15 @@
// shared_ptr<T> w, memory_order success,
// memory_order failure);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> v(new int(3));
@@ -54,5 +57,4 @@ int main()
assert(*v == 4);
assert(*w == 2);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
index 3b44c8ba9b33..66be756d54fd 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
@@ -22,12 +22,15 @@
// shared_ptr<T>
// atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> r(new int(3));
@@ -35,5 +38,4 @@ int main()
assert(*p == 3);
assert(*r == 4);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
index 598a1b8da175..493ba7fcc94d 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
@@ -22,12 +22,15 @@
// shared_ptr<T>
// atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> r(new int(3));
@@ -35,5 +38,4 @@ int main()
assert(*p == 3);
assert(*r == 4);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
index e3ac84a4fa50..f72a0bb24285 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
@@ -17,15 +17,17 @@
// bool
// atomic_is_lock_free(const shared_ptr<T>* p);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
const std::shared_ptr<int> p(new int(3));
assert(std::atomic_is_lock_free(&p) == false);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
index d4a39c878ac7..4820d05420a2 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
@@ -22,16 +22,18 @@
// shared_ptr<T>
// atomic_load(const shared_ptr<T>* p)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(3));
std::shared_ptr<int> q = std::atomic_load(&p);
assert(*q == *p);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
index af11dc8bc2c9..ef8dc822102f 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
@@ -22,16 +22,18 @@
// shared_ptr<T>
// atomic_load_explicit(const shared_ptr<T>* p, memory_order mo)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
const std::shared_ptr<int> p(new int(3));
std::shared_ptr<int> q = std::atomic_load_explicit(&p, std::memory_order_relaxed);
assert(*q == *p);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
index 7a85a9934ef0..a13a7d57ab96 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
@@ -22,17 +22,19 @@
// void
// atomic_store(shared_ptr<T>* p, shared_ptr<T> r)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p;
std::shared_ptr<int> r(new int(3));
std::atomic_store(&p, r);
assert(*p == *r);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
index c81266c55fa4..6dfe3166c8c5 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
@@ -22,17 +22,19 @@
// void
// atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p;
std::shared_ptr<int> r(new int(3));
std::atomic_store_explicit(&p, r, std::memory_order_seq_cst);
assert(*p == *r);
}
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
index 0263061b3a84..bae1e013f571 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
@@ -52,7 +52,7 @@ public:
void set_state(int i) {state_ = i;}
void operator()(T* p) {assert(state_ >= 0); ++dealloc_count; delete p;}
-
+
test_deleter* operator&() const DELETE_FUNCTION;
};
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp
index 8175312334f6..f44c05eb7c86 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp
@@ -13,14 +13,20 @@
// {
// public:
// typedef T element_type;
+// typedef weak_ptr<T> weak_type; // C++17
// ...
// };
#include <memory>
+#include "test_macros.h"
+
struct A; // purposefully incomplete
int main()
{
static_assert((std::is_same<std::shared_ptr<A>::element_type, A>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((std::is_same<std::shared_ptr<A>::weak_type, std::weak_ptr<A>>::value), "");
+#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
index f17485108b92..f8fdb7a09478 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
@@ -7,31 +7,18 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template<class Y> explicit shared_ptr(auto_ptr<Y>&& r);
-// UNSUPPORTED: sanitizer-new-delete
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
-bool throw_next = false;
-
-void* operator new(std::size_t s) throw(std::bad_alloc)
-{
- if (throw_next)
- throw std::bad_alloc();
- return std::malloc(s);
-}
-
-void operator delete(void* p) throw()
-{
- std::free(p);
-}
+#include "test_macros.h"
+#include "count_new.hpp"
struct B
{
@@ -59,47 +46,51 @@ int A::count = 0;
int main()
{
{
- std::auto_ptr<A> ptr(new A);
- A* raw_ptr = ptr.get();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- std::shared_ptr<B> p(std::move(ptr));
-#else
- std::shared_ptr<B> p(ptr);
-#endif
- assert(A::count == 1);
- assert(B::count == 1);
- assert(p.use_count() == 1);
- assert(p.get() == raw_ptr);
- assert(ptr.get() == 0);
- }
- assert(A::count == 0);
- {
- std::auto_ptr<A> ptr(new A);
- A* raw_ptr = ptr.get();
- throw_next = true;
- try
- {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::auto_ptr<A> ptr(new A);
+ A* raw_ptr = ptr.get();
+#if TEST_STD_VER >= 11
std::shared_ptr<B> p(std::move(ptr));
#else
std::shared_ptr<B> p(ptr);
#endif
- assert(false);
- }
- catch (...)
- {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(A::count == 1);
assert(B::count == 1);
- assert(ptr.get() == raw_ptr);
+ assert(p.use_count() == 1);
+ assert(p.get() == raw_ptr);
+ assert(ptr.get() == 0);
+ }
+ assert(A::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT)
+ {
+ std::auto_ptr<A> ptr(new A);
+ A* raw_ptr = ptr.get();
+ globalMemCounter.throw_after = 0;
+ try
+ {
+#if TEST_STD_VER >= 11
+ std::shared_ptr<B> p(std::move(ptr));
#else
- // Without rvalue references, ptr got copied into
- // the shared_ptr destructor and the copy was
- // destroyed during unwinding.
- assert(A::count == 0);
- assert(B::count == 0);
+ std::shared_ptr<B> p(ptr);
#endif
- }
+ assert(false);
+ }
+ catch (...)
+ {
+#if TEST_STD_VER >= 11
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(ptr.get() == raw_ptr);
+ #else
+ // Without rvalue references, ptr got copied into
+ // the shared_ptr destructor and the copy was
+ // destroyed during unwinding.
+ assert(A::count == 0);
+ assert(B::count == 0);
+#endif
+ }
}
assert(A::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+#endif // !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT)
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
index b67f31ee45a8..8a6cd0f352ff 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
@@ -65,7 +65,7 @@ int main()
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
test_deleter<A>::dealloc_count = 0;
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
// Test an allocator that returns class-type pointers
{
std::shared_ptr<A> p(nullptr, test_deleter<A>(1), min_allocator<void>());
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
index 6a79a8ef60db..85fc5e930544 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
@@ -8,18 +8,22 @@
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: sanitizer-new-delete
+
// <memory>
// shared_ptr
// template<class D> shared_ptr(nullptr_t, D d);
-// UNSUPPORTED: sanitizer-new-delete
-
#include <memory>
#include <cassert>
#include <new>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "count_new.hpp"
+
#include "../test_deleter.h"
struct A
@@ -33,23 +37,10 @@ struct A
int A::count = 0;
-bool throw_next = false;
-
-void* operator new(std::size_t s) throw(std::bad_alloc)
-{
- if (throw_next)
- throw std::bad_alloc();
- return std::malloc(s);
-}
-
-void operator delete(void* p) throw()
-{
- std::free(p);
-}
int main()
{
- throw_next = true;
+ globalMemCounter.throw_after = 0;
try
{
std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
index 1a9c09cdb78c..b0facfc1a6eb 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
test_deleter<A>::dealloc_count = 0;
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
// Test an allocator that returns class-type pointers
{
A* ptr = new A;
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
index 982313b07499..70af2964113d 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
@@ -8,18 +8,20 @@
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: sanitizer-new-delete
+
// <memory>
// shared_ptr
// template<class Y, class D> shared_ptr(Y* p, D d);
-// UNSUPPORTED: sanitizer-new-delete
-
#include <memory>
#include <cassert>
#include <new>
#include <cstdlib>
+
+#include "count_new.hpp"
#include "../test_deleter.h"
struct A
@@ -33,24 +35,10 @@ struct A
int A::count = 0;
-bool throw_next = false;
-
-void* operator new(std::size_t s) throw(std::bad_alloc)
-{
- if (throw_next)
- throw std::bad_alloc();
- return std::malloc(s);
-}
-
-void operator delete(void* p) throw()
-{
- std::free(p);
-}
-
int main()
{
A* ptr = new A;
- throw_next = true;
+ globalMemCounter.throw_after = 0;
try
{
std::shared_ptr<A> p(ptr, test_deleter<A>(3));
@@ -62,4 +50,5 @@ int main()
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
}
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
index 2e761d70bba0..2fa975eca833 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
@@ -8,17 +8,20 @@
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: sanitizer-new-delete
+
// <memory>
// template<class Y> explicit shared_ptr(Y* p);
-// UNSUPPORTED: sanitizer-new-delete
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
+#include "count_new.hpp"
+
struct A
{
static int count;
@@ -30,26 +33,12 @@ struct A
int A::count = 0;
-bool throw_next = false;
-
-void* operator new(std::size_t s) throw(std::bad_alloc)
-{
- if (throw_next)
- throw std::bad_alloc();
- return std::malloc(s);
-}
-
-void operator delete(void* p) throw()
-{
- std::free(p);
-}
int main()
{
- {
A* ptr = new A;
- throw_next = true;
assert(A::count == 1);
+ globalMemCounter.throw_after = 0;
try
{
std::shared_ptr<A> p(ptr);
@@ -59,5 +48,5 @@ int main()
{
assert(A::count == 0);
}
- }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
index c62fcd689320..5c424f5c7428 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
@@ -8,30 +8,19 @@
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: sanitizer-new-delete
+
// <memory>
// template <class Y, class D> explicit shared_ptr(unique_ptr<Y, D>&&r);
-// UNSUPPORTED: sanitizer-new-delete
-
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
-bool throw_next = false;
-
-void* operator new(std::size_t s) throw(std::bad_alloc)
-{
- if (throw_next)
- throw std::bad_alloc();
- return std::malloc(s);
-}
-
-void operator delete(void* p) throw()
-{
- std::free(p);
-}
+#include "test_macros.h"
+#include "count_new.hpp"
struct B
{
@@ -65,52 +54,46 @@ void assert_deleter ( T * ) { assert(false); }
int main()
{
{
- std::unique_ptr<A> ptr(new A);
- A* raw_ptr = ptr.get();
- std::shared_ptr<B> p(std::move(ptr));
- assert(A::count == 1);
- assert(B::count == 1);
- assert(p.use_count() == 1);
- assert(p.get() == raw_ptr);
- assert(ptr.get() == 0);
- }
- assert(A::count == 0);
- {
- std::unique_ptr<A> ptr(new A);
- A* raw_ptr = ptr.get();
- throw_next = true;
- try
- {
+ std::unique_ptr<A> ptr(new A);
+ A* raw_ptr = ptr.get();
std::shared_ptr<B> p(std::move(ptr));
- assert(false);
- }
- catch (...)
- {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(A::count == 1);
assert(B::count == 1);
- assert(ptr.get() == raw_ptr);
-#else
- assert(A::count == 0);
- assert(B::count == 0);
+ assert(p.use_count() == 1);
+ assert(p.get() == raw_ptr);
assert(ptr.get() == 0);
-#endif
- }
}
assert(A::count == 0);
-
- // LWG 2399
{
- throw_next = false;
- fn(std::unique_ptr<int>(new int));
+ std::unique_ptr<A> ptr(new A);
+ A* raw_ptr = ptr.get();
+ globalMemCounter.throw_after = 0;
+ try
+ {
+ std::shared_ptr<B> p(std::move(ptr));
+ assert(false);
+ }
+ catch (...)
+ {
+#if TEST_STD_VER >= 11
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(ptr.get() == raw_ptr);
+#else
+ assert(A::count == 0);
+ assert(B::count == 0);
+ assert(ptr.get() == 0);
+#endif
+ }
}
-
-#if __cplusplus >= 201402L
- // LWG 2415
- {
- std::unique_ptr<int, void (*)(int*)> p(nullptr, assert_deleter<int>);
- std::shared_ptr<int> p2(std::move(p)); // should not call deleter when going out of scope
+ assert(A::count == 0);
+ { // LWG 2399
+ fn(std::unique_ptr<int>(new int));
+ }
+#if TEST_STD_VER >= 14
+ { // LWG 2415
+ std::unique_ptr<int, void (*)(int*)> p(nullptr, assert_deleter<int>);
+ std::shared_ptr<int> p2(std::move(p)); // should not call deleter when going out of scope
}
#endif
-
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
index aa77dab51515..3e4a99e981d4 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// shared_ptr
@@ -55,7 +57,6 @@ int main()
}
assert(A::count == 0);
assert(test_allocator<A>::alloc_count == 0);
-#if __cplusplus >= 201103L
{
int i = 67;
char c = 'e';
@@ -74,5 +75,4 @@ int main()
assert(p->get_char() == 'f');
}
assert(A::count == 0);
-#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_no_variadics.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_cxx03.pass.cpp
index 8dcd50e49411..527bbce1473e 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_no_variadics.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_cxx03.pass.cpp
@@ -14,7 +14,7 @@
// template<class T, class A, class... Args>
// shared_ptr<T> allocate_shared(const A& a, Args&&... args);
-#define _LIBCPP_HAS_NO_VARIADICS
+
#include <memory>
#include <new>
#include <cstdlib>
@@ -112,7 +112,7 @@ int main()
assert(test_allocator<Two>::alloc_count == 0);
test<bare_allocator<void> >();
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<min_allocator<void> >();
#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.volatile.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.volatile.pass.cpp
index 1045f9347b38..59cd3d248639 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.volatile.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.volatile.pass.cpp
@@ -34,7 +34,7 @@ void test(const T &t0)
assert(*p0 == t0);
assert(*p1 == t1);
}
-
+
{
volatile T t1 = t0;
std::shared_ptr<volatile T> p0 = std::make_shared<volatile T>(t0);
@@ -50,7 +50,7 @@ void test(const T &t0)
assert(*p0 == t0);
assert(*p1 == t1);
}
-
+
}
int main()
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
index bf1719c66ffa..142eba2d9647 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
@@ -30,7 +30,7 @@
// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
// };
-//
+//
// Added in C++17
// template<> struct owner_less<void>
// {
@@ -42,7 +42,7 @@
// bool operator()(weak_ptr<T> const&, shared_ptr<U> const&) const;
// template<class T, class U>
// bool operator()(weak_ptr<T> const&, weak_ptr<U> const&) const;
-//
+//
// typedef unspecified is_transparent;
// };
@@ -113,7 +113,7 @@ int main()
cmp(wp1, wp1);
}
{
- // test heterogeneous lookups
+ // test heterogeneous lookups
std::set<std::shared_ptr<X>, std::owner_less<>> s;
std::shared_ptr<void> vp;
s.find(vp);
diff --git a/test/std/utilities/meta/meta.hel/bool_constant.pass.cpp b/test/std/utilities/meta/meta.help/bool_constant.pass.cpp
index 71110ea3bfb0..dcacf379b9ae 100644
--- a/test/std/utilities/meta/meta.hel/bool_constant.pass.cpp
+++ b/test/std/utilities/meta/meta.help/bool_constant.pass.cpp
@@ -14,9 +14,11 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __cplusplus > 201402L
+#if TEST_STD_VER > 14
typedef std::bool_constant<true> _t;
static_assert(_t::value, "");
static_assert((std::is_same<_t::value_type, bool>::value), "");
diff --git a/test/std/utilities/meta/meta.hel/integral_constant.pass.cpp b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp
index 335305a28236..335305a28236 100644
--- a/test/std/utilities/meta/meta.hel/integral_constant.pass.cpp
+++ b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp
diff --git a/test/std/utilities/meta/meta.logical/conjunction.pass.cpp b/test/std/utilities/meta/meta.logical/conjunction.pass.cpp
index dce58ec23725..d8dd386e9347 100644
--- a/test/std/utilities/meta/meta.logical/conjunction.pass.cpp
+++ b/test/std/utilities/meta/meta.logical/conjunction.pass.cpp
@@ -11,7 +11,7 @@
// type_traits
// template<class... B> struct conjunction; // C++17
-// template<class... B>
+// template<class... B>
// constexpr bool conjunction_v = conjunction<B...>::value; // C++17
#include <type_traits>
@@ -34,7 +34,7 @@ int main()
static_assert (!std::conjunction<std::true_type, std::false_type>::value, "" );
static_assert (!std::conjunction<std::false_type, std::true_type >::value, "" );
static_assert (!std::conjunction<std::false_type, std::false_type>::value, "" );
-
+
static_assert ( std::conjunction_v<std::true_type, std::true_type >, "" );
static_assert (!std::conjunction_v<std::true_type, std::false_type>, "" );
static_assert (!std::conjunction_v<std::false_type, std::true_type >, "" );
diff --git a/test/std/utilities/meta/meta.logical/disjunction.pass.cpp b/test/std/utilities/meta/meta.logical/disjunction.pass.cpp
index 13cd9341b99f..f5ba178d6483 100644
--- a/test/std/utilities/meta/meta.logical/disjunction.pass.cpp
+++ b/test/std/utilities/meta/meta.logical/disjunction.pass.cpp
@@ -11,7 +11,7 @@
// type_traits
// template<class... B> struct disjunction; // C++17
-// template<class... B>
+// template<class... B>
// constexpr bool disjunction_v = disjunction<B...>::value; // C++17
#include <type_traits>
@@ -34,7 +34,7 @@ int main()
static_assert ( std::disjunction<std::true_type, std::false_type>::value, "" );
static_assert ( std::disjunction<std::false_type, std::true_type >::value, "" );
static_assert (!std::disjunction<std::false_type, std::false_type>::value, "" );
-
+
static_assert ( std::disjunction_v<std::true_type, std::true_type >, "" );
static_assert ( std::disjunction_v<std::true_type, std::false_type>, "" );
static_assert ( std::disjunction_v<std::false_type, std::true_type >, "" );
diff --git a/test/std/utilities/meta/meta.logical/negation.pass.cpp b/test/std/utilities/meta/meta.logical/negation.pass.cpp
index 76ff6c5b24db..7b4eb27a75e1 100644
--- a/test/std/utilities/meta/meta.logical/negation.pass.cpp
+++ b/test/std/utilities/meta/meta.logical/negation.pass.cpp
@@ -11,7 +11,7 @@
// type_traits
// template<class B> struct negation; // C++17
-// template<class B>
+// template<class B>
// constexpr bool negation_v = negation<B>::value; // C++17
#include <type_traits>
diff --git a/test/std/utilities/meta/meta.rel/is_callable.pass.cpp b/test/std/utilities/meta/meta.rel/is_callable.pass.cpp
new file mode 100644
index 000000000000..4c85f440b0bf
--- /dev/null
+++ b/test/std/utilities/meta/meta.rel/is_callable.pass.cpp
@@ -0,0 +1,160 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// type_traits
+
+// is_callable
+
+// Most testing of is_callable is done within the [meta.trans.other] result_of
+// tests.
+
+#include <type_traits>
+#include <functional>
+#include <memory>
+
+#include "test_macros.h"
+
+struct Tag {};
+struct DerFromTag : Tag {};
+
+struct Implicit {
+ Implicit(int) {}
+};
+
+struct Explicit {
+ explicit Explicit(int) {}
+};
+
+struct NotCallableWithInt {
+ int operator()(int) = delete;
+ int operator()(Tag) { return 42; }
+};
+
+int main()
+{
+ {
+ using Fn = int(Tag::*)(int);
+ using RFn = int(Tag::*)(int) &&;
+ // INVOKE bullet 1, 2 and 3
+ {
+ // Bullet 1
+ static_assert(std::is_callable<Fn(Tag&, int)>::value, "");
+ static_assert(std::is_callable<Fn(DerFromTag&, int)>::value, "");
+ static_assert(std::is_callable<RFn(Tag&&, int)>::value, "");
+ static_assert(!std::is_callable<RFn(Tag&, int)>::value, "");
+ static_assert(!std::is_callable<Fn(Tag&)>::value, "");
+ static_assert(!std::is_callable<Fn(Tag const&, int)>::value, "");
+ }
+ {
+ // Bullet 2
+ using T = std::reference_wrapper<Tag>;
+ using DT = std::reference_wrapper<DerFromTag>;
+ using CT = std::reference_wrapper<const Tag>;
+ static_assert(std::is_callable<Fn(T&, int)>::value, "");
+ static_assert(std::is_callable<Fn(DT&, int)>::value, "");
+ static_assert(std::is_callable<Fn(const T&, int)>::value, "");
+ static_assert(std::is_callable<Fn(T&&, int)>::value, "");
+ static_assert(!std::is_callable<Fn(CT&, int)>::value, "");
+ static_assert(!std::is_callable<RFn(T, int)>::value, "");
+ }
+ {
+ // Bullet 3
+ using T = Tag*;
+ using DT = DerFromTag*;
+ using CT = const Tag*;
+ using ST = std::unique_ptr<Tag>;
+ static_assert(std::is_callable<Fn(T&, int)>::value, "");
+ static_assert(std::is_callable<Fn(DT&, int)>::value, "");
+ static_assert(std::is_callable<Fn(const T&, int)>::value, "");
+ static_assert(std::is_callable<Fn(T&&, int)>::value, "");
+ static_assert(std::is_callable<Fn(ST, int)>::value, "");
+ static_assert(!std::is_callable<Fn(CT&, int)>::value, "");
+ static_assert(!std::is_callable<RFn(T, int)>::value, "");
+ }
+ }
+ {
+ // Bullets 4, 5 and 6
+ using Fn = int (Tag::*);
+ static_assert(!std::is_callable<Fn()>::value, "");
+ {
+ // Bullet 4
+ static_assert(std::is_callable<Fn(Tag&)>::value, "");
+ static_assert(std::is_callable<Fn(DerFromTag&)>::value, "");
+ static_assert(std::is_callable<Fn(Tag&&)>::value, "");
+ static_assert(std::is_callable<Fn(Tag const&)>::value, "");
+ }
+ {
+ // Bullet 5
+ using T = std::reference_wrapper<Tag>;
+ using DT = std::reference_wrapper<DerFromTag>;
+ using CT = std::reference_wrapper<const Tag>;
+ static_assert(std::is_callable<Fn(T&)>::value, "");
+ static_assert(std::is_callable<Fn(DT&)>::value, "");
+ static_assert(std::is_callable<Fn(const T&)>::value, "");
+ static_assert(std::is_callable<Fn(T&&)>::value, "");
+ static_assert(std::is_callable<Fn(CT&)>::value, "");
+ }
+ {
+ // Bullet 6
+ using T = Tag*;
+ using DT = DerFromTag*;
+ using CT = const Tag*;
+ using ST = std::unique_ptr<Tag>;
+ static_assert(std::is_callable<Fn(T&)>::value, "");
+ static_assert(std::is_callable<Fn(DT&)>::value, "");
+ static_assert(std::is_callable<Fn(const T&)>::value, "");
+ static_assert(std::is_callable<Fn(T&&)>::value, "");
+ static_assert(std::is_callable<Fn(ST)>::value, "");
+ static_assert(std::is_callable<Fn(CT&)>::value, "");
+ }
+ }
+ {
+ // INVOKE bullet 7
+ {
+ // Function pointer
+ using Fp = void(*)(Tag&, int);
+ static_assert(std::is_callable<Fp(Tag&, int)>::value, "");
+ static_assert(std::is_callable<Fp(DerFromTag&, int)>::value, "");
+ static_assert(!std::is_callable<Fp(const Tag&, int)>::value, "");
+ static_assert(!std::is_callable<Fp()>::value, "");
+ static_assert(!std::is_callable<Fp(Tag&)>::value, "");
+ }
+ {
+ // Function reference
+ using Fp = void(&)(Tag&, int);
+ static_assert(std::is_callable<Fp(Tag&, int)>::value, "");
+ static_assert(std::is_callable<Fp(DerFromTag&, int)>::value, "");
+ static_assert(!std::is_callable<Fp(const Tag&, int)>::value, "");
+ static_assert(!std::is_callable<Fp()>::value, "");
+ static_assert(!std::is_callable<Fp(Tag&)>::value, "");
+ }
+ {
+ // Function object
+ using Fn = NotCallableWithInt;
+ static_assert(std::is_callable<Fn(Tag)>::value, "");
+ static_assert(!std::is_callable<Fn(int)>::value, "");
+ }
+ }
+ {
+ // Check that the conversion to the return type is properly checked
+ using Fn = int(*)();
+ static_assert(std::is_callable<Fn(), Implicit>::value, "");
+ static_assert(std::is_callable<Fn(), double>::value, "");
+ static_assert(std::is_callable<Fn(), const volatile void>::value, "");
+ static_assert(!std::is_callable<Fn(), Explicit>::value, "");
+ }
+ {
+ // Check for is_callable_v
+ using Fn = void(*)();
+ static_assert(std::is_callable_v<Fn()>, "");
+ static_assert(!std::is_callable_v<Fn(int)>, "");
+ }
+}
diff --git a/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp b/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
index 1681c39972d2..552c16075da7 100644
--- a/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
+++ b/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
@@ -12,7 +12,6 @@
// is_convertible
#include <type_traits>
-
#include "test_macros.h"
template <class T, class U>
@@ -46,12 +45,22 @@ void test_is_not_convertible()
}
typedef void Function();
+typedef void ConstFunction() const;
typedef char Array[1];
+struct StringType {
+ StringType(const char*) {}
+};
+
class NonCopyable {
NonCopyable(NonCopyable&);
};
+template <typename T>
+class CannotInstantiate {
+ enum { X = T::ThisExpressionWillBlowUp };
+};
+
int main()
{
// void
@@ -64,12 +73,19 @@ int main()
test_is_not_convertible<void,char> ();
test_is_not_convertible<void,char&> ();
test_is_not_convertible<void,char*> ();
+ test_is_not_convertible<char, void>();
// Function
test_is_not_convertible<Function, void> ();
test_is_not_convertible<Function, Function> ();
test_is_convertible<Function, Function&> ();
test_is_convertible<Function, Function*> ();
+ test_is_convertible<Function, Function*const> ();
+
+#if TEST_STD_VER >= 11
+ static_assert(( std::is_convertible<Function, Function&&>::value), "");
+#endif
+
test_is_not_convertible<Function, Array> ();
test_is_not_convertible<Function, Array&> ();
test_is_not_convertible<Function, char> ();
@@ -100,6 +116,16 @@ int main()
test_is_not_convertible<Function*, char&> ();
test_is_not_convertible<Function*, char*> ();
+ // Non-referencable function type
+ static_assert((!std::is_convertible<ConstFunction, Function>::value), "");
+ static_assert((!std::is_convertible<ConstFunction, Function*>::value), "");
+ static_assert((!std::is_convertible<ConstFunction, Function&>::value), "");
+ static_assert((!std::is_convertible<ConstFunction, Function>::value), "");
+ static_assert((!std::is_convertible<Function*, ConstFunction>::value), "");
+ static_assert((!std::is_convertible<Function&, ConstFunction>::value), "");
+ static_assert((!std::is_convertible<ConstFunction, ConstFunction>::value), "");
+ static_assert((!std::is_convertible<ConstFunction, void>::value), "");
+
// Array
test_is_not_convertible<Array, void> ();
test_is_not_convertible<Array, Function> ();
@@ -109,17 +135,37 @@ int main()
static_assert((!std::is_convertible<Array, Array&>::value), "");
static_assert(( std::is_convertible<Array, const Array&>::value), "");
+ static_assert((!std::is_convertible<Array, const volatile Array&>::value), "");
+
static_assert((!std::is_convertible<const Array, Array&>::value), "");
static_assert(( std::is_convertible<const Array, const Array&>::value), "");
+ static_assert((!std::is_convertible<Array, volatile Array&>::value), "");
+ static_assert((!std::is_convertible<Array, const volatile Array&>::value), "");
+
+#if TEST_STD_VER >= 11
+ static_assert(( std::is_convertible<Array, Array&&>::value), "");
+ static_assert(( std::is_convertible<Array, const Array&&>::value), "");
+ static_assert(( std::is_convertible<Array, volatile Array&&>::value), "");
+ static_assert(( std::is_convertible<Array, const volatile Array&&>::value), "");
+ static_assert(( std::is_convertible<const Array, const Array&&>::value), "");
+ static_assert((!std::is_convertible<Array&, Array&&>::value), "");
+ static_assert((!std::is_convertible<Array&&, Array&>::value), "");
+#endif
test_is_not_convertible<Array, char> ();
test_is_not_convertible<Array, char&> ();
static_assert(( std::is_convertible<Array, char*>::value), "");
static_assert(( std::is_convertible<Array, const char*>::value), "");
+ static_assert(( std::is_convertible<Array, char* const>::value), "");
+ static_assert(( std::is_convertible<Array, char* const volatile>::value), "");
+
static_assert((!std::is_convertible<const Array, char*>::value), "");
static_assert(( std::is_convertible<const Array, const char*>::value), "");
+ static_assert((!std::is_convertible<char[42][42], char*>::value), "");
+ static_assert((!std::is_convertible<char[][1], char*>::value), "");
+
// Array&
test_is_not_convertible<Array&, void> ();
test_is_not_convertible<Array&, Function> ();
@@ -140,6 +186,9 @@ int main()
static_assert((!std::is_convertible<const Array&, char*>::value), "");
static_assert(( std::is_convertible<const Array&, const char*>::value), "");
+ static_assert((std::is_convertible<Array, StringType>::value), "");
+ static_assert((std::is_convertible<char(&)[], StringType>::value), "");
+
// char
test_is_not_convertible<char, void> ();
test_is_not_convertible<char, Function> ();
@@ -149,7 +198,7 @@ int main()
test_is_not_convertible<char, Array&> ();
test_is_convertible<char, char> ();
-
+
static_assert((!std::is_convertible<char, char&>::value), "");
static_assert(( std::is_convertible<char, const char&>::value), "");
static_assert((!std::is_convertible<const char, char&>::value), "");
@@ -166,7 +215,7 @@ int main()
test_is_not_convertible<char&, Array&> ();
test_is_convertible<char&, char> ();
-
+
static_assert(( std::is_convertible<char&, char&>::value), "");
static_assert(( std::is_convertible<char&, const char&>::value), "");
static_assert((!std::is_convertible<const char&, char&>::value), "");
@@ -184,7 +233,7 @@ int main()
test_is_not_convertible<char*, char> ();
test_is_not_convertible<char*, char&> ();
-
+
static_assert(( std::is_convertible<char*, char*>::value), "");
static_assert(( std::is_convertible<char*, const char*>::value), "");
static_assert((!std::is_convertible<const char*, char*>::value), "");
@@ -202,8 +251,11 @@ int main()
static_assert((!std::is_convertible<const NonCopyable&, NonCopyable&>::value), "");
// This test requires Access control SFINAE which we only have in C++11 or when
// we are using the compiler builtin for is_convertible.
-#if __cplusplus >= 201103L || !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
+#if TEST_STD_VER >= 11 || !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
test_is_not_convertible<NonCopyable&, NonCopyable>();
#endif
+ // Ensure that CannotInstantiate is not instantiated by is_convertible when it is not needed.
+ // For example CannotInstantiate is instatiated as a part of ADL lookup for arguments of type CannotInstantiate*.
+ static_assert((std::is_convertible<CannotInstantiate<int>*, CannotInstantiate<int>*>::value), "");
}
diff --git a/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp b/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
new file mode 100644
index 000000000000..eefa6d1f22b1
--- /dev/null
+++ b/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
@@ -0,0 +1,115 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// type_traits
+
+// is_nothrow_callable
+
+#include <type_traits>
+#include <functional>
+
+#include "test_macros.h"
+
+struct Tag {};
+
+struct Implicit {
+ Implicit(int) noexcept {}
+};
+
+struct ThrowsImplicit {
+ ThrowsImplicit(int) {}
+};
+
+struct Explicit {
+ explicit Explicit(int) noexcept {}
+};
+
+template <bool IsNoexcept, class Ret, class ...Args>
+struct CallObject {
+ Ret operator()(Args&&...) const noexcept(IsNoexcept);
+};
+
+template <class Fn>
+constexpr bool throws_callable() {
+ return std::is_callable<Fn>::value &&
+ !std::is_nothrow_callable<Fn>::value;
+}
+
+template <class Fn, class Ret>
+constexpr bool throws_callable() {
+ return std::is_callable<Fn, Ret>::value &&
+ !std::is_nothrow_callable<Fn, Ret>::value;
+}
+
+// FIXME(EricWF) Don't test the where noexcept is *not* part of the type system
+// once implementations have caught up.
+void test_noexcept_function_pointers()
+{
+ struct Dummy { void foo() noexcept {} static void bar() noexcept {} };
+#if !defined(__cpp_noexcept_function_type)
+ {
+ // Check that PMF's and function pointers *work*. is_nothrow_callable will always
+ // return false because 'noexcept' is not part of the function type.
+ static_assert(throws_callable<decltype(&Dummy::foo)(Dummy&)>(), "");
+ static_assert(throws_callable<decltype(&Dummy::bar)()>(), "");
+ }
+#else
+ {
+ // Check that PMF's and function pointers actually work and that
+ // is_nothrow_callable returns true for noexcept PMF's and function
+ // pointers.
+ static_assert(std::is_nothrow_callable<decltype(&Dummy::foo)(Dummy&)>::value, "");
+ static_assert(std::is_nothrow_callable<decltype(&Dummy::bar)()>::value, "");
+ }
+#endif
+}
+
+int main()
+{
+ {
+ // Check that the conversion to the return type is properly checked
+ using Fn = CallObject<true, int>;
+ static_assert(std::is_nothrow_callable<Fn(), Implicit>::value, "");
+ static_assert(std::is_nothrow_callable<Fn(), double>::value, "");
+ static_assert(std::is_nothrow_callable<Fn(), const volatile void>::value, "");
+ static_assert(throws_callable<Fn(), ThrowsImplicit>(), "");
+ static_assert(!std::is_nothrow_callable<Fn(), Explicit>(), "");
+ }
+ {
+ // Check that the conversion to the parameters is properly checked
+ using Fn = CallObject<true, void, const Implicit&, const ThrowsImplicit&>;
+ static_assert(std::is_nothrow_callable<Fn(Implicit&, ThrowsImplicit&)>::value, "");
+ static_assert(std::is_nothrow_callable<Fn(int, ThrowsImplicit&)>::value, "");
+ static_assert(throws_callable<Fn(int, int)>(), "");
+ static_assert(!std::is_nothrow_callable<Fn()>::value, "");
+ }
+ {
+ // Check that the noexcept-ness of function objects is checked.
+ using Fn = CallObject<true, void>;
+ using Fn2 = CallObject<false, void>;
+ static_assert(std::is_nothrow_callable<Fn()>::value, "");
+ static_assert(throws_callable<Fn2()>(), "");
+ }
+ {
+ // Check that PMD derefs are noexcept
+ using Fn = int (Tag::*);
+ static_assert(std::is_nothrow_callable<Fn(Tag&)>::value, "");
+ static_assert(std::is_nothrow_callable<Fn(Tag&), Implicit>::value, "");
+ static_assert(throws_callable<Fn(Tag&), ThrowsImplicit>(), "");
+ }
+ {
+ // Check for is_nothrow_callable_v
+ using Fn = CallObject<true, int>;
+ static_assert(std::is_nothrow_callable_v<Fn()>, "");
+ static_assert(!std::is_nothrow_callable_v<Fn(int)>, "");
+ }
+ test_noexcept_function_pointers();
+}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
index a53bed984c5e..079661d0c174 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
@@ -164,7 +164,7 @@ int main()
// Use alignof(std::max_align_t) below to find the max alignment instead of
// hardcoding it, because it's different on different platforms.
// (For example 8 on arm and 16 on x86.)
-#if __cplusplus < 201103L
+#if TEST_STD_VER < 11
#define alignof __alignof__
#endif
{
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if2.fail.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if2.fail.cpp
index 8ce894578c4f..8c9b42d60f30 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if2.fail.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if2.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// type_traits
// enable_if
@@ -15,9 +16,5 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
typedef std::enable_if_t<false> A;
-#else
- static_assert ( false, "" );
-#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp
index 5a925bb34b26..fc01b22c36ab 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp
@@ -13,6 +13,7 @@
#include <type_traits>
#include <memory>
+#include <cassert>
#include "test_macros.h"
struct S
@@ -25,6 +26,11 @@ struct S
double const volatile& operator()(char, int&) const volatile;
};
+
+struct SD : public S { };
+
+struct NotDerived {};
+
template <class Tp>
struct Voider {
typedef void type;
@@ -39,6 +45,10 @@ struct HasType<T, typename Voider<typename T::type>::type> : std::true_type {};
template <class T, class U>
void test_result_of()
{
+#if TEST_STD_VER > 14
+ static_assert(std::is_callable<T>::value, "");
+ static_assert(std::is_callable<T, U>::value, "");
+#endif
static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
}
@@ -48,10 +58,14 @@ void test_no_result()
#if TEST_STD_VER >= 11
static_assert((!HasType<std::result_of<T> >::value), "");
#endif
+#if TEST_STD_VER > 14
+ static_assert(std::is_callable<T>::value == false, "");
+#endif
}
int main()
{
+ typedef NotDerived ND;
{ // functor object
test_result_of<S(int), short> ();
test_result_of<S&(unsigned char, int&), double> ();
@@ -90,32 +104,64 @@ int main()
typedef int (S::*PMS0)();
typedef int* (S::*PMS1)(long);
typedef int& (S::*PMS2)(long, int);
- test_result_of<PMS0( S), int> ();
- test_result_of<PMS0( S&), int> ();
- test_result_of<PMS0( S*), int> ();
- test_result_of<PMS0( S*&), int> ();
- test_result_of<PMS0(std::unique_ptr<S>), int> ();
+ test_result_of<PMS0( S), int> ();
+ test_result_of<PMS0( S&), int> ();
+ test_result_of<PMS0( S*), int> ();
+ test_result_of<PMS0( S*&), int> ();
+ test_result_of<PMS0( std::reference_wrapper<S>), int> ();
+ test_result_of<PMS0(const std::reference_wrapper<S>&), int> ();
+ test_result_of<PMS0( std::reference_wrapper<SD>), int> ();
+ test_result_of<PMS0(const std::reference_wrapper<SD>&), int> ();
+ test_result_of<PMS0(std::unique_ptr<S>), int> ();
+ test_result_of<PMS0(std::unique_ptr<SD>), int> ();
test_no_result<PMS0(const S&)>();
test_no_result<PMS0(volatile S&)>();
test_no_result<PMS0(const volatile S&)>();
+ test_no_result<PMS0(ND & )>();
+ test_no_result<PMS0(const ND& )>();
+ test_no_result<PMS0(std::unique_ptr<S const> )>();
+ test_no_result<PMS0(std::reference_wrapper<S const>)>();
+ test_no_result<PMS0(std::reference_wrapper<ND> )>();
+ test_no_result<PMS0(std::unique_ptr<ND> )>();
- test_result_of<PMS1( S, int), int*> ();
- test_result_of<PMS1( S&, int), int*> ();
- test_result_of<PMS1( S*, int), int*> ();
- test_result_of<PMS1( S*&, int), int*> ();
- test_result_of<PMS1(std::unique_ptr<S>, int), int*> ();
+ test_result_of<PMS1( S, int), int*> ();
+ test_result_of<PMS1( S&, int), int*> ();
+ test_result_of<PMS1( S*, int), int*> ();
+ test_result_of<PMS1( S*&, int), int*> ();
+ test_result_of<PMS1(std::unique_ptr<S>, int), int*> ();
+ test_result_of<PMS1(std::unique_ptr<SD>, int), int*> ();
+ test_result_of<PMS1(std::reference_wrapper<S>, int), int*> ();
+ test_result_of<PMS1(const std::reference_wrapper<S>&, int), int*> ();
+ test_result_of<PMS1(std::reference_wrapper<SD>, int), int*> ();
+ test_result_of<PMS1(const std::reference_wrapper<SD>&, int), int*> ();
test_no_result<PMS1(const S&, int)>();
test_no_result<PMS1(volatile S&, int)>();
test_no_result<PMS1(const volatile S&, int)>();
+ test_no_result<PMS1(ND &, int)>();
+ test_no_result<PMS1(const ND&, int)>();
+ test_no_result<PMS1(std::unique_ptr<S const>, int)>();
+ test_no_result<PMS1(std::reference_wrapper<S const>, int)>();
+ test_no_result<PMS1(std::reference_wrapper<ND>, int)>();
+ test_no_result<PMS1(std::unique_ptr<ND>, int)>();
test_result_of<PMS2( S, int, int), int&> ();
test_result_of<PMS2( S&, int, int), int&> ();
test_result_of<PMS2( S*, int, int), int&> ();
test_result_of<PMS2( S*&, int, int), int&> ();
test_result_of<PMS2(std::unique_ptr<S>, int, int), int&> ();
+ test_result_of<PMS2(std::unique_ptr<SD>, int, int), int&> ();
+ test_result_of<PMS2(std::reference_wrapper<S>, int, int), int&> ();
+ test_result_of<PMS2(const std::reference_wrapper<S>&, int, int), int&> ();
+ test_result_of<PMS2(std::reference_wrapper<SD>, int, int), int&> ();
+ test_result_of<PMS2(const std::reference_wrapper<SD>&, int, int), int&> ();
test_no_result<PMS2(const S&, int, int)>();
test_no_result<PMS2(volatile S&, int, int)>();
test_no_result<PMS2(const volatile S&, int, int)>();
+ test_no_result<PMS2(std::unique_ptr<S const>, int, int)>();
+ test_no_result<PMS2(std::reference_wrapper<S const>, int, int)>();
+ test_no_result<PMS2(const ND&, int, int)>();
+ test_no_result<PMS2(std::reference_wrapper<ND>, int, int)>();
+ test_no_result<PMS2(std::unique_ptr<ND>, int, int)>();
typedef int (S::*PMS0C)() const;
typedef int* (S::*PMS1C)(long) const;
@@ -128,6 +174,15 @@ int main()
test_result_of<PMS0C( S*&), int> ();
test_result_of<PMS0C(const S*&), int> ();
test_result_of<PMS0C(std::unique_ptr<S>), int> ();
+ test_result_of<PMS0C(std::unique_ptr<SD>), int> ();
+ test_result_of<PMS0C(std::reference_wrapper<S> ), int> ();
+ test_result_of<PMS0C(std::reference_wrapper<const S> ), int> ();
+ test_result_of<PMS0C(const std::reference_wrapper<S> & ), int> ();
+ test_result_of<PMS0C(const std::reference_wrapper<const S> &), int> ();
+ test_result_of<PMS0C(std::reference_wrapper<SD> ), int> ();
+ test_result_of<PMS0C(std::reference_wrapper<const SD> ), int> ();
+ test_result_of<PMS0C(const std::reference_wrapper<SD> & ), int> ();
+ test_result_of<PMS0C(const std::reference_wrapper<const SD> &), int> ();
test_no_result<PMS0C(volatile S&)>();
test_no_result<PMS0C(const volatile S&)>();
@@ -248,5 +303,16 @@ int main()
test_result_of<PMD(volatile S*), volatile char&> ();
test_result_of<PMD(const volatile S&), const volatile char&> ();
test_result_of<PMD(const volatile S*), const volatile char&> ();
+ test_result_of<PMD(SD&), char &>();
+ test_result_of<PMD(SD const&), const char&>();
+ test_result_of<PMD(SD*), char&>();
+ test_result_of<PMD(const SD*), const char&>();
+ test_result_of<PMD(std::unique_ptr<S>), char &>();
+ test_result_of<PMD(std::unique_ptr<S const>), const char&>();
+#if TEST_STD_VER >= 11
+ test_result_of<PMD(std::reference_wrapper<S>), char&>();
+ test_result_of<PMD(std::reference_wrapper<S const>), const char&>();
+#endif
+ test_no_result<PMD(ND&)>();
}
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
index 6996cddc08b9..8cb5853bbc6d 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
@@ -14,6 +14,8 @@
// result_of<Fn(ArgTypes...)>
#include <type_traits>
+#include <memory>
+#include <utility>
#include "test_macros.h"
struct wat
@@ -23,6 +25,8 @@ struct wat
};
struct F {};
+struct FD : public F {};
+struct NotDerived {};
template <class T, class U>
void test_result_of_imp()
@@ -31,10 +35,15 @@ void test_result_of_imp()
#if TEST_STD_VER > 11
static_assert((std::is_same<std::result_of_t<T>, U>::value), "");
#endif
+#if TEST_STD_VER > 14
+ static_assert(std::is_callable<T>::value, "");
+ static_assert(std::is_callable<T, U>::value, "");
+#endif
}
int main()
{
+ typedef NotDerived ND;
{
typedef char F::*PMD;
test_result_of_imp<PMD(F &), char &>();
@@ -51,6 +60,31 @@ int main()
test_result_of_imp<PMD(F const ), char &&>();
test_result_of_imp<PMD(F volatile ), char &&>();
test_result_of_imp<PMD(F const volatile ), char &&>();
+
+ test_result_of_imp<PMD(FD &), char &>();
+ test_result_of_imp<PMD(FD const &), char const &>();
+ test_result_of_imp<PMD(FD volatile &), char volatile &>();
+ test_result_of_imp<PMD(FD const volatile &), char const volatile &>();
+
+ test_result_of_imp<PMD(FD &&), char &&>();
+ test_result_of_imp<PMD(FD const &&), char const &&>();
+ test_result_of_imp<PMD(FD volatile &&), char volatile &&>();
+ test_result_of_imp<PMD(FD const volatile &&), char const volatile &&>();
+
+ test_result_of_imp<PMD(FD ), char &&>();
+ test_result_of_imp<PMD(FD const ), char &&>();
+ test_result_of_imp<PMD(FD volatile ), char &&>();
+ test_result_of_imp<PMD(FD const volatile ), char &&>();
+
+ test_result_of_imp<PMD(std::unique_ptr<F>), char &>();
+ test_result_of_imp<PMD(std::unique_ptr<F const>), const char &>();
+ test_result_of_imp<PMD(std::unique_ptr<FD>), char &>();
+ test_result_of_imp<PMD(std::unique_ptr<FD const>), const char &>();
+
+ test_result_of_imp<PMD(std::reference_wrapper<F>), char &>();
+ test_result_of_imp<PMD(std::reference_wrapper<F const>), const char &>();
+ test_result_of_imp<PMD(std::reference_wrapper<FD>), char &>();
+ test_result_of_imp<PMD(std::reference_wrapper<FD const>), const char &>();
}
{
test_result_of_imp<int (F::* (F &)) () &, int> ();
@@ -83,6 +117,42 @@ int main()
test_result_of_imp<int (F::* (F volatile )) () const volatile &&, int> ();
test_result_of_imp<int (F::* (F const volatile )) () const volatile &&, int> ();
}
+ {
+ test_result_of_imp<int (F::* (FD &)) () &, int> ();
+ test_result_of_imp<int (F::* (FD &)) () const &, int> ();
+ test_result_of_imp<int (F::* (FD &)) () volatile &, int> ();
+ test_result_of_imp<int (F::* (FD &)) () const volatile &, int> ();
+ test_result_of_imp<int (F::* (FD const &)) () const &, int> ();
+ test_result_of_imp<int (F::* (FD const &)) () const volatile &, int> ();
+ test_result_of_imp<int (F::* (FD volatile &)) () volatile &, int> ();
+ test_result_of_imp<int (F::* (FD volatile &)) () const volatile &, int> ();
+ test_result_of_imp<int (F::* (FD const volatile &)) () const volatile &, int> ();
+
+ test_result_of_imp<int (F::* (FD &&)) () &&, int> ();
+ test_result_of_imp<int (F::* (FD &&)) () const &&, int> ();
+ test_result_of_imp<int (F::* (FD &&)) () volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD &&)) () const volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD const &&)) () const &&, int> ();
+ test_result_of_imp<int (F::* (FD const &&)) () const volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD volatile &&)) () volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD volatile &&)) () const volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD const volatile &&)) () const volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD )) () &&, int> ();
+ test_result_of_imp<int (F::* (FD )) () const &&, int> ();
+ test_result_of_imp<int (F::* (FD )) () volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD )) () const volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD const )) () const &&, int> ();
+ test_result_of_imp<int (F::* (FD const )) () const volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD volatile )) () volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD volatile )) () const volatile &&, int> ();
+ test_result_of_imp<int (F::* (FD const volatile )) () const volatile &&, int> ();
+ }
+ {
+ test_result_of_imp<int (F::* (std::reference_wrapper<F>)) (), int>();
+ test_result_of_imp<int (F::* (std::reference_wrapper<const F>)) () const, int>();
+ test_result_of_imp<int (F::* (std::unique_ptr<F> )) (), int>();
+ test_result_of_imp<int (F::* (std::unique_ptr<const F> )) () const, int>();
+ }
test_result_of_imp<decltype(&wat::foo)(wat), void>();
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
index 728062b70684..1d7b23c19222 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
@@ -14,6 +14,8 @@
#include <type_traits>
#include <climits>
+#include "test_macros.h"
+
enum E { V = INT_MIN };
enum F { W = UINT_MAX };
@@ -29,7 +31,7 @@ int main()
static_assert((std::is_same<std::underlying_type_t<F>, unsigned>::value), "");
#endif
-#if __has_feature(cxx_strong_enums)
+#if TEST_STD_VER >= 11
enum G : char { };
static_assert((std::is_same<std::underlying_type<G>::type, char>::value),
@@ -37,5 +39,5 @@ int main()
#if _LIBCPP_STD_VER > 11
static_assert((std::is_same<std::underlying_type_t<G>, char>::value), "");
#endif
-#endif // __has_feature(cxx_strong_enums)
+#endif // TEST_STD_VER >= 11
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp
index 76d0f12d03fb..51b3e5d73688 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp
@@ -10,18 +10,42 @@
// type_traits
// add_pointer
+// If T names a referenceable type or a (possibly cv-qualified) void type then
+// the member typedef type shall name the same type as remove_reference_t<T>*;
+// otherwise, type shall name T.
#include <type_traits>
+#include "test_macros.h"
template <class T, class U>
void test_add_pointer()
{
static_assert((std::is_same<typename std::add_pointer<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::add_pointer_t<T>, U>::value), "");
#endif
}
+template <class F>
+void test_function0()
+{
+ static_assert((std::is_same<typename std::add_pointer<F>::type, F*>::value), "");
+#if TEST_STD_VER > 11
+ static_assert((std::is_same<std::add_pointer_t<F>, F*>::value), "");
+#endif
+}
+
+template <class F>
+void test_function1()
+{
+ static_assert((std::is_same<typename std::add_pointer<F>::type, F>::value), "");
+#if TEST_STD_VER > 11
+ static_assert((std::is_same<std::add_pointer_t<F>, F>::value), "");
+#endif
+}
+
+struct Foo {};
+
int main()
{
test_add_pointer<void, void*>();
@@ -31,4 +55,26 @@ int main()
test_add_pointer<const int&, const int*>();
test_add_pointer<int*, int**>();
test_add_pointer<const int*, const int**>();
+ test_add_pointer<Foo, Foo*>();
+
+// LWG 2101 specifically talks about add_pointer and functions.
+// The term of art is "a referenceable type", which a cv- or ref-qualified function is not.
+ test_function0<void()>();
+#if TEST_STD_VER >= 11
+ test_function1<void() const>();
+ test_function1<void() &>();
+ test_function1<void() &&>();
+ test_function1<void() const &>();
+ test_function1<void() const &&>();
+#endif
+
+// But a cv- or ref-qualified member function *is* "a referenceable type"
+ test_function0<void (Foo::*)()>();
+#if TEST_STD_VER >= 11
+ test_function0<void (Foo::*)() const>();
+ test_function0<void (Foo::*)() &>();
+ test_function0<void (Foo::*)() &&>();
+ test_function0<void (Foo::*)() const &>();
+ test_function0<void (Foo::*)() const &&>();
+#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp
index 9cecd39049fc..cccbb6011edf 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp
@@ -12,12 +12,13 @@
// remove_pointer
#include <type_traits>
+#include "test_macros.h"
template <class T, class U>
void test_remove_pointer()
{
static_assert((std::is_same<typename std::remove_pointer<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::remove_pointer_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
index fb53312cbe67..c82c28299535 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
@@ -10,14 +10,17 @@
// type_traits
// add_lvalue_reference
+// If T names a referenceable type then the member typedef type
+// shall name T&; otherwise, type shall name T.
#include <type_traits>
+#include "test_macros.h"
template <class T, class U>
void test_add_lvalue_reference()
{
static_assert((std::is_same<typename std::add_lvalue_reference<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::add_lvalue_reference_t<T>, U>::value), "");
#endif
}
@@ -26,7 +29,7 @@ template <class F>
void test_function0()
{
static_assert((std::is_same<typename std::add_lvalue_reference<F>::type, F&>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::add_lvalue_reference_t<F>, F&>::value), "");
#endif
}
@@ -35,7 +38,7 @@ template <class F>
void test_function1()
{
static_assert((std::is_same<typename std::add_lvalue_reference<F>::type, F>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::add_lvalue_reference_t<F>, F>::value), "");
#endif
}
@@ -51,20 +54,26 @@ int main()
test_add_lvalue_reference<const int&, const int&>();
test_add_lvalue_reference<int*, int*&>();
test_add_lvalue_reference<const int*, const int*&>();
+ test_add_lvalue_reference<Foo, Foo&>();
// LWG 2101 specifically talks about add_lvalue_reference and functions.
// The term of art is "a referenceable type", which a cv- or ref-qualified function is not.
test_function0<void()>();
-// test_function1<void() const>();
-// test_function1<void() &>();
-// test_function1<void() &&>();
-// test_function1<void() const &>();
-// test_function1<void() const &&>();
+#if TEST_STD_VER >= 11
+ test_function1<void() const>();
+ test_function1<void() &>();
+ test_function1<void() &&>();
+ test_function1<void() const &>();
+ test_function1<void() const &&>();
+#endif
+// But a cv- or ref-qualified member function *is* "a referenceable type"
test_function0<void (Foo::*)()>();
+#if TEST_STD_VER >= 11
test_function0<void (Foo::*)() const>();
test_function0<void (Foo::*)() &>();
test_function0<void (Foo::*)() &&>();
test_function0<void (Foo::*)() const &>();
test_function0<void (Foo::*)() const &&>();
+#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
index e8f08fdc398a..fc147c37b1ac 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
@@ -10,8 +10,11 @@
// type_traits
// add_rvalue_reference
+// If T names a referenceable type then the member typedef type
+// shall name T&&; otherwise, type shall name T.
#include <type_traits>
+#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -19,13 +22,32 @@ template <class T, class U>
void test_add_rvalue_reference()
{
static_assert((std::is_same<typename std::add_rvalue_reference<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::add_rvalue_reference_t<T>, U>::value), "");
#endif
}
+template <class F>
+void test_function0()
+{
+ static_assert((std::is_same<typename std::add_rvalue_reference<F>::type, F&&>::value), "");
+#if TEST_STD_VER > 11
+ static_assert((std::is_same<std::add_rvalue_reference_t<F>, F&&>::value), "");
+#endif
+}
+
+template <class F>
+void test_function1()
+{
+ static_assert((std::is_same<typename std::add_rvalue_reference<F>::type, F>::value), "");
+#if TEST_STD_VER > 11
+ static_assert((std::is_same<std::add_rvalue_reference_t<F>, F>::value), "");
+#endif
+}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+struct Foo {};
+
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -36,5 +58,27 @@ int main()
test_add_rvalue_reference<const int&, const int&>();
test_add_rvalue_reference<int*, int*&&>();
test_add_rvalue_reference<const int*, const int*&&>();
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test_add_rvalue_reference<Foo, Foo&&>();
+
+// LWG 2101 specifically talks about add_rvalue_reference and functions.
+// The term of art is "a referenceable type", which a cv- or ref-qualified function is not.
+ test_function0<void()>();
+#if TEST_STD_VER >= 11
+ test_function1<void() const>();
+ test_function1<void() &>();
+ test_function1<void() &&>();
+ test_function1<void() const &>();
+ test_function1<void() const &&>();
+#endif
+
+// But a cv- or ref-qualified member function *is* "a referenceable type"
+ test_function0<void (Foo::*)()>();
+#if TEST_STD_VER >= 11
+ test_function0<void (Foo::*)() const>();
+ test_function0<void (Foo::*)() &>();
+ test_function0<void (Foo::*)() &&>();
+ test_function0<void (Foo::*)() const &>();
+ test_function0<void (Foo::*)() const &&>();
+#endif
+#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
index f9ebc37a5dd2..e335bd19ef2d 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
@@ -12,12 +12,13 @@
// remove_reference
#include <type_traits>
+#include "test_macros.h"
template <class T, class U>
void test_remove_reference()
{
static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::remove_reference_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp b/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp
index ccec65fec399..05ef99d0ebf4 100644
--- a/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp
+++ b/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp
@@ -57,7 +57,7 @@ int main()
test1<Class>();
test1<Class[]>();
test1<Class[5]>();
-
+
test2<void, int>();
test2<double, int>();
test2<int&, int>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp
index f4dd356383af..ef1fc4040dc7 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp
@@ -12,12 +12,13 @@
// array
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_array_imp()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -46,10 +47,15 @@ void test_array()
typedef char array[3];
typedef const char const_array[3];
typedef char incomplete_array[];
+struct Incomplete;
int main()
{
test_array<array>();
test_array<const_array>();
test_array<incomplete_array>();
+ test_array<Incomplete[]>();
+
+// LWG#2582
+ static_assert(!std::is_array<Incomplete>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp
index ac5d6e592311..8c8510882bf6 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp
@@ -12,12 +12,13 @@
// class
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_class_imp()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -47,7 +48,13 @@ class Class
{
};
+struct incomplete_type;
+
int main()
{
test_class<Class>();
+ test_class<incomplete_type>();
+
+// LWG#2582
+ static_assert( std::is_class<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp
index 7c9c78fcf2b9..40dea443cd41 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp
@@ -12,12 +12,13 @@
// enum
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_enum_imp()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -44,8 +45,12 @@ void test_enum()
}
enum Enum {zero, one};
+struct incomplete_type;
int main()
{
test_enum<Enum>();
+
+// LWG#2582
+ static_assert(!std::is_enum<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp
index 286644960315..217bc7e25659 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp
@@ -12,12 +12,13 @@
// floating_point
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_floating_point_imp()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -43,9 +44,14 @@ void test_floating_point()
test_floating_point_imp<const volatile T>();
}
+struct incomplete_type;
+
int main()
{
test_floating_point<float>();
test_floating_point<double>();
test_floating_point<long double>();
+
+// LWG#2582
+ static_assert(!std::is_floating_point<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp
index b1df4f2d3f4c..3f21b9a7dbcf 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp
@@ -12,13 +12,14 @@
// function
#include <type_traits>
+#include "test_macros.h"
using namespace std;
class Class {};
enum Enum1 {};
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
enum class Enum2 : int {};
#else
enum Enum2 {};
@@ -28,7 +29,7 @@ template <class T>
void test()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -64,6 +65,7 @@ void test()
test<__VA_ARGS__ volatile &&>(); \
test<__VA_ARGS__ const volatile &&>()
+struct incomplete_type;
int main()
{
@@ -75,7 +77,7 @@ int main()
TEST_REGULAR( void (int, ...) );
TEST_REGULAR( int (double, ...) );
TEST_REGULAR( int (double, char, ...) );
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
TEST_REF_QUALIFIED( void () );
TEST_REF_QUALIFIED( void (int) );
TEST_REF_QUALIFIED( int (double) );
@@ -85,4 +87,7 @@ int main()
TEST_REF_QUALIFIED( int (double, ...) );
TEST_REF_QUALIFIED( int (double, char, ...) );
#endif
+
+// LWG#2582
+ static_assert(!std::is_function<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp
index f68ed3ef7e57..a50beeb3e310 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp
@@ -12,12 +12,13 @@
// integral
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_integral_imp()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert( std::is_integral<T>::value, "");
@@ -43,6 +44,8 @@ void test_integral()
test_integral_imp<const volatile T>();
}
+struct incomplete_type;
+
int main()
{
test_integral<bool>();
@@ -62,4 +65,7 @@ int main()
test_integral<__int128_t>();
test_integral<__uint128_t>();
#endif
+
+// LWG#2582
+ static_assert(!std::is_integral<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
index 72955defa399..dfd09ac52bfa 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
@@ -12,7 +12,7 @@
// is_array
#include <type_traits>
-#include <cstddef> // for std::nullptr_t
+#include <cstddef> // for std::nullptr_t
#include "test_macros.h"
template <class T>
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -89,5 +90,5 @@ int main()
test_is_not_array<Empty>();
test_is_not_array<bit_zero>();
test_is_not_array<NotEmpty>();
- test_is_not_array<Abstract>();
+ test_is_not_array<incomplete_type>(); // LWG#2582
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp
index 97671e7b62e0..3c1a2181d261 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -76,6 +77,7 @@ int main()
test_is_class<bit_zero>();
test_is_class<NotEmpty>();
test_is_class<Abstract>();
+ test_is_class<incomplete_type>();
#if TEST_STD_VER >= 11
// In C++03 we have an emulation of std::nullptr_t
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp
index 481260ea6e52..2603bdff26d2 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -90,4 +91,5 @@ int main()
test_is_not_enum<NotEmpty>();
test_is_not_enum<Abstract>();
test_is_not_enum<FunctionPtr>();
+ test_is_not_enum<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp
index de9c146bcb4e..7e19c0629672 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -98,4 +99,5 @@ int main()
test_is_not_floating_point<Abstract>();
test_is_not_floating_point<Enum>();
test_is_not_floating_point<FunctionPtr>();
+ test_is_not_floating_point<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
index 9a1d821b0746..32e4f06beb04 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -77,7 +78,7 @@ int main()
test_is_function<int(int, double)>();
test_is_function<int(Abstract *)>();
test_is_function<void(...)>();
-
+
test_is_not_function<std::nullptr_t>();
test_is_not_function<void>();
test_is_not_function<int>();
@@ -95,4 +96,5 @@ int main()
test_is_not_function<NotEmpty>();
test_is_not_function<Abstract>();
test_is_not_function<Abstract*>();
+ test_is_not_function<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp
index 86b63c53da54..09997626ea06 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -101,4 +102,5 @@ int main()
test_is_not_integral<bit_zero>();
test_is_not_integral<NotEmpty>();
test_is_not_integral<Abstract>();
+ test_is_not_integral<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp
index 0e59f7153f50..41b8d44b9315 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp
@@ -69,6 +69,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -92,4 +93,5 @@ int main()
test_is_not_lvalue_reference<bit_zero>();
test_is_not_lvalue_reference<NotEmpty>();
test_is_not_lvalue_reference<Abstract>();
+ test_is_not_lvalue_reference<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp
index 8da411d2eeed..9498edc652ab 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -94,4 +95,5 @@ int main()
test_is_not_member_object_pointer<bit_zero>();
test_is_not_member_object_pointer<NotEmpty>();
test_is_not_member_object_pointer<Abstract>();
+ test_is_not_member_object_pointer<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp
index 19a74b01d0fd..d4043f48f98e 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -95,4 +96,5 @@ int main()
test_is_not_member_pointer<bit_zero>();
test_is_not_member_pointer<NotEmpty>();
test_is_not_member_pointer<Abstract>();
+ test_is_not_member_pointer<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp
index 80f563e8969e..f575763300a7 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp
@@ -69,6 +69,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -92,4 +93,5 @@ int main()
test_is_not_null_pointer<bit_zero>();
test_is_not_null_pointer<NotEmpty>();
test_is_not_null_pointer<Abstract>();
+ test_is_not_null_pointer<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp
index a901aed1143e..257719eb940e 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -91,4 +92,5 @@ int main()
test_is_not_pointer<bit_zero>();
test_is_not_pointer<NotEmpty>();
test_is_not_pointer<Abstract>();
+ test_is_not_pointer<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp
index b7b52687018a..89639377ce81 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp
@@ -69,6 +69,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -92,4 +93,5 @@ int main()
test_is_not_rvalue_reference<bit_zero>();
test_is_not_rvalue_reference<NotEmpty>();
test_is_not_rvalue_reference<Abstract>();
+ test_is_not_rvalue_reference<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp
index 307fedb32b26..415d9a7813dd 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -90,4 +91,5 @@ int main()
test_is_not_union<bit_zero>();
test_is_not_union<NotEmpty>();
test_is_not_union<Abstract>();
+ test_is_not_union<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp
index 1647666adf2e..952a5b748f53 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp
@@ -67,6 +67,7 @@ class Abstract
};
enum Enum {zero, one};
+struct incomplete_type;
typedef void (*FunctionPtr)();
@@ -89,4 +90,5 @@ int main()
test_is_not_void<Abstract>();
test_is_not_void<Enum>();
test_is_not_void<FunctionPtr>();
+ test_is_not_void<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp
index 3b6ccade7e74..13cad58c0ef3 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp
@@ -34,8 +34,13 @@ void test_lvalue_ref()
static_assert(!std::is_function<T>::value, "");
}
+struct incomplete_type;
+
int main()
{
test_lvalue_ref<int&>();
test_lvalue_ref<const int&>();
+
+// LWG#2582
+ static_assert(!std::is_lvalue_reference<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
index 6f546efdf51e..a895a8d447b6 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
@@ -48,6 +48,8 @@ class Class
{
};
+struct incomplete_type;
+
int main()
{
test_member_function_pointer<void (Class::*)()>();
@@ -133,4 +135,7 @@ int main()
test_member_function_pointer<void (Class::*)(int,...) const volatile &&>();
test_member_function_pointer<void (Class::*)(int, char,...) const volatile &&>();
#endif
+
+// LWG#2582
+ static_assert(!std::is_member_function_pointer<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp
index e13e58632a32..b0edea37e8e8 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp
@@ -48,6 +48,8 @@ class Class
{
};
+struct incomplete_type;
+
int main()
{
test_member_function_pointer<void (Class::*)()>();
@@ -73,4 +75,7 @@ int main()
test_member_function_pointer<void (Class::*)(...) volatile>();
test_member_function_pointer<void (Class::*)(int, ...) volatile>();
test_member_function_pointer<void (Class::*)(int, char, ...) volatile>();
+
+// LWG#2582
+ static_assert(!std::is_member_function_pointer<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp
index 4e6699cc3e7c..76deef4291e7 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp
@@ -12,12 +12,13 @@
// member_object_pointer
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_member_object_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -47,7 +48,12 @@ class Class
{
};
+struct incomplete_type;
+
int main()
{
test_member_object_pointer<int Class::*>();
+
+// LWG#2582
+ static_assert(!std::is_member_object_pointer<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp
index 1c7a32fc9dc9..076204c9c094 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp
@@ -14,8 +14,9 @@
#include <type_traits>
#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
template <class T>
void test_nullptr_imp()
{
@@ -44,9 +45,14 @@ void test_nullptr()
test_nullptr_imp<const volatile T>();
}
+struct incomplete_type;
+
int main()
{
test_nullptr<std::nullptr_t>();
+
+// LWG#2582
+ static_assert(!std::is_null_pointer<incomplete_type>::value, "");
}
#else
int main() {}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp
index 7073c106b44b..f9c83c67d219 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp
@@ -12,12 +12,14 @@
// pointer
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
void test_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -43,10 +45,15 @@ void test_pointer()
test_pointer_imp<const volatile T>();
}
+struct incomplete_type;
+
int main()
{
test_pointer<void*>();
test_pointer<int*>();
test_pointer<const int*>();
test_pointer<void (*)(int)>();
+
+// LWG#2582
+ static_assert(!std::is_pointer<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
index 796442403634..99fd2887981f 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
@@ -12,12 +12,13 @@
// rvalue_ref
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_rvalue_ref()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -34,10 +35,15 @@ void test_rvalue_ref()
static_assert(!std::is_function<T>::value, "");
}
+struct incomplete_type;
+
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test_rvalue_ref<int&&>();
test_rvalue_ref<const int&&>();
+
+// LWG#2582
+ static_assert(!std::is_rvalue_reference<incomplete_type>::value, "");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp
index 6cabb717c0c6..36ad00400d35 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp
@@ -12,12 +12,13 @@
// union
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_union_imp()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -49,7 +50,12 @@ union Union
double __;
};
+struct incomplete_type;
+
int main()
{
test_union<Union>();
+
+// LWG#2582
+ static_assert(!std::is_union<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp
index f20bcf87ea15..c7597eb4eaf7 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp
@@ -12,12 +12,13 @@
// void
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_void_imp()
{
static_assert( std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -43,7 +44,12 @@ void test_void()
test_void_imp<const volatile T>();
}
+struct incomplete_type;
+
int main()
{
test_void<void>();
+
+// LWG#2582
+ static_assert(!std::is_void<incomplete_type>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp
index 3476d5ceea2b..f601bd12cadb 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp
@@ -38,9 +38,12 @@ typedef char array[3];
typedef const char const_array[3];
typedef char incomplete_array[];
+class incomplete_type;
+
int main()
{
test_array<array>();
test_array<const_array>();
test_array<incomplete_array>();
+ test_array<incomplete_type[]>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp
index 49e41380ca27..5fa5da12aef8 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp
@@ -38,7 +38,10 @@ class Class
{
};
+class incomplete_type;
+
int main()
{
test_class<Class>();
+ test_class<incomplete_type>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp
index a3f18d52a706..02c539712c65 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp
@@ -45,6 +45,8 @@ void test_is_not_arithmetic()
#endif
}
+class incomplete_type;
+
class Empty
{
};
@@ -98,6 +100,7 @@ int main()
test_is_not_arithmetic<Enum>();
test_is_not_arithmetic<FunctionPtr>();
test_is_not_arithmetic<Empty>();
+ test_is_not_arithmetic<incomplete_type>();
test_is_not_arithmetic<bit_zero>();
test_is_not_arithmetic<NotEmpty>();
test_is_not_arithmetic<Abstract>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp
index 6a1798ab5adc..d8d5162c1a02 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp
@@ -45,6 +45,8 @@ void test_is_not_compound()
#endif
}
+class incomplete_type;
+
class Empty
{
};
@@ -81,6 +83,7 @@ int main()
test_is_compound<int&&>();
test_is_compound<Union>();
test_is_compound<Empty>();
+ test_is_compound<incomplete_type>();
test_is_compound<bit_zero>();
test_is_compound<int*>();
test_is_compound<const int*>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp
index e16337e05f1c..f776196dd7a9 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp
@@ -45,6 +45,8 @@ void test_is_not_fundamental()
#endif
}
+class incomplete_type;
+
class Empty
{
};
@@ -94,7 +96,7 @@ int main()
test_is_fundamental<long double>();
test_is_fundamental<char16_t>();
test_is_fundamental<char32_t>();
-
+
test_is_not_fundamental<char[3]>();
test_is_not_fundamental<char[]>();
test_is_not_fundamental<void *>();
@@ -103,6 +105,7 @@ int main()
test_is_not_fundamental<int&&>();
test_is_not_fundamental<Union>();
test_is_not_fundamental<Empty>();
+ test_is_not_fundamental<incomplete_type>();
test_is_not_fundamental<bit_zero>();
test_is_not_fundamental<int*>();
test_is_not_fundamental<const int*>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp
index 890da659e218..c2804885ac50 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp
@@ -45,6 +45,8 @@ void test_is_not_member_pointer()
#endif
}
+class incomplete_type;
+
class Empty
{
};
@@ -73,9 +75,9 @@ typedef void (*FunctionPtr)();
int main()
{
-// Arithmetic types (3.9.1), enumeration types, pointer types, pointer to member types (3.9.2),
-// std::nullptr_t, and cv-qualified versions of these types (3.9.3)
-// are collectively called scalar types.
+// Arithmetic types (3.9.1), enumeration types, pointer types, pointer to member types (3.9.2),
+// std::nullptr_t, and cv-qualified versions of these types (3.9.3)
+// are collectively called scalar types.
test_is_member_pointer<int Empty::*>();
test_is_member_pointer<void (Empty::*)(int)>();
@@ -93,6 +95,7 @@ int main()
test_is_not_member_pointer<char[]>();
test_is_not_member_pointer<Union>();
test_is_not_member_pointer<Empty>();
+ test_is_not_member_pointer<incomplete_type>();
test_is_not_member_pointer<bit_zero>();
test_is_not_member_pointer<NotEmpty>();
test_is_not_member_pointer<Abstract>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp
index ff7dda30d111..311215b81643 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp
@@ -45,6 +45,8 @@ void test_is_not_object()
#endif
}
+class incomplete_type;
+
class Empty
{
};
@@ -73,7 +75,7 @@ typedef void (*FunctionPtr)();
int main()
{
-// An object type is a (possibly cv-qualified) type that is not a function type,
+// An object type is a (possibly cv-qualified) type that is not a function type,
// not a reference type, and not a void type.
test_is_object<std::nullptr_t>();
@@ -86,8 +88,8 @@ int main()
test_is_object<int*>();
test_is_object<const int*>();
test_is_object<Enum>();
- test_is_object<Empty>();
- test_is_object<bit_zero>();
+ test_is_object<incomplete_type>();
+ test_is_object<bit_zero>();
test_is_object<NotEmpty>();
test_is_object<Abstract>();
test_is_object<FunctionPtr>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp
index e56c8f761814..b546458bdcb8 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp
@@ -45,6 +45,8 @@ void test_is_not_reference()
#endif
}
+class incomplete_type;
+
class Empty
{
};
@@ -87,6 +89,7 @@ int main()
test_is_not_reference<void *>();
test_is_not_reference<FunctionPtr>();
test_is_not_reference<Union>();
+ test_is_not_reference<incomplete_type>();
test_is_not_reference<Empty>();
test_is_not_reference<bit_zero>();
test_is_not_reference<int*>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp
index 2b412a68833b..39ac07ad4bc5 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp
@@ -45,6 +45,8 @@ void test_is_not_scalar()
#endif
}
+class incomplete_type;
+
class Empty
{
};
@@ -73,9 +75,9 @@ typedef void (*FunctionPtr)();
int main()
{
-// Arithmetic types (3.9.1), enumeration types, pointer types, pointer to member types (3.9.2),
-// std::nullptr_t, and cv-qualified versions of these types (3.9.3)
-// are collectively called scalar types.
+// Arithmetic types (3.9.1), enumeration types, pointer types, pointer to member types (3.9.2),
+// std::nullptr_t, and cv-qualified versions of these types (3.9.3)
+// are collectively called scalar types.
test_is_scalar<std::nullptr_t>();
test_is_scalar<short>();
@@ -104,6 +106,7 @@ int main()
test_is_not_scalar<char[]>();
test_is_not_scalar<Union>();
test_is_not_scalar<Empty>();
+ test_is_not_scalar<incomplete_type>();
test_is_not_scalar<bit_zero>();
test_is_not_scalar<NotEmpty>();
test_is_not_scalar<Abstract>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
index 36020139ec58..7330f4b35125 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
@@ -13,6 +13,8 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
void test_has_virtual_destructor()
{
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
index c0f6bb9bdfaf..b734a1aa60d8 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
@@ -77,7 +77,7 @@ int main()
test_is_not_assignable<void, const void> ();
test_is_not_assignable<const void, const void> ();
test_is_not_assignable<int(), int> ();
-
+
// pointer to incomplete template type
test_is_assignable<X<D>*&, X<D>*> ();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
index 7f63ae40aca7..616f25180a60 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
@@ -29,6 +29,8 @@ void test_is_const()
#endif
}
+struct A; // incomplete
+
int main()
{
test_is_const<void>();
@@ -39,6 +41,8 @@ int main()
test_is_const<char[3]>();
test_is_const<char[]>();
+ test_is_const<A>();
+
static_assert(!std::is_const<int&>::value, "");
static_assert(!std::is_const<const int&>::value, "");
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
index 5401d95532b1..9f8fdc7fc635 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
// type_traits
+// XFAIL: apple-clang-6.0
+// The Apple-6 compiler gets is_constructible<void ()> wrong.
// template <class T, class... Args>
// struct is_constructible;
@@ -19,7 +21,7 @@ struct A
{
explicit A(int);
A(int, double);
-#if __has_feature(cxx_access_control_sfinae)
+#if TEST_STD_VER >= 11
private:
#endif
A(char);
@@ -89,7 +91,7 @@ int main()
test_is_constructible<int&, int&> ();
test_is_not_constructible<A> ();
-#if __has_feature(cxx_access_control_sfinae)
+#if TEST_STD_VER >= 11
test_is_not_constructible<A, char> ();
#else
test_is_constructible<A, char> ();
@@ -99,4 +101,13 @@ int main()
test_is_not_constructible<int&> ();
test_is_not_constructible<Abstract> ();
test_is_not_constructible<AbstractDestructor> ();
+
+// LWG 2560 -- postpone this test until bots updated
+// test_is_not_constructible<void()> ();
+#if TEST_STD_VER > 11
+// test_is_not_constructible<void() const> ();
+// test_is_not_constructible<void() volatile> ();
+// test_is_not_constructible<void() &> ();
+// test_is_not_constructible<void() &&> ();
+#endif
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
index 421f865a623c..ac8b80bbd3a4 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
@@ -79,7 +79,7 @@ int main()
test_is_not_copy_assignable<int[]> ();
test_is_not_copy_assignable<int[3]> ();
#endif
-#if __has_feature(cxx_access_control_sfinae)
+#if TEST_STD_VER >= 11
test_is_not_copy_assignable<B> ();
#endif
test_is_not_copy_assignable<void> ();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp
index fe2e01429b22..684d85d3d40c 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp
@@ -89,7 +89,7 @@ int main()
test_is_not_copy_constructible<void>();
test_is_not_copy_constructible<Abstract>();
test_is_not_copy_constructible<C>();
-#if __has_feature(cxx_access_control_sfinae)
+#if TEST_STD_VER >= 11
test_is_not_copy_constructible<B>();
#endif
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
index 7b46eeaab66b..318147e5d4a3 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
@@ -100,7 +100,7 @@ int main()
test_is_not_default_constructible<char[]>();
test_is_not_default_constructible<Abstract>();
test_is_not_default_constructible<NoDefaultConstructor>();
-#if __has_feature(cxx_access_control_sfinae)
+#if TEST_STD_VER >= 11
test_is_not_default_constructible<B>();
#endif
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp
index 60d607aba61c..5e8bfeaa41d2 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp
@@ -11,9 +11,15 @@
// is_destructible
+// Prevent warning when testing the Abstract test type.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
+#endif
+
#include <type_traits>
#include "test_macros.h"
+
template <class T>
void test_is_destructible()
{
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp
index baf85e3e8139..5a440598bb02 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// type_traits
// is_final
@@ -14,8 +15,6 @@
#include <type_traits>
#include "test_macros.h"
-#if _LIBCPP_STD_VER > 11
-
struct P final { };
union U1 { };
union U2 final { };
@@ -54,13 +53,10 @@ int main ()
{
test_is_not_final<int>();
test_is_not_final<int*>();
- test_is_final <P>();
- test_is_not_final<P*>();
+ test_is_final <P>();
+ test_is_not_final<P*>();
test_is_not_final<U1>();
test_is_not_final<U1*>();
- test_is_final <U2>();
- test_is_not_final<U2*>();
+ test_is_final <U2>();
+ test_is_not_final<U2*>();
}
-#else
-int main () {}
-#endif
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
index c778a5d24b2e..8200b468fe3a 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
@@ -107,7 +107,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test_is_nothrow_constructible<Tuple &&, Empty> (); // See bug #19616.
#endif
-
+
test_is_not_nothrow_constructible<A, int> ();
test_is_not_nothrow_constructible<A, int, double> ();
test_is_not_nothrow_constructible<A> ();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
index 42c9807efa83..58e0e0f98b58 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
@@ -11,6 +11,11 @@
// is_nothrow_destructible
+// Prevent warning when testing the Abstract test type.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
+#endif
+
#include <type_traits>
#include "test_macros.h"
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp
new file mode 100644
index 000000000000..7510b4e7293c
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// type_traits
+
+// is_swappable
+
+#include <type_traits>
+#include <vector>
+#include "test_macros.h"
+
+namespace MyNS {
+
+// Make the test types non-copyable so that generic std::swap is not valid.
+struct A {
+ A(A const&) = delete;
+ A& operator=(A const&) = delete;
+};
+
+struct B {
+ B(B const&) = delete;
+ B& operator=(B const&) = delete;
+};
+
+void swap(A&, A&) noexcept {}
+void swap(B&, B&) {}
+
+struct M {
+ M(M const&) = delete;
+ M& operator=(M const&) = delete;
+};
+
+void swap(M&&, M&&) noexcept {}
+
+struct ThrowingMove {
+ ThrowingMove(ThrowingMove&&) {}
+ ThrowingMove& operator=(ThrowingMove&&) { return *this; }
+};
+
+} // namespace MyNS
+
+int main()
+{
+ using namespace MyNS;
+ {
+ // Test that is_swappable applies an lvalue reference to the type.
+ static_assert(std::is_nothrow_swappable<int>::value, "");
+ static_assert(std::is_nothrow_swappable<int&>::value, "");
+ static_assert(!std::is_nothrow_swappable<M>::value, "");
+ static_assert(!std::is_nothrow_swappable<M&&>::value, "");
+ }
+ {
+ // Test that it correctly deduces the noexcept of swap.
+ static_assert(std::is_nothrow_swappable<A>::value, "");
+ static_assert(!std::is_nothrow_swappable<B>::value
+ && std::is_swappable<B>::value, "");
+ static_assert(!std::is_nothrow_swappable<ThrowingMove>::value
+ && std::is_swappable<ThrowingMove>::value, "");
+ }
+ {
+ // Test that it doesn't drop the qualifiers
+ static_assert(!std::is_nothrow_swappable<const A>::value, "");
+ }
+ {
+ // test non-referenceable types
+ static_assert(!std::is_nothrow_swappable<void>::value, "");
+ static_assert(!std::is_nothrow_swappable<int() const>::value, "");
+ static_assert(!std::is_nothrow_swappable<int(int, ...) const &>::value, "");
+ }
+ {
+ // test for presence of is_nothrow_swappable_v
+ static_assert(std::is_nothrow_swappable_v<int>, "");
+ static_assert(!std::is_nothrow_swappable_v<void>, "");
+ }
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp
new file mode 100644
index 000000000000..408231f6057f
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// type_traits
+
+// is_nothrow_swappable_with
+
+#include <type_traits>
+#include <vector>
+#include "test_macros.h"
+
+namespace MyNS {
+
+struct A {
+ A(A const&) = delete;
+ A& operator=(A const&) = delete;
+};
+
+struct B {
+ B(B const&) = delete;
+ B& operator=(B const&) = delete;
+};
+
+struct C {};
+struct D {};
+
+void swap(A&, A&) {}
+
+void swap(A&, B&) noexcept {}
+void swap(B&, A&) noexcept {}
+
+void swap(A&, C&) noexcept {}
+void swap(C&, A&) {}
+
+struct M {};
+
+void swap(M&&, M&&) noexcept {}
+
+} // namespace MyNS
+
+int main()
+{
+ using namespace MyNS;
+ {
+ // Test that is_swappable_with doesn't apply an lvalue reference
+ // to the type. Instead it is up to the user.
+ static_assert(!std::is_nothrow_swappable_with<int, int>::value, "");
+ static_assert(std::is_nothrow_swappable_with<int&, int&>::value, "");
+ static_assert(std::is_nothrow_swappable_with<M, M>::value, "");
+ static_assert(std::is_swappable_with<A&, A&>::value &&
+ !std::is_nothrow_swappable_with<A&, A&>::value, "");
+ }
+ {
+ // test that hetrogenius swap is allowed only if both 'swap(A, B)' and
+ // 'swap(B, A)' are valid.
+ static_assert(std::is_nothrow_swappable_with<A&, B&>::value, "");
+ static_assert(!std::is_nothrow_swappable_with<A&, C&>::value &&
+ std::is_swappable_with<A&, C&>::value, "");
+ static_assert(!std::is_nothrow_swappable_with<D&, C&>::value, "");
+ }
+ {
+ // test we guard against cv void inputs as required.
+ static_assert(!std::is_nothrow_swappable_with_v<void, int>, "");
+ static_assert(!std::is_nothrow_swappable_with_v<int, void>, "");
+ static_assert(!std::is_nothrow_swappable_with_v<const void, const volatile void>, "");
+
+ }
+ {
+ // test for presence of is_nothrow_swappable_with_v
+ static_assert(std::is_nothrow_swappable_with_v<int&, int&>, "");
+ static_assert(!std::is_nothrow_swappable_with_v<int&&, int&&>, "");
+ }
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
index b66e7a296f39..6ce1c0377526 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
@@ -65,7 +65,7 @@ class Abstract
virtual ~Abstract() = 0;
};
-#if __has_feature(cxx_attributes)
+#if TEST_STD_VER >= 11
class Final final {
};
#else
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
index 94bf7fb58041..745efd00895c 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
@@ -50,6 +50,8 @@ public:
~Class();
};
+struct A; // incomplete
+
int main()
{
test_is_not_signed<void>();
@@ -61,6 +63,7 @@ int main()
test_is_not_signed<char[]>();
test_is_not_signed<bool>();
test_is_not_signed<unsigned>();
+ test_is_not_signed<A>();
test_is_signed<int>();
test_is_signed<double>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp
new file mode 100644
index 000000000000..b17ca76fd586
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// type_traits
+
+// is_swappable
+
+#include <type_traits>
+#include <utility>
+#include <vector>
+#include "test_macros.h"
+
+namespace MyNS {
+
+// Make the test types non-copyable so that generic std::swap is not valid.
+struct A {
+ A(A const&) = delete;
+ A& operator=(A const&) = delete;
+};
+
+struct B {
+ B(B const&) = delete;
+ B& operator=(B const&) = delete;
+};
+
+struct C {};
+struct D {};
+
+void swap(A&, A&) {}
+
+void swap(A&, B&) {}
+void swap(B&, A&) {}
+
+void swap(A&, C&) {} // missing swap(C, A)
+void swap(D&, C&) {}
+
+struct M {
+ M(M const&) = delete;
+ M& operator=(M const&) = delete;
+};
+
+void swap(M&&, M&&) {}
+
+struct DeletedSwap {
+ friend void swap(DeletedSwap&, DeletedSwap&) = delete;
+};
+
+} // namespace MyNS
+
+namespace MyNS2 {
+
+struct AmbiguousSwap {};
+
+template <class T>
+void swap(T&, T&) {}
+
+} // end namespace MyNS2
+
+int main()
+{
+ using namespace MyNS;
+ {
+ // Test that is_swappable applies an lvalue reference to the type.
+ static_assert(std::is_swappable<A>::value, "");
+ static_assert(std::is_swappable<A&>::value, "");
+ static_assert(!std::is_swappable<M>::value, "");
+ static_assert(!std::is_swappable<M&&>::value, "");
+ }
+ static_assert(!std::is_swappable<B>::value, "");
+ static_assert(std::is_swappable<C>::value, "");
+ {
+ // test non-referencable types
+ static_assert(!std::is_swappable<void>::value, "");
+ static_assert(!std::is_swappable<int() const>::value, "");
+ static_assert(!std::is_swappable<int() &>::value, "");
+ }
+ {
+ // test that a deleted swap is correctly handled.
+ static_assert(!std::is_swappable<DeletedSwap>::value, "");
+ }
+ {
+ // test that a swap with ambiguous overloads is handled correctly.
+ static_assert(!std::is_swappable<MyNS2::AmbiguousSwap>::value, "");
+ }
+ {
+ // test for presence of is_swappable_v
+ static_assert(std::is_swappable_v<int>, "");
+ static_assert(!std::is_swappable_v<M>, "");
+ }
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp
new file mode 100644
index 000000000000..c3ae1706f095
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_swappable
+
+// IMPORTANT: The include order is part of the test. We want to pick up
+// the following definitions in this order:
+// 1) is_swappable, is_nothrow_swappable
+// 2) iter_swap, swap_ranges
+// 3) swap(T (&)[N], T (&)[N])
+// This test checks that (1) and (2) see forward declarations
+// for (3).
+#include <type_traits>
+#include <algorithm>
+#include <utility>
+
+#include "test_macros.h"
+
+int main()
+{
+ // Use a builtin type so we don't get ADL lookup.
+ typedef double T[17][29];
+ {
+ LIBCPP_STATIC_ASSERT(std::__is_swappable<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(std::is_swappable_v<T>, "");
+#endif
+ }
+ {
+ T t1 = {};
+ T t2 = {};
+ std::iter_swap(t1, t2);
+ std::swap_ranges(t1, t1 + 17, t2);
+ }
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_with.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_with.pass.cpp
new file mode 100644
index 000000000000..a049eab9a192
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_with.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// type_traits
+
+// is_swappable_with
+
+#include <type_traits>
+#include <vector>
+#include "test_macros.h"
+
+namespace MyNS {
+
+struct A {
+ A(A const&) = delete;
+ A& operator=(A const&) = delete;
+};
+
+struct B {
+ B(B const&) = delete;
+ B& operator=(B const&) = delete;
+};
+
+struct C {};
+struct D {};
+
+void swap(A&, A&) {}
+
+void swap(A&, B&) {}
+void swap(B&, A&) {}
+
+void swap(A&, C&) {} // missing swap(C, A)
+void swap(D&, C&) {}
+
+struct M {};
+
+void swap(M&&, M&&) {}
+
+} // namespace MyNS
+
+int main()
+{
+ using namespace MyNS;
+ {
+ // Test that is_swappable_with doesn't apply an lvalue reference
+ // to the type. Instead it is up to the user.
+ static_assert(!std::is_swappable_with<int, int>::value, "");
+ static_assert(std::is_swappable_with<int&, int&>::value, "");
+ static_assert(std::is_swappable_with<M, M>::value, "");
+ static_assert(std::is_swappable_with<A&, A&>::value, "");
+ }
+ {
+ // test that heterogeneous swap is allowed only if both 'swap(A, B)' and
+ // 'swap(B, A)' are valid.
+ static_assert(std::is_swappable_with<A&, B&>::value, "");
+ static_assert(!std::is_swappable_with<A&, C&>::value, "");
+ static_assert(!std::is_swappable_with<D&, C&>::value, "");
+ }
+ {
+ // test that cv void is guarded against as required.
+ static_assert(!std::is_swappable_with_v<void, int>, "");
+ static_assert(!std::is_swappable_with_v<int, void>, "");
+ static_assert(!std::is_swappable_with_v<const void, const volatile void>, "");
+ }
+ {
+ // test for presence of is_swappable_with_v
+ static_assert(std::is_swappable_with_v<int&, int&>, "");
+ static_assert(!std::is_swappable_with_v<D&, C&>, "");
+ }
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp
index 3ebb9dba429d..a9b538b2dffc 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp
@@ -11,6 +11,8 @@
// is_trivially_assignable
+// XFAIL: gcc-4.9
+
#include <type_traits>
#include "test_macros.h"
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp
index 25429f5470e7..966573c9f0fe 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp
@@ -11,6 +11,8 @@
// is_trivially_copy_assignable
+// XFAIL: gcc-4.9
+
#include <type_traits>
#include "test_macros.h"
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp
index 9556959e1262..2922f2276669 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp
@@ -11,6 +11,8 @@
// is_trivially_copy_constructible
+// XFAIL: gcc-4.9
+
#include <type_traits>
#include "test_macros.h"
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp
index c19a29ffb586..42ecdb3b896a 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp
@@ -11,6 +11,8 @@
// is_trivially_copyable
+// XFAIL: gcc-4.9
+
#include <type_traits>
#include <cassert>
#include "test_macros.h"
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
index 9e2507067d2d..3372e615d71d 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
@@ -11,6 +11,11 @@
// is_trivially_destructible
+// Prevent warning when testing the Abstract test type.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
+#endif
+
#include <type_traits>
#include "test_macros.h"
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp
index eca596ee1c19..9a27c73cdfd8 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp
@@ -11,6 +11,8 @@
// is_trivially_move_assignable
+// XFAIL: gcc-4.9
+
#include <type_traits>
#include "test_macros.h"
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp
index 313da175f715..941ff31f89da 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp
@@ -11,6 +11,8 @@
// is_trivially_move_constructible
+// XFAIL: gcc-4.9
+
#include <type_traits>
#include "test_macros.h"
@@ -60,7 +62,7 @@ struct A
A(const A&);
};
-#if __has_feature(cxx_defaulted_functions)
+#if TEST_STD_VER >= 11
struct MoveOnly1
{
@@ -89,7 +91,7 @@ int main()
test_is_trivially_move_constructible<const int*>();
test_is_trivially_move_constructible<bit_zero>();
-#if __has_feature(cxx_defaulted_functions)
+#if TEST_STD_VER >= 11
static_assert(!std::is_trivially_move_constructible<MoveOnly1>::value, "");
static_assert( std::is_trivially_move_constructible<MoveOnly2>::value, "");
#endif
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
index 9ca42432df16..376c7e005ce9 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
@@ -50,6 +50,8 @@ public:
~Class();
};
+struct A; // incomplete
+
int main()
{
test_is_not_unsigned<void>();
@@ -61,6 +63,7 @@ int main()
test_is_not_unsigned<char[]>();
test_is_not_unsigned<int>();
test_is_not_unsigned<double>();
+ test_is_not_unsigned<A>();
test_is_unsigned<bool>();
test_is_unsigned<unsigned>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
index 36697a3f3eba..cc8d66ae6888 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
@@ -29,6 +29,8 @@ void test_is_volatile()
#endif
}
+struct A; // incomplete
+
int main()
{
test_is_volatile<void>();
@@ -39,6 +41,8 @@ int main()
test_is_volatile<char[3]>();
test_is_volatile<char[]>();
+ test_is_volatile<A>();
+
static_assert(!std::is_volatile<int&>::value, "");
static_assert(!std::is_volatile<volatile int&>::value, "");
}
diff --git a/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp b/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
index 9411435e29e8..ab623bb01f78 100644
--- a/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// template <class charT>
// explicit bitset(const charT* str,
// typename basic_string<charT>::size_type n = basic_string<charT>::npos,
@@ -18,20 +17,19 @@
#include <algorithm> // for 'min' and 'max'
#include <stdexcept> // for 'invalid_argument'
-#pragma clang diagnostic ignored "-Wtautological-compare"
+#include "test_macros.h"
template <std::size_t N>
void test_char_pointer_ctor()
{
{
- try
- {
- std::bitset<N> v("xxx1010101010xxxx");
- assert(false);
- }
- catch (std::invalid_argument&)
- {
- }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ std::bitset<N> v("xxx1010101010xxxx");
+ assert(false);
+ }
+ catch (std::invalid_argument&) {}
+#endif
}
{
diff --git a/test/std/utilities/template.bitset/bitset.cons/default.pass.cpp b/test/std/utilities/template.bitset/bitset.cons/default.pass.cpp
index bd5ca7e08b2a..f4f8d390de08 100644
--- a/test/std/utilities/template.bitset/bitset.cons/default.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.cons/default.pass.cpp
@@ -12,19 +12,26 @@
#include <bitset>
#include <cassert>
-#pragma clang diagnostic ignored "-Wtautological-compare"
+#include "test_macros.h"
template <std::size_t N>
void test_default_ctor()
{
{
- _LIBCPP_CONSTEXPR std::bitset<N> v1;
- assert(v1.size() == N);
- for (std::size_t i = 0; i < N; ++i)
- assert(v1[i] == false);
+ TEST_CONSTEXPR std::bitset<N> v1;
+ assert(v1.size() == N);
+ for (std::size_t i = 0; i < N; ++i)
+ assert(v1[i] == false);
}
+#if TEST_STD_VER >= 11
+ {
+ constexpr std::bitset<N> v1;
+ static_assert(v1.size() == N, "");
+ }
+#endif
}
+
int main()
{
test_default_ctor<0>();
diff --git a/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp b/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
index b08720f57ee3..0e4793027c98 100644
--- a/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// test bitset(string, pos, n, zero, one);
#include <bitset>
@@ -15,65 +14,60 @@
#include <algorithm> // for 'min' and 'max'
#include <stdexcept> // for 'invalid_argument'
-#pragma clang diagnostic ignored "-Wtautological-compare"
+#include "test_macros.h"
template <std::size_t N>
void test_string_ctor()
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
- try
- {
- std::string str("xxx1010101010xxxx");
- std::bitset<N> v(str, str.size()+1, 10);
- assert(false);
- }
- catch (std::out_of_range&)
- {
- }
+ try {
+ std::string str("xxx1010101010xxxx");
+ std::bitset<N> v(str, str.size()+1, 10);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ }
}
-
- {
- try
{
- std::string str("xxx1010101010xxxx");
- std::bitset<N> v(str, 2, 10);
- assert(false);
+ try {
+ std::string str("xxx1010101010xxxx");
+ std::bitset<N> v(str, 2, 10);
+ assert(false);
+ }
+ catch (std::invalid_argument&)
+ {
+ }
}
- catch (std::invalid_argument&)
{
+ try {
+ std::string str("xxxbababababaxxxx");
+ std::bitset<N> v(str, 2, 10, 'a', 'b');
+ assert(false);
+ }
+ catch (std::invalid_argument&)
+ {
+ }
}
- }
-
+#endif // TEST_HAS_NO_EXCEPTIONS
{
- std::string str("xxx1010101010xxxx");
- std::bitset<N> v(str, 3, 10);
- std::size_t M = std::min<std::size_t>(N, 10);
- for (std::size_t i = 0; i < M; ++i)
- assert(v[i] == (str[3 + M - 1 - i] == '1'));
- for (std::size_t i = 10; i < N; ++i)
- assert(v[i] == false);
+ std::string str("xxx1010101010xxxx");
+ std::bitset<N> v(str, 3, 10);
+ std::size_t M = std::min<std::size_t>(N, 10);
+ for (std::size_t i = 0; i < M; ++i)
+ assert(v[i] == (str[3 + M - 1 - i] == '1'));
+ for (std::size_t i = 10; i < N; ++i)
+ assert(v[i] == false);
}
-
- {
- try
{
std::string str("xxxbababababaxxxx");
- std::bitset<N> v(str, 2, 10, 'a', 'b');
- assert(false);
- }
- catch (std::invalid_argument&)
- {
- }
- }
-
- {
- std::string str("xxxbababababaxxxx");
- std::bitset<N> v(str, 3, 10, 'a', 'b');
- std::size_t M = std::min<std::size_t>(N, 10);
- for (std::size_t i = 0; i < M; ++i)
- assert(v[i] == (str[3 + M - 1 - i] == 'b'));
- for (std::size_t i = 10; i < N; ++i)
- assert(v[i] == false);
+ std::bitset<N> v(str, 3, 10, 'a', 'b');
+ std::size_t M = std::min<std::size_t>(N, 10);
+ for (std::size_t i = 0; i < M; ++i)
+ assert(v[i] == (str[3 + M - 1 - i] == 'b'));
+ for (std::size_t i = 10; i < N; ++i)
+ assert(v[i] == false);
}
}
diff --git a/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp b/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
index f232447e08c3..1b121c5fb928 100644
--- a/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
@@ -13,20 +13,26 @@
#include <cassert>
#include <algorithm> // for 'min' and 'max'
-#pragma clang diagnostic ignored "-Wtautological-compare"
+#include "test_macros.h"
template <std::size_t N>
void test_val_ctor()
{
{
- _LIBCPP_CONSTEXPR std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
- assert(v.size() == N);
- unsigned M = std::min<std::size_t>(N, 64);
- for (std::size_t i = 0; i < M; ++i)
- assert(v[i] == (i & 1));
- for (std::size_t i = M; i < N; ++i)
- assert(v[i] == false);
+ TEST_CONSTEXPR std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
+ assert(v.size() == N);
+ unsigned M = std::min<std::size_t>(N, 64);
+ for (std::size_t i = 0; i < M; ++i)
+ assert(v[i] == (i & 1));
+ for (std::size_t i = M; i < N; ++i)
+ assert(v[i] == false);
}
+#if TEST_STD_VER >= 11
+ {
+ constexpr std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
+ static_assert(v.size() == N, "");
+ }
+#endif
}
int main()
diff --git a/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp b/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
index 520f2e8757c2..bc65078911b2 100644
--- a/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
@@ -16,12 +16,12 @@
// size_t operator()(T val) const;
// };
-// Not very portable
-
#include <bitset>
#include <cassert>
#include <type_traits>
+#include "test_macros.h"
+
template <std::size_t N>
void
test()
@@ -32,7 +32,9 @@ test()
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
T bs(static_cast<unsigned long long>(N));
- assert(h(bs) == N);
+ const std::size_t result = h(bs);
+ LIBCPP_ASSERT(result == N);
+ ((void)result); // Prevent unused warning
}
int main()
diff --git a/test/std/utilities/template.bitset/bitset.members/count.pass.cpp b/test/std/utilities/template.bitset/bitset.members/count.pass.cpp
index fb9ce6422997..c8a14c9b6049 100644
--- a/test/std/utilities/template.bitset/bitset.members/count.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/count.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/flip_all.pass.cpp b/test/std/utilities/template.bitset/bitset.members/flip_all.pass.cpp
index 6c4f5c699850..a25e5bd9da22 100644
--- a/test/std/utilities/template.bitset/bitset.members/flip_all.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/flip_all.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp b/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
index cffca68fb1ea..88ce8e943caf 100644
--- a/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
@@ -14,8 +14,6 @@
#include <cstdlib>
#include <cassert>
-#pragma clang diagnostic ignored "-Wtautological-compare"
-
template <std::size_t N>
std::bitset<N>
make_bitset()
diff --git a/test/std/utilities/template.bitset/bitset.members/index.pass.cpp b/test/std/utilities/template.bitset/bitset.members/index.pass.cpp
index b96aaa51ab8f..02e58a7890c5 100644
--- a/test/std/utilities/template.bitset/bitset.members/index.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/index.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp b/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp
index e3c28c693576..870a504c2d75 100644
--- a/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/left_shift.pass.cpp b/test/std/utilities/template.bitset/bitset.members/left_shift.pass.cpp
index 7fe9fa72e924..57b77d2570d5 100644
--- a/test/std/utilities/template.bitset/bitset.members/left_shift.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/left_shift.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp b/test/std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp
index bed3e28ece81..3adab77b4131 100644
--- a/test/std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/not_all.pass.cpp b/test/std/utilities/template.bitset/bitset.members/not_all.pass.cpp
index 2f8f7111f5a1..d9fbb3e11dad 100644
--- a/test/std/utilities/template.bitset/bitset.members/not_all.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/not_all.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp b/test/std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp
index b599ec398b30..64ca15fda137 100644
--- a/test/std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp b/test/std/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp
index 5f6cf3d0a30c..24761c628c03 100644
--- a/test/std/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp
@@ -16,7 +16,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp b/test/std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp
index 6e63879890a6..f2880f67ab6e 100644
--- a/test/std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp b/test/std/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp
index e68a641cadc6..420996759d0d 100644
--- a/test/std/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/reset_all.pass.cpp b/test/std/utilities/template.bitset/bitset.members/reset_all.pass.cpp
index ee44d92c43b8..eed25e27448d 100644
--- a/test/std/utilities/template.bitset/bitset.members/reset_all.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/reset_all.pass.cpp
@@ -12,7 +12,9 @@
#include <bitset>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
void test_reset_all()
diff --git a/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp b/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
index 6de256b00cc5..f01d35b9a33c 100644
--- a/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
@@ -13,9 +13,6 @@
#include <bitset>
#include <cassert>
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wtautological-compare"
-
template <std::size_t N>
void test_reset_one()
{
diff --git a/test/std/utilities/template.bitset/bitset.members/right_shift.pass.cpp b/test/std/utilities/template.bitset/bitset.members/right_shift.pass.cpp
index 87fcc281fa26..180fa84f4488 100644
--- a/test/std/utilities/template.bitset/bitset.members/right_shift.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/right_shift.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp b/test/std/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp
index 1dd89c1844b9..47494fc459a5 100644
--- a/test/std/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.members/set_all.pass.cpp b/test/std/utilities/template.bitset/bitset.members/set_all.pass.cpp
index 56454a84f113..e5c3e25352cc 100644
--- a/test/std/utilities/template.bitset/bitset.members/set_all.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/set_all.pass.cpp
@@ -12,7 +12,9 @@
#include <bitset>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
void test_set_all()
diff --git a/test/std/utilities/template.bitset/bitset.members/test.pass.cpp b/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
index ce594d0ae891..161afd11c291 100644
--- a/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
@@ -14,8 +14,6 @@
#include <cstdlib>
#include <cassert>
-#pragma clang diagnostic ignored "-Wtautological-compare"
-
template <std::size_t N>
std::bitset<N>
make_bitset()
diff --git a/test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp b/test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp
index b65794097470..5b2958cca523 100644
--- a/test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp
@@ -26,7 +26,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp b/test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
index 751cee69102a..80792d919ccf 100644
--- a/test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp b/test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
index fda5e5cda8ee..65a7004acb86 100644
--- a/test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp b/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
index 067f868215be..dcabaa4a9a4d 100644
--- a/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
@@ -13,7 +13,9 @@
#include <cstdlib>
#include <cassert>
+#if defined(__clang__)
#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
template <std::size_t N>
std::bitset<N>
diff --git a/test/std/utilities/time/date.time/ctime.pass.cpp b/test/std/utilities/time/date.time/ctime.pass.cpp
index d0a838e0c271..b9e19af32952 100644
--- a/test/std/utilities/time/date.time/ctime.pass.cpp
+++ b/test/std/utilities/time/date.time/ctime.pass.cpp
@@ -21,11 +21,15 @@
int main()
{
std::clock_t c = 0;
- ((void)c); // avoid unused warning
std::size_t s = 0;
std::time_t t = 0;
- std::tm tm = {0};
+ std::tm tm = {};
char str[3];
+ ((void)c); // Prevent unused warning
+ ((void)s); // Prevent unused warning
+ ((void)t); // Prevent unused warning
+ ((void)tm); // Prevent unused warning
+ ((void)str); // Prevent unused warning
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), "");
diff --git a/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
index 2e3acbc52b11..b6b3aeea94f8 100644
--- a/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
@@ -12,6 +12,10 @@
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
+// Due to C++17 inline variables ASAN flags this test as containing an ODR
+// violation because Clock::is_steady is defined in both the dylib and this TU.
+// UNSUPPORTED: asan
+
// <chrono>
// high_resolution_clock
diff --git a/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
index 0e0b83b2f244..6302ce6efb34 100644
--- a/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
@@ -13,6 +13,10 @@
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
// UNSUPPORTED: libcpp-has-no-monotonic-clock
+// Due to C++17 inline variables ASAN flags this test as containing an ODR
+// violation because Clock::is_steady is defined in both the dylib and this TU.
+// UNSUPPORTED: asan
+
// <chrono>
// steady_clock
diff --git a/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
index e277d4e67dc7..cfbe9bd57032 100644
--- a/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
@@ -12,6 +12,10 @@
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
+// Due to C++17 inline variables ASAN flags this test as containing an ODR
+// violation because Clock::is_steady is defined in both the dylib and this TU.
+// UNSUPPORTED: asan
+
// <chrono>
// system_clock
diff --git a/test/std/utilities/time/time.duration/time.duration.alg/abs.pass.cpp b/test/std/utilities/time/time.duration/time.duration.alg/abs.pass.cpp
index ec32c37a9423..30ea029b7ef4 100644
--- a/test/std/utilities/time/time.duration/time.duration.alg/abs.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.alg/abs.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <chrono>
diff --git a/test/std/utilities/time/time.duration/time.duration.cast/ceil.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cast/ceil.pass.cpp
index 6fb73b97db17..8d7623c85e19 100644
--- a/test/std/utilities/time/time.duration/time.duration.cast/ceil.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.cast/ceil.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <chrono>
diff --git a/test/std/utilities/time/time.duration/time.duration.cast/floor.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cast/floor.pass.cpp
index 57929dd91228..38db42a84ced 100644
--- a/test/std/utilities/time/time.duration/time.duration.cast/floor.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.cast/floor.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <chrono>
// floor
diff --git a/test/std/utilities/time/time.duration/time.duration.cast/round.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cast/round.pass.cpp
index e50b85c991a2..2f9689007dfd 100644
--- a/test/std/utilities/time/time.duration/time.duration.cast/round.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.cast/round.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <chrono>
// round
diff --git a/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp b/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp
index 48324ae83651..d5c0207c0ee7 100644
--- a/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <chrono>
#include <chrono>
@@ -15,7 +16,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std::literals::chrono_literals;
// Make sure the types are right
@@ -25,12 +25,12 @@ int main()
static_assert ( std::is_same<decltype( 3ms ), std::chrono::milliseconds>::value, "" );
static_assert ( std::is_same<decltype( 3us ), std::chrono::microseconds>::value, "" );
static_assert ( std::is_same<decltype( 3ns ), std::chrono::nanoseconds>::value, "" );
-
+
std::chrono::hours h = 4h;
assert ( h == std::chrono::hours(4));
auto h2 = 4.0h;
assert ( h == h2 );
-
+
std::chrono::minutes min = 36min;
assert ( min == std::chrono::minutes(36));
auto min2 = 36.0min;
@@ -55,5 +55,4 @@ int main()
assert ( ns == std::chrono::nanoseconds(645));
auto ns2 = 645.ns;
assert ( ns == ns2 );
-#endif
}
diff --git a/test/std/utilities/time/time.duration/time.duration.literals/literals1.fail.cpp b/test/std/utilities/time/time.duration/time.duration.literals/literals1.fail.cpp
index 46aaa30e51e4..52208cb54d6d 100644
--- a/test/std/utilities/time/time.duration/time.duration.literals/literals1.fail.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.literals/literals1.fail.cpp
@@ -7,15 +7,13 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
#include <chrono>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
std::chrono::hours h = 4h; // should fail w/conversion operator not found
-#else
-#error
-#endif
}
diff --git a/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp b/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp
index 574f9bcce874..5e59e1153787 100644
--- a/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp
@@ -7,19 +7,20 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
#include <chrono>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std::chrono;
hours h = 4h;
assert ( h == hours(4));
auto h2 = 4.0h;
assert ( h == h2 );
-
+
minutes min = 36min;
assert ( min == minutes(36));
auto min2 = 36.0min;
@@ -44,5 +45,4 @@ int main()
assert ( ns == nanoseconds(645));
auto ns2 = 645.ns;
assert ( ns == ns2 );
-#endif
}
diff --git a/test/std/utilities/time/time.duration/time.duration.literals/literals2.fail.cpp b/test/std/utilities/time/time.duration/time.duration.literals/literals2.fail.cpp
index 17358e589f4f..f190d7863066 100644
--- a/test/std/utilities/time/time.duration/time.duration.literals/literals2.fail.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.literals/literals2.fail.cpp
@@ -7,16 +7,14 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
#include <chrono>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
using std::chrono::hours;
hours foo = 4h; // should fail w/conversion operator not found
-#else
-#error
-#endif
}
diff --git a/test/std/utilities/time/time.duration/time.duration.literals/literals2.pass.cpp b/test/std/utilities/time/time.duration/time.duration.literals/literals2.pass.cpp
index e37bc6e67961..282b1c6572e2 100644
--- a/test/std/utilities/time/time.duration/time.duration.literals/literals2.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.literals/literals2.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// <chrono>
#include <chrono>
@@ -15,14 +16,13 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
using namespace std::literals;
std::chrono::hours h = 4h;
assert ( h == std::chrono::hours(4));
auto h2 = 4.0h;
assert ( h == h2 );
-
+
std::chrono::minutes min = 36min;
assert ( min == std::chrono::minutes(36));
auto min2 = 36.0min;
@@ -47,5 +47,4 @@ int main()
assert ( ns == std::chrono::nanoseconds(645));
auto ns2 = 645.ns;
assert ( ns == ns2 );
-#endif
}
diff --git a/test/std/utilities/time/time.point/time.point.cast/ceil.pass.cpp b/test/std/utilities/time/time.point/time.point.cast/ceil.pass.cpp
index 379929c7f2d8..e6e7c053885a 100644
--- a/test/std/utilities/time/time.point/time.point.cast/ceil.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.cast/ceil.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <chrono>
// ceil
diff --git a/test/std/utilities/time/time.point/time.point.cast/floor.pass.cpp b/test/std/utilities/time/time.point/time.point.cast/floor.pass.cpp
index d0a908fa932a..efd2d9e25cd7 100644
--- a/test/std/utilities/time/time.point/time.point.cast/floor.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.cast/floor.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <chrono>
// floor
diff --git a/test/std/utilities/time/time.point/time.point.cast/round.pass.cpp b/test/std/utilities/time/time.point/time.point.cast/round.pass.cpp
index ab8bf3a75e79..b5d16cf11d98 100644
--- a/test/std/utilities/time/time.point/time.point.cast/round.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.cast/round.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <chrono>
// round
diff --git a/test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp b/test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp
index fbd3a1386d35..a37bb266a0a9 100644
--- a/test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp
@@ -54,7 +54,7 @@ int main()
assert(!(t1 == t2));
assert( (t1 != t2));
}
-
+
#if _LIBCPP_STD_VER > 11
{
constexpr T1 t1(Duration1(3));
diff --git a/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp b/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp
index f9ddc87a7a14..faacb573d74b 100644
--- a/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp
+++ b/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp
@@ -14,6 +14,8 @@
#include <chrono>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
void
test()
@@ -21,8 +23,8 @@ test()
static_assert((std::is_base_of<std::is_floating_point<T>,
std::chrono::treat_as_floating_point<T> >::value), "");
#if TEST_STD_VER > 14
- static_assert((std::is_base_of<std::is_floating_point<T>,
- std::chrono::treat_as_floating_point_v<T> >), "");
+ static_assert(std::is_floating_point<T>::value ==
+ std::chrono::treat_as_floating_point_v<T>, "");
#endif
}
diff --git a/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp b/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp
index 1d8be420d837..d1b974c50753 100644
--- a/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp
+++ b/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp
@@ -21,18 +21,13 @@ int main () {
std::tuple<std::unique_ptr<char>> up;
std::tuple<std::shared_ptr<char>> sp;
std::tuple<std::weak_ptr <char>> wp;
-// std::tuple<std::auto_ptr <char>> ap;
}
{
std::tuple<std::unique_ptr<char[]>> up;
std::tuple<std::shared_ptr<char[]>> sp;
std::tuple<std::weak_ptr <char[]>> wp;
-// std::tuple<std::auto_ptr <char[]>> ap;
}
- {
- std::tuple<std::unique_ptr<char[5]>> up;
- std::tuple<std::shared_ptr<char[5]>> sp;
- std::tuple<std::weak_ptr <char[5]>> wp;
-// std::tuple<std::auto_ptr <char[5]>> ap;
- }
-} \ No newline at end of file
+ // Smart pointers of type 'T[N]' are not tested here since they are not
+ // supported by the standard nor by libc++'s implementation.
+ // See http://reviews.llvm.org/D21320 for more information.
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp b/test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp
index df5fdff511e3..ce6dcf811e46 100644
--- a/test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp
@@ -9,7 +9,9 @@
// This is for bugs 18853 and 19118
-#if __cplusplus >= 201103L
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
#include <tuple>
#include <functional>
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp
new file mode 100644
index 000000000000..2e821945d09a
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp
@@ -0,0 +1,275 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <tuple>
+
+// template <class F, class T> constexpr decltype(auto) apply(F &&, T &&)
+
+// Test with different ref/ptr/cv qualified argument types.
+
+#include <tuple>
+#include <array>
+#include <utility>
+#include <cassert>
+
+#include "test_macros.h"
+#include "type_id.h"
+
+// std::array is explicitly allowed to be initialized with A a = { init-list };.
+// Disable the missing braces warning for this reason.
+#include "disable_missing_braces_warning.h"
+
+
+constexpr int constexpr_sum_fn() { return 0; }
+
+template <class ...Ints>
+constexpr int constexpr_sum_fn(int x1, Ints... rest) { return x1 + constexpr_sum_fn(rest...); }
+
+struct ConstexprSumT {
+ constexpr ConstexprSumT() = default;
+ template <class ...Ints>
+ constexpr int operator()(Ints... values) const {
+ return constexpr_sum_fn(values...);
+ }
+};
+
+
+void test_constexpr_evaluation()
+{
+ constexpr ConstexprSumT sum_obj{};
+ {
+ using Tup = std::tuple<>;
+ using Fn = int(&)();
+ constexpr Tup t;
+ static_assert(std::apply(static_cast<Fn>(constexpr_sum_fn), t) == 0, "");
+ static_assert(std::apply(sum_obj, t) == 0, "");
+ }
+ {
+ using Tup = std::tuple<int>;
+ using Fn = int(&)(int);
+ constexpr Tup t(42);
+ static_assert(std::apply(static_cast<Fn>(constexpr_sum_fn), t) == 42, "");
+ static_assert(std::apply(sum_obj, t) == 42, "");
+ }
+ {
+ using Tup = std::tuple<int, long>;
+ using Fn = int(&)(int, int);
+ constexpr Tup t(42, 101);
+ static_assert(std::apply(static_cast<Fn>(constexpr_sum_fn), t) == 143, "");
+ static_assert(std::apply(sum_obj, t) == 143, "");
+ }
+ {
+ using Tup = std::pair<int, long>;
+ using Fn = int(&)(int, int);
+ constexpr Tup t(42, 101);
+ static_assert(std::apply(static_cast<Fn>(constexpr_sum_fn), t) == 143, "");
+ static_assert(std::apply(sum_obj, t) == 143, "");
+ }
+ {
+ using Tup = std::tuple<int, long, int>;
+ using Fn = int(&)(int, int, int);
+ constexpr Tup t(42, 101, -1);
+ static_assert(std::apply(static_cast<Fn>(constexpr_sum_fn), t) == 142, "");
+ static_assert(std::apply(sum_obj, t) == 142, "");
+ }
+ {
+ using Tup = std::array<int, 3>;
+ using Fn = int(&)(int, int, int);
+ constexpr Tup t = {42, 101, -1};
+ static_assert(std::apply(static_cast<Fn>(constexpr_sum_fn), t) == 142, "");
+ static_assert(std::apply(sum_obj, t) == 142, "");
+ }
+}
+
+
+enum CallQuals {
+ CQ_None,
+ CQ_LValue,
+ CQ_ConstLValue,
+ CQ_RValue,
+ CQ_ConstRValue
+};
+
+template <class Tuple>
+struct CallInfo {
+ CallQuals quals;
+ TypeID const* arg_types;
+ Tuple args;
+
+ template <class ...Args>
+ CallInfo(CallQuals q, Args&&... xargs)
+ : quals(q), arg_types(&makeArgumentID<Args&&...>()), args(std::forward<Args>(xargs)...)
+ {}
+};
+
+template <class ...Args>
+inline CallInfo<decltype(std::forward_as_tuple(std::declval<Args>()...))>
+makeCallInfo(CallQuals quals, Args&&... args) {
+ return {quals, std::forward<Args>(args)...};
+}
+
+struct TrackedCallable {
+
+ TrackedCallable() = default;
+
+ template <class ...Args> auto operator()(Args&&... xargs) &
+ { return makeCallInfo(CQ_LValue, std::forward<Args>(xargs)...); }
+
+ template <class ...Args> auto operator()(Args&&... xargs) const&
+ { return makeCallInfo(CQ_ConstLValue, std::forward<Args>(xargs)...); }
+
+ template <class ...Args> auto operator()(Args&&... xargs) &&
+ { return makeCallInfo(CQ_RValue, std::forward<Args>(xargs)...); }
+
+ template <class ...Args> auto operator()(Args&&... xargs) const&&
+ { return makeCallInfo(CQ_ConstRValue, std::forward<Args>(xargs)...); }
+};
+
+template <class ...ExpectArgs, class Tuple>
+void check_apply_quals_and_types(Tuple&& t) {
+ TypeID const* const expect_args = &makeArgumentID<ExpectArgs...>();
+ TrackedCallable obj;
+ TrackedCallable const& cobj = obj;
+ {
+ auto ret = std::apply(obj, std::forward<Tuple>(t));
+ assert(ret.quals == CQ_LValue);
+ assert(ret.arg_types == expect_args);
+ assert(ret.args == t);
+ }
+ {
+ auto ret = std::apply(cobj, std::forward<Tuple>(t));
+ assert(ret.quals == CQ_ConstLValue);
+ assert(ret.arg_types == expect_args);
+ assert(ret.args == t);
+ }
+ {
+ auto ret = std::apply(std::move(obj), std::forward<Tuple>(t));
+ assert(ret.quals == CQ_RValue);
+ assert(ret.arg_types == expect_args);
+ assert(ret.args == t);
+ }
+ {
+ auto ret = std::apply(std::move(cobj), std::forward<Tuple>(t));
+ assert(ret.quals == CQ_ConstRValue);
+ assert(ret.arg_types == expect_args);
+ assert(ret.args == t);
+ }
+}
+
+void test_call_quals_and_arg_types()
+{
+ TrackedCallable obj;
+ using Tup = std::tuple<int, int const&, unsigned&&>;
+ const int x = 42;
+ unsigned y = 101;
+ Tup t(-1, x, std::move(y));
+ Tup const& ct = t;
+ check_apply_quals_and_types<int&, int const&, unsigned&>(t);
+ check_apply_quals_and_types<int const&, int const&, unsigned&>(ct);
+ check_apply_quals_and_types<int&&, int const&, unsigned&&>(std::move(t));
+ check_apply_quals_and_types<int const&&, int const&, unsigned&&>(std::move(ct));
+}
+
+
+struct NothrowMoveable {
+ NothrowMoveable() noexcept = default;
+ NothrowMoveable(NothrowMoveable const&) noexcept(false) {}
+ NothrowMoveable(NothrowMoveable&&) noexcept {}
+};
+
+template <bool IsNoexcept>
+struct TestNoexceptCallable {
+ template <class ...Args>
+ NothrowMoveable operator()(Args...) const noexcept(IsNoexcept) { return {}; }
+};
+
+void test_noexcept()
+{
+ TestNoexceptCallable<true> nec;
+ TestNoexceptCallable<false> tc;
+ {
+ // test that the functions noexcept-ness is propagated
+ using Tup = std::tuple<int, const char*, long>;
+ Tup t;
+ ASSERT_NOEXCEPT(std::apply(nec, t));
+ ASSERT_NOT_NOEXCEPT(std::apply(tc, t));
+ }
+ {
+ // test that the noexcept-ness of the argument conversions is checked.
+ using Tup = std::tuple<NothrowMoveable, int>;
+ Tup t;
+ ASSERT_NOT_NOEXCEPT(std::apply(nec, t));
+ ASSERT_NOEXCEPT(std::apply(nec, std::move(t)));
+ }
+}
+
+namespace ReturnTypeTest {
+ static int my_int = 42;
+
+ template <int N> struct index {};
+
+ void f(index<0>) {}
+
+ int f(index<1>) { return 0; }
+
+ int & f(index<2>) { return static_cast<int &>(my_int); }
+ int const & f(index<3>) { return static_cast<int const &>(my_int); }
+ int volatile & f(index<4>) { return static_cast<int volatile &>(my_int); }
+ int const volatile & f(index<5>) { return static_cast<int const volatile &>(my_int); }
+
+ int && f(index<6>) { return static_cast<int &&>(my_int); }
+ int const && f(index<7>) { return static_cast<int const &&>(my_int); }
+ int volatile && f(index<8>) { return static_cast<int volatile &&>(my_int); }
+ int const volatile && f(index<9>) { return static_cast<int const volatile &&>(my_int); }
+
+ int * f(index<10>) { return static_cast<int *>(&my_int); }
+ int const * f(index<11>) { return static_cast<int const *>(&my_int); }
+ int volatile * f(index<12>) { return static_cast<int volatile *>(&my_int); }
+ int const volatile * f(index<13>) { return static_cast<int const volatile *>(&my_int); }
+
+ template <int Func, class Expect>
+ void test()
+ {
+ using RawInvokeResult = decltype(f(index<Func>{}));
+ static_assert(std::is_same<RawInvokeResult, Expect>::value, "");
+ using FnType = RawInvokeResult (*) (index<Func>);
+ FnType fn = f;
+ std::tuple<index<Func>> t; ((void)t);
+ using InvokeResult = decltype(std::apply(fn, t));
+ static_assert(std::is_same<InvokeResult, Expect>::value, "");
+ }
+} // end namespace ReturnTypeTest
+
+void test_return_type()
+{
+ using ReturnTypeTest::test;
+ test<0, void>();
+ test<1, int>();
+ test<2, int &>();
+ test<3, int const &>();
+ test<4, int volatile &>();
+ test<5, int const volatile &>();
+ test<6, int &&>();
+ test<7, int const &&>();
+ test<8, int volatile &&>();
+ test<9, int const volatile &&>();
+ test<10, int *>();
+ test<11, int const *>();
+ test<12, int volatile *>();
+ test<13, int const volatile *>();
+}
+
+int main() {
+ test_constexpr_evaluation();
+ test_call_quals_and_arg_types();
+ test_return_type();
+ test_noexcept();
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_extended_types.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_extended_types.pass.cpp
new file mode 100644
index 000000000000..02d7fe43e9cd
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_extended_types.pass.cpp
@@ -0,0 +1,426 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <tuple>
+
+// template <class F, class T> constexpr decltype(auto) apply(F &&, T &&)
+
+// Testing extended function types. The extended function types are those
+// named by INVOKE but that are not actual callable objects. These include
+// bullets 1-4 of invoke.
+
+#include <tuple>
+#include <array>
+#include <utility>
+#include <cassert>
+
+// std::array is explicitly allowed to be initialized with A a = { init-list };.
+// Disable the missing braces warning for this reason.
+#include "disable_missing_braces_warning.h"
+
+int count = 0;
+
+struct A_int_0
+{
+ A_int_0() : obj1(0){}
+ A_int_0(int x) : obj1(x) {}
+ int mem1() { return ++count; }
+ int mem2() const { return ++count; }
+ int const obj1;
+};
+
+struct A_int_1
+{
+ A_int_1() {}
+ A_int_1(int) {}
+ int mem1(int x) { return count += x; }
+ int mem2(int x) const { return count += x; }
+};
+
+struct A_int_2
+{
+ A_int_2() {}
+ A_int_2(int) {}
+ int mem1(int x, int y) { return count += (x + y); }
+ int mem2(int x, int y) const { return count += (x + y); }
+};
+
+template <class A>
+struct A_wrap
+{
+ A_wrap() {}
+ A_wrap(int x) : m_a(x) {}
+ A & operator*() { return m_a; }
+ A const & operator*() const { return m_a; }
+ A m_a;
+};
+
+typedef A_wrap<A_int_0> A_wrap_0;
+typedef A_wrap<A_int_1> A_wrap_1;
+typedef A_wrap<A_int_2> A_wrap_2;
+
+
+template <class A>
+struct A_base : public A
+{
+ A_base() : A() {}
+ A_base(int x) : A(x) {}
+};
+
+typedef A_base<A_int_0> A_base_0;
+typedef A_base<A_int_1> A_base_1;
+typedef A_base<A_int_2> A_base_2;
+
+
+template <
+ class Tuple, class ConstTuple
+ , class TuplePtr, class ConstTuplePtr
+ , class TupleWrap, class ConstTupleWrap
+ , class TupleBase, class ConstTupleBase
+ >
+void test_ext_int_0()
+{
+ count = 0;
+ typedef A_int_0 T;
+ typedef A_wrap_0 Wrap;
+ typedef A_base_0 Base;
+
+ typedef int(T::*mem1_t)();
+ mem1_t mem1 = &T::mem1;
+
+ typedef int(T::*mem2_t)() const;
+ mem2_t mem2 = &T::mem2;
+
+ typedef int const T::*obj1_t;
+ obj1_t obj1 = &T::obj1;
+
+ // member function w/ref
+ {
+ T a;
+ Tuple t{a};
+ assert(1 == std::apply(mem1, t));
+ assert(count == 1);
+ }
+ count = 0;
+ // member function w/pointer
+ {
+ T a;
+ TuplePtr t{&a};
+ assert(1 == std::apply(mem1, t));
+ assert(count == 1);
+ }
+ count = 0;
+ // member function w/base
+ {
+ Base a;
+ TupleBase t{a};
+ assert(1 == std::apply(mem1, t));
+ assert(count == 1);
+ }
+ count = 0;
+ // member function w/wrap
+ {
+ Wrap a;
+ TupleWrap t{a};
+ assert(1 == std::apply(mem1, t));
+ assert(count == 1);
+ }
+ count = 0;
+ // const member function w/ref
+ {
+ T const a;
+ ConstTuple t{a};
+ assert(1 == std::apply(mem2, t));
+ assert(count == 1);
+ }
+ count = 0;
+ // const member function w/pointer
+ {
+ T const a;
+ ConstTuplePtr t{&a};
+ assert(1 == std::apply(mem2, t));
+ assert(count == 1);
+ }
+ count = 0;
+ // const member function w/base
+ {
+ Base const a;
+ ConstTupleBase t{a};
+ assert(1 == std::apply(mem2, t));
+ assert(count == 1);
+ }
+ count = 0;
+ // const member function w/wrapper
+ {
+ Wrap const a;
+ ConstTupleWrap t{a};
+ assert(1 == std::apply(mem2, t));
+ assert(1 == count);
+ }
+ // member object w/ref
+ {
+ T a{42};
+ Tuple t{a};
+ assert(42 == std::apply(obj1, t));
+ }
+ // member object w/pointer
+ {
+ T a{42};
+ TuplePtr t{&a};
+ assert(42 == std::apply(obj1, t));
+ }
+ // member object w/base
+ {
+ Base a{42};
+ TupleBase t{a};
+ assert(42 == std::apply(obj1, t));
+ }
+ // member object w/wrapper
+ {
+ Wrap a{42};
+ TupleWrap t{a};
+ assert(42 == std::apply(obj1, t));
+ }
+}
+
+
+template <
+ class Tuple, class ConstTuple
+ , class TuplePtr, class ConstTuplePtr
+ , class TupleWrap, class ConstTupleWrap
+ , class TupleBase, class ConstTupleBase
+ >
+void test_ext_int_1()
+{
+ count = 0;
+ typedef A_int_1 T;
+ typedef A_wrap_1 Wrap;
+ typedef A_base_1 Base;
+
+ typedef int(T::*mem1_t)(int);
+ mem1_t mem1 = &T::mem1;
+
+ typedef int(T::*mem2_t)(int) const;
+ mem2_t mem2 = &T::mem2;
+
+ // member function w/ref
+ {
+ T a;
+ Tuple t{a, 2};
+ assert(2 == std::apply(mem1, t));
+ assert(count == 2);
+ }
+ count = 0;
+ // member function w/pointer
+ {
+ T a;
+ TuplePtr t{&a, 3};
+ assert(3 == std::apply(mem1, t));
+ assert(count == 3);
+ }
+ count = 0;
+ // member function w/base
+ {
+ Base a;
+ TupleBase t{a, 4};
+ assert(4 == std::apply(mem1, t));
+ assert(count == 4);
+ }
+ count = 0;
+ // member function w/wrap
+ {
+ Wrap a;
+ TupleWrap t{a, 5};
+ assert(5 == std::apply(mem1, t));
+ assert(count == 5);
+ }
+ count = 0;
+ // const member function w/ref
+ {
+ T const a;
+ ConstTuple t{a, 6};
+ assert(6 == std::apply(mem2, t));
+ assert(count == 6);
+ }
+ count = 0;
+ // const member function w/pointer
+ {
+ T const a;
+ ConstTuplePtr t{&a, 7};
+ assert(7 == std::apply(mem2, t));
+ assert(count == 7);
+ }
+ count = 0;
+ // const member function w/base
+ {
+ Base const a;
+ ConstTupleBase t{a, 8};
+ assert(8 == std::apply(mem2, t));
+ assert(count == 8);
+ }
+ count = 0;
+ // const member function w/wrapper
+ {
+ Wrap const a;
+ ConstTupleWrap t{a, 9};
+ assert(9 == std::apply(mem2, t));
+ assert(9 == count);
+ }
+}
+
+
+template <
+ class Tuple, class ConstTuple
+ , class TuplePtr, class ConstTuplePtr
+ , class TupleWrap, class ConstTupleWrap
+ , class TupleBase, class ConstTupleBase
+ >
+void test_ext_int_2()
+{
+ count = 0;
+ typedef A_int_2 T;
+ typedef A_wrap_2 Wrap;
+ typedef A_base_2 Base;
+
+ typedef int(T::*mem1_t)(int, int);
+ mem1_t mem1 = &T::mem1;
+
+ typedef int(T::*mem2_t)(int, int) const;
+ mem2_t mem2 = &T::mem2;
+
+ // member function w/ref
+ {
+ T a;
+ Tuple t{a, 1, 1};
+ assert(2 == std::apply(mem1, t));
+ assert(count == 2);
+ }
+ count = 0;
+ // member function w/pointer
+ {
+ T a;
+ TuplePtr t{&a, 1, 2};
+ assert(3 == std::apply(mem1, t));
+ assert(count == 3);
+ }
+ count = 0;
+ // member function w/base
+ {
+ Base a;
+ TupleBase t{a, 2, 2};
+ assert(4 == std::apply(mem1, t));
+ assert(count == 4);
+ }
+ count = 0;
+ // member function w/wrap
+ {
+ Wrap a;
+ TupleWrap t{a, 2, 3};
+ assert(5 == std::apply(mem1, t));
+ assert(count == 5);
+ }
+ count = 0;
+ // const member function w/ref
+ {
+ T const a;
+ ConstTuple t{a, 3, 3};
+ assert(6 == std::apply(mem2, t));
+ assert(count == 6);
+ }
+ count = 0;
+ // const member function w/pointer
+ {
+ T const a;
+ ConstTuplePtr t{&a, 3, 4};
+ assert(7 == std::apply(mem2, t));
+ assert(count == 7);
+ }
+ count = 0;
+ // const member function w/base
+ {
+ Base const a;
+ ConstTupleBase t{a, 4, 4};
+ assert(8 == std::apply(mem2, t));
+ assert(count == 8);
+ }
+ count = 0;
+ // const member function w/wrapper
+ {
+ Wrap const a;
+ ConstTupleWrap t{a, 4, 5};
+ assert(9 == std::apply(mem2, t));
+ assert(9 == count);
+ }
+}
+
+int main()
+{
+ {
+ test_ext_int_0<
+ std::tuple<A_int_0 &>, std::tuple<A_int_0 const &>
+ , std::tuple<A_int_0 *>, std::tuple<A_int_0 const *>
+ , std::tuple<A_wrap_0 &>, std::tuple<A_wrap_0 const &>
+ , std::tuple<A_base_0 &>, std::tuple<A_base_0 const &>
+ >();
+ test_ext_int_0<
+ std::tuple<A_int_0>, std::tuple<A_int_0 const>
+ , std::tuple<A_int_0 *>, std::tuple<A_int_0 const *>
+ , std::tuple<A_wrap_0>, std::tuple<A_wrap_0 const>
+ , std::tuple<A_base_0>, std::tuple<A_base_0 const>
+ >();
+ test_ext_int_0<
+ std::array<A_int_0, 1>, std::array<A_int_0 const, 1>
+ , std::array<A_int_0*, 1>, std::array<A_int_0 const*, 1>
+ , std::array<A_wrap_0, 1>, std::array<A_wrap_0 const, 1>
+ , std::array<A_base_0, 1>, std::array<A_base_0 const, 1>
+ >();
+ }
+ {
+ test_ext_int_1<
+ std::tuple<A_int_1 &, int>, std::tuple<A_int_1 const &, int>
+ , std::tuple<A_int_1 *, int>, std::tuple<A_int_1 const *, int>
+ , std::tuple<A_wrap_1 &, int>, std::tuple<A_wrap_1 const &, int>
+ , std::tuple<A_base_1 &, int>, std::tuple<A_base_1 const &, int>
+ >();
+ test_ext_int_1<
+ std::tuple<A_int_1, int>, std::tuple<A_int_1 const, int>
+ , std::tuple<A_int_1 *, int>, std::tuple<A_int_1 const *, int>
+ , std::tuple<A_wrap_1, int>, std::tuple<A_wrap_1 const, int>
+ , std::tuple<A_base_1, int>, std::tuple<A_base_1 const, int>
+ >();
+ test_ext_int_1<
+ std::pair<A_int_1 &, int>, std::pair<A_int_1 const &, int>
+ , std::pair<A_int_1 *, int>, std::pair<A_int_1 const *, int>
+ , std::pair<A_wrap_1 &, int>, std::pair<A_wrap_1 const &, int>
+ , std::pair<A_base_1 &, int>, std::pair<A_base_1 const &, int>
+ >();
+ test_ext_int_1<
+ std::pair<A_int_1, int>, std::pair<A_int_1 const, int>
+ , std::pair<A_int_1 *, int>, std::pair<A_int_1 const *, int>
+ , std::pair<A_wrap_1, int>, std::pair<A_wrap_1 const, int>
+ , std::pair<A_base_1, int>, std::pair<A_base_1 const, int>
+ >();
+ }
+ {
+ test_ext_int_2<
+ std::tuple<A_int_2 &, int, int>, std::tuple<A_int_2 const &, int, int>
+ , std::tuple<A_int_2 *, int, int>, std::tuple<A_int_2 const *, int, int>
+ , std::tuple<A_wrap_2 &, int, int>, std::tuple<A_wrap_2 const &, int, int>
+ , std::tuple<A_base_2 &, int, int>, std::tuple<A_base_2 const &, int, int>
+ >();
+ test_ext_int_2<
+ std::tuple<A_int_2, int, int>, std::tuple<A_int_2 const, int, int>
+ , std::tuple<A_int_2 *, int, int>, std::tuple<A_int_2 const *, int, int>
+ , std::tuple<A_wrap_2, int, int>, std::tuple<A_wrap_2 const, int, int>
+ , std::tuple<A_base_2, int, int>, std::tuple<A_base_2 const, int, int>
+ >();
+ }
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_large_arity.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_large_arity.pass.cpp
new file mode 100644
index 000000000000..33c3ef5956e4
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_large_arity.pass.cpp
@@ -0,0 +1,144 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <tuple>
+
+// template <class F, class T> constexpr decltype(auto) apply(F &&, T &&)
+
+// Stress testing large arities with tuple and array.
+
+#include <tuple>
+#include <array>
+#include <utility>
+#include <cassert>
+
+////////////////////////////////////////////////////////////////////////////////
+template <class T, std::size_t Dummy = 0>
+struct always_imp
+{
+ typedef T type;
+};
+
+template <class T, std::size_t Dummy = 0>
+using always_t = typename always_imp<T, Dummy>::type;
+
+////////////////////////////////////////////////////////////////////////////////
+template <class Tuple, class Idx>
+struct make_function;
+
+template <class Tp, std::size_t ...Idx>
+struct make_function<Tp, std::integer_sequence<std::size_t, Idx...>>
+{
+ using type = bool (*)(always_t<Tp, Idx>...);
+};
+
+template <class Tp, std::size_t Size>
+using make_function_t = typename make_function<Tp, std::make_index_sequence<Size>>::type;
+
+////////////////////////////////////////////////////////////////////////////////
+template <class Tp, class Idx>
+struct make_tuple_imp;
+
+////////////////////////////////////////////////////////////////////////////////
+template <class Tp, std::size_t ...Idx>
+struct make_tuple_imp<Tp, std::integer_sequence<std::size_t, Idx...>>
+{
+ using type = std::tuple<always_t<Tp, Idx>...>;
+};
+
+template <class Tp, std::size_t Size>
+using make_tuple_t = typename make_tuple_imp<Tp, std::make_index_sequence<Size>>::type;
+
+template <class ...Types>
+bool test_apply_fn(Types...) { return true; }
+
+
+template <std::size_t Size>
+void test_all()
+{
+
+ using A = std::array<int, Size>;
+ using ConstA = std::array<int const, Size>;
+
+ using Tuple = make_tuple_t<int, Size>;
+ using CTuple = make_tuple_t<const int, Size>;
+
+ using ValFn = make_function_t<int, Size>;
+ ValFn val_fn = &test_apply_fn;
+
+ using RefFn = make_function_t<int &, Size>;
+ RefFn ref_fn = &test_apply_fn;
+
+ using CRefFn = make_function_t<int const &, Size>;
+ CRefFn cref_fn = &test_apply_fn;
+
+ using RRefFn = make_function_t<int &&, Size>;
+ RRefFn rref_fn = &test_apply_fn;
+
+ {
+ A a{};
+ assert(std::apply(val_fn, a));
+ assert(std::apply(ref_fn, a));
+ assert(std::apply(cref_fn, a));
+ assert(std::apply(rref_fn, std::move(a)));
+ }
+ {
+ ConstA a{};
+ assert(std::apply(val_fn, a));
+ assert(std::apply(cref_fn, a));
+ }
+ {
+ Tuple a{};
+ assert(std::apply(val_fn, a));
+ assert(std::apply(ref_fn, a));
+ assert(std::apply(cref_fn, a));
+ assert(std::apply(rref_fn, std::move(a)));
+ }
+ {
+ CTuple a{};
+ assert(std::apply(val_fn, a));
+ assert(std::apply(cref_fn, a));
+ }
+
+}
+
+
+template <std::size_t Size>
+void test_one()
+{
+ using A = std::array<int, Size>;
+ using Tuple = make_tuple_t<int, Size>;
+
+ using ValFn = make_function_t<int, Size>;
+ ValFn val_fn = &test_apply_fn;
+
+ {
+ A a{};
+ assert(std::apply(val_fn, a));
+ }
+ {
+ Tuple a{};
+ assert(std::apply(val_fn, a));
+ }
+}
+
+int main()
+{
+ // Instantiate with 1-5 arguments.
+ test_all<1>();
+ test_all<2>();
+ test_all<3>();
+ test_all<4>();
+ test_all<5>();
+
+ // Stress test with 256
+ test_one<256>();
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp
new file mode 100644
index 000000000000..143ae195e6f4
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp
@@ -0,0 +1,214 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <tuple>
+
+// template <class T, class Tuple> constexpr T make_from_tuple(Tuple&&);
+
+#include <tuple>
+#include <array>
+#include <utility>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "type_id.h"
+
+// std::array is explicitly allowed to be initialized with A a = { init-list };.
+// Disable the missing braces warning for this reason.
+#include "disable_missing_braces_warning.h"
+
+template <class Tuple>
+struct ConstexprConstructibleFromTuple {
+ template <class ...Args>
+ explicit constexpr ConstexprConstructibleFromTuple(Args&&... xargs)
+ : args{std::forward<Args>(xargs)...} {}
+ Tuple args;
+};
+
+template <class TupleLike>
+struct ConstructibleFromTuple;
+
+template <template <class ...> class Tuple, class ...Types>
+struct ConstructibleFromTuple<Tuple<Types...>> {
+ template <class ...Args>
+ explicit ConstructibleFromTuple(Args&&... xargs)
+ : args(xargs...),
+ arg_types(&makeArgumentID<Args&&...>())
+ {}
+ Tuple<std::decay_t<Types>...> args;
+ TypeID const* arg_types;
+};
+
+template <class Tp, size_t N>
+struct ConstructibleFromTuple<std::array<Tp, N>> {
+template <class ...Args>
+ explicit ConstructibleFromTuple(Args&&... xargs)
+ : args{xargs...},
+ arg_types(&makeArgumentID<Args&&...>())
+ {}
+ std::array<Tp, N> args;
+ TypeID const* arg_types;
+};
+
+template <class Tuple>
+constexpr bool do_constexpr_test(Tuple&& tup) {
+ using RawTuple = std::decay_t<Tuple>;
+ using Tp = ConstexprConstructibleFromTuple<RawTuple>;
+ return std::make_from_tuple<Tp>(std::forward<Tuple>(tup)).args == tup;
+}
+
+// Needed by do_forwarding_test() since it compare pairs of different types.
+template <class T1, class T2, class U1, class U2>
+inline bool operator==(const std::pair<T1, T2>& lhs, const std::pair<U1, U2>& rhs) {
+ return lhs.first == rhs.first && lhs.second == rhs.second;
+}
+
+template <class ...ExpectTypes, class Tuple>
+bool do_forwarding_test(Tuple&& tup) {
+ using RawTuple = std::decay_t<Tuple>;
+ using Tp = ConstructibleFromTuple<RawTuple>;
+ const Tp value = std::make_from_tuple<Tp>(std::forward<Tuple>(tup));
+ return value.args == tup
+ && value.arg_types == &makeArgumentID<ExpectTypes...>();
+}
+
+void test_constexpr_construction() {
+ {
+ constexpr std::tuple<> tup;
+ static_assert(do_constexpr_test(tup), "");
+ }
+ {
+ constexpr std::tuple<int> tup(42);
+ static_assert(do_constexpr_test(tup), "");
+ }
+ {
+ constexpr std::tuple<int, long, void*> tup(42, 101, nullptr);
+ static_assert(do_constexpr_test(tup), "");
+ }
+ {
+ constexpr std::pair<int, const char*> p(42, "hello world");
+ static_assert(do_constexpr_test(p), "");
+ }
+ {
+ using Tuple = std::array<int, 3>;
+ using ValueTp = ConstexprConstructibleFromTuple<Tuple>;
+ constexpr Tuple arr = {42, 101, -1};
+ constexpr ValueTp value = std::make_from_tuple<ValueTp>(arr);
+ static_assert(value.args[0] == arr[0] && value.args[1] == arr[1]
+ && value.args[2] == arr[2], "");
+ }
+}
+
+void test_perfect_forwarding() {
+ {
+ using Tup = std::tuple<>;
+ Tup tup;
+ Tup const& ctup = tup;
+ assert(do_forwarding_test<>(tup));
+ assert(do_forwarding_test<>(ctup));
+ }
+ {
+ using Tup = std::tuple<int>;
+ Tup tup(42);
+ Tup const& ctup = tup;
+ assert(do_forwarding_test<int&>(tup));
+ assert(do_forwarding_test<int const&>(ctup));
+ assert(do_forwarding_test<int&&>(std::move(tup)));
+ assert(do_forwarding_test<int const&&>(std::move(ctup)));
+ }
+ {
+ using Tup = std::tuple<int&, const char*, unsigned&&>;
+ int x = 42;
+ unsigned y = 101;
+ Tup tup(x, "hello world", std::move(y));
+ Tup const& ctup = tup;
+ assert((do_forwarding_test<int&, const char*&, unsigned&>(tup)));
+ assert((do_forwarding_test<int&, const char* const&, unsigned &>(ctup)));
+ assert((do_forwarding_test<int&, const char*&&, unsigned&&>(std::move(tup))));
+ assert((do_forwarding_test<int&, const char* const&&, unsigned &&>(std::move(ctup))));
+ }
+ // test with pair<T, U>
+ {
+ using Tup = std::pair<int&, const char*>;
+ int x = 42;
+ Tup tup(x, "hello world");
+ Tup const& ctup = tup;
+ assert((do_forwarding_test<int&, const char*&>(tup)));
+ assert((do_forwarding_test<int&, const char* const&>(ctup)));
+ assert((do_forwarding_test<int&, const char*&&>(std::move(tup))));
+ assert((do_forwarding_test<int&, const char* const&&>(std::move(ctup))));
+ }
+ // test with array<T, I>
+ {
+ using Tup = std::array<int, 3>;
+ Tup tup = {42, 101, -1};
+ Tup const& ctup = tup;
+ assert((do_forwarding_test<int&, int&, int&>(tup)));
+ assert((do_forwarding_test<int const&, int const&, int const&>(ctup)));
+ assert((do_forwarding_test<int&&, int&&, int&&>(std::move(tup))));
+ assert((do_forwarding_test<int const&&, int const&&, int const&&>(std::move(ctup))));
+ }
+}
+
+void test_noexcept() {
+ struct NothrowMoveable {
+ NothrowMoveable() = default;
+ NothrowMoveable(NothrowMoveable const&) {}
+ NothrowMoveable(NothrowMoveable&&) noexcept {}
+ };
+ struct TestType {
+ TestType(int, NothrowMoveable) noexcept {}
+ TestType(int, int, int) noexcept(false) {}
+ TestType(long, long, long) noexcept {}
+ };
+ {
+ using Tuple = std::tuple<int, NothrowMoveable>;
+ Tuple tup; ((void)tup);
+ Tuple const& ctup = tup; ((void)ctup);
+ ASSERT_NOT_NOEXCEPT(std::make_from_tuple<TestType>(ctup));
+ ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(std::move(tup)));
+ }
+ {
+ using Tuple = std::pair<int, NothrowMoveable>;
+ Tuple tup; ((void)tup);
+ Tuple const& ctup = tup; ((void)ctup);
+ ASSERT_NOT_NOEXCEPT(std::make_from_tuple<TestType>(ctup));
+ ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(std::move(tup)));
+ }
+ {
+ using Tuple = std::tuple<int, int, int>;
+ Tuple tup; ((void)tup);
+ ASSERT_NOT_NOEXCEPT(std::make_from_tuple<TestType>(tup));
+ }
+ {
+ using Tuple = std::tuple<long, long, long>;
+ Tuple tup; ((void)tup);
+ ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(tup));
+ }
+ {
+ using Tuple = std::array<int, 3>;
+ Tuple tup; ((void)tup);
+ ASSERT_NOT_NOEXCEPT(std::make_from_tuple<TestType>(tup));
+ }
+ {
+ using Tuple = std::array<long, 3>;
+ Tuple tup; ((void)tup);
+ ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(tup));
+ }
+}
+
+int main()
+{
+ test_constexpr_construction();
+ test_perfect_forwarding();
+ test_noexcept();
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp
index 2dde6b5521f2..91892efaf139 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp
@@ -74,4 +74,16 @@ int main()
assert(std::get<1>(t1) == int('a'));
assert(std::get<2>(t1).id_ == 2);
}
+ {
+ // Test that tuple evaluates correctly applies an lvalue reference
+ // before evaluating is_assignable (ie 'is_assignable<int&, int&>')
+ // instead of evaluating 'is_assignable<int&&, int&>' which is false.
+ int x = 42;
+ int y = 43;
+ std::tuple<int&&> t(std::move(x));
+ std::tuple<int&> t2(y);
+ t = t2;
+ assert(std::get<0>(t) == 43);
+ assert(&std::get<0>(t) == &x);
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
index 11bfdd0c94a9..afd3e0fdb8e3 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
@@ -37,6 +37,13 @@ struct D
explicit D(int i) : B(i) {}
};
+struct E {
+ E() = default;
+ E& operator=(int val) {
+ return *this;
+ }
+};
+
int main()
{
{
@@ -88,4 +95,16 @@ int main()
assert(std::get<1>(t1) == int('a'));
assert(std::get<2>(t1)->id_ == 3);
}
+ {
+ // Test that tuple evaluates correctly applies an lvalue reference
+ // before evaluating is_assignable (ie 'is_assignable<int&, int&&>')
+ // instead of evaluating 'is_assignable<int&&, int&&>' which is false.
+ int x = 42;
+ int y = 43;
+ std::tuple<int&&, E> t(std::move(x), E{});
+ std::tuple<int&&, int> t2(std::move(y), 44);
+ t = std::move(t2);
+ assert(std::get<0>(t) == 43);
+ assert(&std::get<0>(t) == &x);
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR22806_constrain_tuple_like_ctor.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR22806_constrain_tuple_like_ctor.pass.cpp
new file mode 100644
index 000000000000..4ddfb463385c
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR22806_constrain_tuple_like_ctor.pass.cpp
@@ -0,0 +1,178 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class TupleLike>
+// tuple(TupleLike&&);
+// template <class Alloc, class TupleLike>
+// tuple(std::allocator_arg_t, Alloc const&, TupleLike&&);
+
+// Check that the tuple-like ctors are properly disabled when the UTypes...
+// constructor should be selected. See PR22806.
+
+#include <tuple>
+#include <memory>
+#include <cassert>
+
+template <class Tp>
+using uncvref_t = typename std::remove_cv<typename std::remove_reference<Tp>::type>::type;
+
+template <class Tuple, class = uncvref_t<Tuple>>
+struct IsTuple : std::false_type {};
+
+template <class Tuple, class ...Args>
+struct IsTuple<Tuple, std::tuple<Args...>> : std::true_type {};
+
+struct ConstructibleFromTupleAndInt {
+ enum State { FromTuple, FromInt, Copied, Moved };
+ State state;
+
+ ConstructibleFromTupleAndInt(ConstructibleFromTupleAndInt const&) : state(Copied) {}
+ ConstructibleFromTupleAndInt(ConstructibleFromTupleAndInt &&) : state(Moved) {}
+
+ template <class Tuple, class = typename std::enable_if<IsTuple<Tuple>::value>::type>
+ explicit ConstructibleFromTupleAndInt(Tuple&&) : state(FromTuple) {}
+
+ explicit ConstructibleFromTupleAndInt(int) : state(FromInt) {}
+};
+
+struct ConvertibleFromTupleAndInt {
+ enum State { FromTuple, FromInt, Copied, Moved };
+ State state;
+
+ ConvertibleFromTupleAndInt(ConvertibleFromTupleAndInt const&) : state(Copied) {}
+ ConvertibleFromTupleAndInt(ConvertibleFromTupleAndInt &&) : state(Moved) {}
+
+ template <class Tuple, class = typename std::enable_if<IsTuple<Tuple>::value>::type>
+ ConvertibleFromTupleAndInt(Tuple&&) : state(FromTuple) {}
+
+ ConvertibleFromTupleAndInt(int) : state(FromInt) {}
+};
+
+struct ConstructibleFromInt {
+ enum State { FromInt, Copied, Moved };
+ State state;
+
+ ConstructibleFromInt(ConstructibleFromInt const&) : state(Copied) {}
+ ConstructibleFromInt(ConstructibleFromInt &&) : state(Moved) {}
+
+ explicit ConstructibleFromInt(int) : state(FromInt) {}
+};
+
+struct ConvertibleFromInt {
+ enum State { FromInt, Copied, Moved };
+ State state;
+
+ ConvertibleFromInt(ConvertibleFromInt const&) : state(Copied) {}
+ ConvertibleFromInt(ConvertibleFromInt &&) : state(Moved) {}
+ ConvertibleFromInt(int) : state(FromInt) {}
+};
+
+int main()
+{
+ // Test for the creation of dangling references when a tuple is used to
+ // store a reference to another tuple as its only element.
+ // Ex std::tuple<std::tuple<int>&&>.
+ // In this case the constructors 1) 'tuple(UTypes&&...)'
+ // and 2) 'tuple(TupleLike&&)' need to be manually disambiguated because
+ // when both #1 and #2 participate in partial ordering #2 will always
+ // be chosen over #1.
+ // See PR22806 and LWG issue #2549 for more information.
+ // (https://llvm.org/bugs/show_bug.cgi?id=22806)
+ using T = std::tuple<int>;
+ std::allocator<int> A;
+ { // rvalue reference
+ T t1(42);
+ std::tuple< T&& > t2(std::move(t1));
+ assert(&std::get<0>(t2) == &t1);
+ }
+ { // const lvalue reference
+ T t1(42);
+
+ std::tuple< T const & > t2(t1);
+ assert(&std::get<0>(t2) == &t1);
+
+ std::tuple< T const & > t3(static_cast<T const&>(t1));
+ assert(&std::get<0>(t3) == &t1);
+ }
+ { // lvalue reference
+ T t1(42);
+
+ std::tuple< T & > t2(t1);
+ assert(&std::get<0>(t2) == &t1);
+ }
+ { // const rvalue reference
+ T t1(42);
+
+ std::tuple< T const && > t2(std::move(t1));
+ assert(&std::get<0>(t2) == &t1);
+ }
+ { // rvalue reference via uses-allocator
+ T t1(42);
+ std::tuple< T&& > t2(std::allocator_arg, A, std::move(t1));
+ assert(&std::get<0>(t2) == &t1);
+ }
+ { // const lvalue reference via uses-allocator
+ T t1(42);
+
+ std::tuple< T const & > t2(std::allocator_arg, A, t1);
+ assert(&std::get<0>(t2) == &t1);
+
+ std::tuple< T const & > t3(std::allocator_arg, A, static_cast<T const&>(t1));
+ assert(&std::get<0>(t3) == &t1);
+ }
+ { // lvalue reference via uses-allocator
+ T t1(42);
+
+ std::tuple< T & > t2(std::allocator_arg, A, t1);
+ assert(&std::get<0>(t2) == &t1);
+ }
+ { // const rvalue reference via uses-allocator
+ T const t1(42);
+ std::tuple< T const && > t2(std::allocator_arg, A, std::move(t1));
+ assert(&std::get<0>(t2) == &t1);
+ }
+ // Test constructing a 1-tuple of the form tuple<UDT> from another 1-tuple
+ // 'tuple<T>' where UDT *can* be constructed from 'tuple<T>' In this case
+ // the 'tuple(UTypes...)' ctor should be choosen and 'UDT' constructed frow
+ // 'tuple<T>'.
+ {
+ using VT = ConstructibleFromTupleAndInt;
+ std::tuple<int> t1(42);
+ std::tuple<VT> t2(t1);
+ assert(std::get<0>(t2).state == VT::FromTuple);
+ }
+ {
+ using VT = ConvertibleFromTupleAndInt;
+ std::tuple<int> t1(42);
+ std::tuple<VT> t2 = {t1};
+ assert(std::get<0>(t2).state == VT::FromTuple);
+ }
+ // Test constructing a 1-tuple of the form tuple<UDT> from another 1-tuple
+ // 'tuple<T>' where UDT cannot be constructed from 'tuple<T>' but can
+ // be constructed from 'T'. In this case the tuple-like ctor should be
+ // chosen and 'UDT' constructed from 'T'
+ {
+ using VT = ConstructibleFromInt;
+ std::tuple<int> t1(42);
+ std::tuple<VT> t2(t1);
+ assert(std::get<0>(t2).state == VT::FromInt);
+ }
+ {
+ using VT = ConvertibleFromInt;
+ std::tuple<int> t1(42);
+ std::tuple<VT> t2 = {t1};
+ assert(std::get<0>(t2).state == VT::FromInt);
+ }
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp
new file mode 100644
index 000000000000..ed3cafadbf08
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp
@@ -0,0 +1,96 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class ...UTypes>
+// EXPLICIT(...) tuple(UTypes&&...)
+
+// Check that the UTypes... ctor is properly disabled before evaluating any
+// SFINAE when the tuple-like copy/move ctor should *clearly* be selected
+// instead. This happens 'sizeof...(UTypes) == 1' and the first element of
+// 'UTypes...' is an instance of the tuple itself. See PR23256.
+
+#include <tuple>
+#include <memory>
+#include <type_traits>
+
+
+struct UnconstrainedCtor {
+ int value_;
+
+ UnconstrainedCtor() : value_(0) {}
+
+ // Blows up when instantiated for any type other than int. Because the ctor
+ // is constexpr it is instantiated by 'is_constructible' and 'is_convertible'
+ // for Clang based compilers. GCC does not instantiate the ctor body
+ // but it does instantiate the noexcept specifier and it will blow up there.
+ template <typename T>
+ constexpr UnconstrainedCtor(T value) noexcept(noexcept(value_ = value))
+ : value_(static_cast<int>(value))
+ {
+ static_assert(std::is_same<int, T>::value, "");
+ }
+};
+
+struct ExplicitUnconstrainedCtor {
+ int value_;
+
+ ExplicitUnconstrainedCtor() : value_(0) {}
+
+ template <typename T>
+ constexpr explicit ExplicitUnconstrainedCtor(T value)
+ noexcept(noexcept(value_ = value))
+ : value_(static_cast<int>(value))
+ {
+ static_assert(std::is_same<int, T>::value, "");
+ }
+
+};
+
+int main() {
+ typedef UnconstrainedCtor A;
+ typedef ExplicitUnconstrainedCtor ExplicitA;
+ {
+ static_assert(std::is_copy_constructible<std::tuple<A>>::value, "");
+ static_assert(std::is_move_constructible<std::tuple<A>>::value, "");
+ static_assert(std::is_copy_constructible<std::tuple<ExplicitA>>::value, "");
+ static_assert(std::is_move_constructible<std::tuple<ExplicitA>>::value, "");
+ }
+ {
+ static_assert(std::is_constructible<
+ std::tuple<A>,
+ std::allocator_arg_t, std::allocator<void>,
+ std::tuple<A> const&
+ >::value, "");
+ static_assert(std::is_constructible<
+ std::tuple<A>,
+ std::allocator_arg_t, std::allocator<void>,
+ std::tuple<A> &&
+ >::value, "");
+ static_assert(std::is_constructible<
+ std::tuple<ExplicitA>,
+ std::allocator_arg_t, std::allocator<void>,
+ std::tuple<ExplicitA> const&
+ >::value, "");
+ static_assert(std::is_constructible<
+ std::tuple<ExplicitA>,
+ std::allocator_arg_t, std::allocator<void>,
+ std::tuple<ExplicitA> &&
+ >::value, "");
+ }
+ {
+ std::tuple<A&&> t(std::forward_as_tuple(A{}));
+ std::tuple<ExplicitA&&> t2(std::forward_as_tuple(ExplicitA{}));
+ }
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR27684_contains_ref_to_incomplete_type.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR27684_contains_ref_to_incomplete_type.pass.cpp
new file mode 100644
index 000000000000..c8b722f836c1
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR27684_contains_ref_to_incomplete_type.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class Alloc> tuple(allocator_arg_t, Alloc const&)
+
+// Libc++ has to deduce the 'allocator_arg_t' parameter for this constructor
+// as 'AllocArgT'. Previously libc++ has tried to support tags derived from
+// 'allocator_arg_t' by using 'is_base_of<AllocArgT, allocator_arg_t>'.
+// However this breaks whenever a 2-tuple contains a reference to an incomplete
+// type as its first parameter. See PR27684.
+
+#include <tuple>
+#include <cassert>
+
+struct IncompleteType;
+extern IncompleteType inc1;
+extern IncompleteType inc2;
+IncompleteType const& cinc1 = inc1;
+IncompleteType const& cinc2 = inc2;
+
+int main() {
+ using IT = IncompleteType;
+ { // try calling tuple(Tp const&...)
+ using Tup = std::tuple<const IT&, const IT&>;
+ Tup t(cinc1, cinc2);
+ assert(&std::get<0>(t) == &inc1);
+ assert(&std::get<1>(t) == &inc2);
+ }
+ { // try calling tuple(Up&&...)
+ using Tup = std::tuple<const IT&, const IT&>;
+ Tup t(inc1, inc2);
+ assert(&std::get<0>(t) == &inc1);
+ assert(&std::get<1>(t) == &inc2);
+ }
+}
+
+struct IncompleteType {};
+IncompleteType inc1;
+IncompleteType inc2;
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
index 817cc8f10990..6ab303c735be 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
@@ -82,6 +82,8 @@ void test_default_constructible_extension_sfinae()
MoveOnly, Tuple, MoveOnly, MoveOnly
>::value, "");
}
+ // testing extensions
+#ifdef _LIBCPP_VERSION
{
typedef std::tuple<MoveOnly, int> Tuple;
typedef std::tuple<MoveOnly, Tuple, MoveOnly, MoveOnly> NestedTuple;
@@ -96,6 +98,7 @@ void test_default_constructible_extension_sfinae()
MoveOnly, Tuple, MoveOnly, MoveOnly
>::value, "");
}
+#endif
}
int main()
@@ -118,6 +121,7 @@ int main()
assert(std::get<2>(t) == 2);
}
// extensions
+#ifdef _LIBCPP_VERSION
{
std::tuple<MoveOnly, MoveOnly, MoveOnly> t(MoveOnly(0),
MoveOnly(1));
@@ -131,7 +135,8 @@ int main()
assert(std::get<1>(t) == MoveOnly());
assert(std::get<2>(t) == MoveOnly());
}
-#if _LIBCPP_STD_VER > 11
+#endif
+#if TEST_STD_VER > 11
{
constexpr std::tuple<Empty> t0{Empty()};
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp
index 39776822cbda..4da5fc7f8397 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <tuple>
// template <class... Types> class tuple;
@@ -14,7 +16,9 @@
// template <class Alloc>
// tuple(allocator_arg_t, const Alloc& a);
-// UNSUPPORTED: c++98, c++03
+// NOTE: this constructor does not currently support tags derived from
+// allocator_arg_t because libc++ has to deduce the parameter as a template
+// argument. See PR27684 (https://llvm.org/bugs/show_bug.cgi?id=27684)
#include <tuple>
#include <cassert>
@@ -24,6 +28,18 @@
#include "../alloc_first.h"
#include "../alloc_last.h"
+template <class T = void>
+struct NonDefaultConstructible {
+ constexpr NonDefaultConstructible() {
+ static_assert(!std::is_same<T, T>::value, "Default Ctor instantiated");
+ }
+
+ explicit constexpr NonDefaultConstructible(int) {}
+};
+
+
+struct DerivedFromAllocArgT : std::allocator_arg_t {};
+
int main()
{
{
@@ -78,4 +94,14 @@ int main()
assert(!alloc_last::allocator_constructed);
assert(std::get<2>(t) == alloc_last());
}
+ {
+ // Test that the uses-allocator default constructor does not evaluate
+ // it's SFINAE when it otherwise shouldn't be selected. Do this by
+ // using 'NonDefaultConstructible' which will cause a compile error
+ // if std::is_default_constructible is evaluated on it.
+ using T = NonDefaultConstructible<>;
+ T v(42);
+ std::tuple<T, T> t(v, v);
+ std::tuple<T, T> t2(42, 42);
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
index 3929965cd273..e174e9b321b8 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
@@ -24,16 +24,29 @@
#include "../alloc_first.h"
#include "../alloc_last.h"
-struct NoDefault { NoDefault() = delete; };
+template <class T = void>
+struct DefaultCtorBlowsUp {
+ constexpr DefaultCtorBlowsUp() {
+ static_assert(!std::is_same<T, T>::value, "Default Ctor instantiated");
+ }
-// Make sure the _Up... constructor SFINAEs out when the types that
-// are not explicitly initialized are not all default constructible.
-// Otherwise, std::is_constructible would return true but instantiating
-// the constructor would fail.
-void test_default_constructible_extension_sfinae()
+ explicit constexpr DefaultCtorBlowsUp(int x) : value(x) {}
+
+ int value;
+};
+
+
+struct DerivedFromAllocArgT : std::allocator_arg_t {};
+
+
+// Make sure the _Up... constructor SFINAEs out when the number of initializers
+// is less that the number of elements in the tuple. Previously libc++ would
+// offer these constructers as an extension but they broke conforming code.
+void test_uses_allocator_sfinae_evaluation()
{
+ using BadDefault = DefaultCtorBlowsUp<>;
{
- typedef std::tuple<MoveOnly, NoDefault> Tuple;
+ typedef std::tuple<MoveOnly, MoveOnly, BadDefault> Tuple;
static_assert(!std::is_constructible<
Tuple,
@@ -42,11 +55,11 @@ void test_default_constructible_extension_sfinae()
static_assert(std::is_constructible<
Tuple,
- std::allocator_arg_t, A1<int>, MoveOnly, NoDefault
+ std::allocator_arg_t, A1<int>, MoveOnly, MoveOnly, BadDefault
>::value, "");
}
{
- typedef std::tuple<MoveOnly, MoveOnly, NoDefault> Tuple;
+ typedef std::tuple<MoveOnly, MoveOnly, BadDefault, BadDefault> Tuple;
static_assert(!std::is_constructible<
Tuple,
@@ -55,53 +68,44 @@ void test_default_constructible_extension_sfinae()
static_assert(std::is_constructible<
Tuple,
- std::allocator_arg_t, A1<int>, MoveOnly, MoveOnly, NoDefault
- >::value, "");
- }
- {
- // Same idea as above but with a nested tuple
- typedef std::tuple<MoveOnly, NoDefault> Tuple;
- typedef std::tuple<MoveOnly, Tuple, MoveOnly, MoveOnly> NestedTuple;
-
- static_assert(!std::is_constructible<
- NestedTuple,
- std::allocator_arg_t, A1<int>, MoveOnly, MoveOnly, MoveOnly, MoveOnly
- >::value, "");
-
- static_assert(std::is_constructible<
- NestedTuple,
- std::allocator_arg_t, A1<int>, MoveOnly, Tuple, MoveOnly, MoveOnly
- >::value, "");
- }
- {
- typedef std::tuple<MoveOnly, int> Tuple;
- typedef std::tuple<MoveOnly, Tuple, MoveOnly, MoveOnly> NestedTuple;
-
- static_assert(std::is_constructible<
- NestedTuple,
- std::allocator_arg_t, A1<int>, MoveOnly, MoveOnly, MoveOnly, MoveOnly
- >::value, "");
-
- static_assert(std::is_constructible<
- NestedTuple,
- std::allocator_arg_t, A1<int>, MoveOnly, Tuple, MoveOnly, MoveOnly
+ std::allocator_arg_t, A1<int>, MoveOnly, MoveOnly, BadDefault, BadDefault
>::value, "");
}
}
+struct Explicit {
+ int value;
+ explicit Explicit(int x) : value(x) {}
+};
+
int main()
{
{
+ std::tuple<Explicit> t{std::allocator_arg, std::allocator<void>{}, 42};
+ assert(std::get<0>(t).value == 42);
+ }
+ {
std::tuple<MoveOnly> t(std::allocator_arg, A1<int>(), MoveOnly(0));
assert(std::get<0>(t) == 0);
}
{
+ using T = DefaultCtorBlowsUp<>;
+ std::tuple<T> t(std::allocator_arg, A1<int>(), T(42));
+ assert(std::get<0>(t).value == 42);
+ }
+ {
std::tuple<MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
MoveOnly(0), MoveOnly(1));
assert(std::get<0>(t) == 0);
assert(std::get<1>(t) == 1);
}
{
+ using T = DefaultCtorBlowsUp<>;
+ std::tuple<T, T> t(std::allocator_arg, A1<int>(), T(42), T(43));
+ assert(std::get<0>(t).value == 42);
+ assert(std::get<1>(t).value == 43);
+ }
+ {
std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
MoveOnly(0),
1, 2);
@@ -110,6 +114,13 @@ int main()
assert(std::get<2>(t) == 2);
}
{
+ using T = DefaultCtorBlowsUp<>;
+ std::tuple<T, T, T> t(std::allocator_arg, A1<int>(), T(1), T(2), T(3));
+ assert(std::get<0>(t).value == 1);
+ assert(std::get<1>(t).value == 2);
+ assert(std::get<2>(t).value == 3);
+ }
+ {
alloc_first::allocator_constructed = false;
alloc_last::allocator_constructed = false;
std::tuple<int, alloc_first, alloc_last> t(std::allocator_arg,
@@ -120,22 +131,22 @@ int main()
assert(alloc_last::allocator_constructed);
assert(std::get<2>(t) == alloc_last(3));
}
- // extensions
- {
- std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
- 0, 1);
- assert(std::get<0>(t) == 0);
- assert(std::get<1>(t) == 1);
- assert(std::get<2>(t) == MoveOnly());
- }
{
- std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
- 0);
- assert(std::get<0>(t) == 0);
- assert(std::get<1>(t) == MoveOnly());
- assert(std::get<2>(t) == MoveOnly());
+ // Check that uses-allocator construction is still selected when
+ // given a tag type that derives from allocator_arg_t.
+ DerivedFromAllocArgT tag;
+ alloc_first::allocator_constructed = false;
+ alloc_last::allocator_constructed = false;
+ std::tuple<int, alloc_first, alloc_last> t(tag,
+ A1<int>(5), 1, 2, 3);
+ assert(std::get<0>(t) == 1);
+ assert(alloc_first::allocator_constructed);
+ assert(std::get<1>(t) == alloc_first(2));
+ assert(alloc_last::allocator_constructed);
+ assert(std::get<2>(t) == alloc_last(3));
}
- // Check that SFINAE is properly applied with the default reduced arity
- // constructor extensions.
- test_default_constructible_extension_sfinae();
+ // Stress test the SFINAE on the uses-allocator constructors and
+ // ensure that the "reduced-arity-initialization" extension is not offered
+ // for these constructors.
+ test_uses_allocator_sfinae_evaluation();
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.fail.cpp
new file mode 100644
index 000000000000..b28ad6dab5ab
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.fail.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class Alloc>
+// EXPLICIT tuple(allocator_arg_t, const Alloc& a, const Types&...);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+#include <memory>
+#include <cassert>
+
+struct ExplicitCopy {
+ explicit ExplicitCopy(ExplicitCopy const&) {}
+ explicit ExplicitCopy(int) {}
+};
+
+std::tuple<ExplicitCopy> const_explicit_copy_test() {
+ const ExplicitCopy e(42);
+ return {std::allocator_arg, std::allocator<void>{}, e};
+ // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
+}
+
+std::tuple<ExplicitCopy> non_const_explicity_copy_test() {
+ ExplicitCopy e(42);
+ return {std::allocator_arg, std::allocator<void>{}, e};
+ // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
+}
+int main()
+{
+ const_explicit_copy_test();
+ non_const_explicity_copy_test();
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp
index 0f68926376f2..73d53a4c0e26 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp
@@ -17,15 +17,37 @@
// UNSUPPORTED: c++98, c++03
#include <tuple>
+#include <memory>
#include <cassert>
#include "allocators.h"
#include "../alloc_first.h"
#include "../alloc_last.h"
+struct ImplicitCopy {
+ explicit ImplicitCopy(int) {}
+ ImplicitCopy(ImplicitCopy const&) {}
+};
+
+// Test that tuple(std::allocator_arg, Alloc, Types const&...) allows implicit
+// copy conversions in return value expressions.
+std::tuple<ImplicitCopy> testImplicitCopy1() {
+ ImplicitCopy i(42);
+ return {std::allocator_arg, std::allocator<void>{}, i};
+}
+
+std::tuple<ImplicitCopy> testImplicitCopy2() {
+ const ImplicitCopy i(42);
+ return {std::allocator_arg, std::allocator<void>{}, i};
+}
+
int main()
{
{
+ // check that the literal '0' can implicitly initialize a stored pointer.
+ std::tuple<int*> t = {std::allocator_arg, std::allocator<void>{}, 0};
+ }
+ {
std::tuple<int> t(std::allocator_arg, A1<int>(), 3);
assert(std::get<0>(t) == 3);
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.fail.cpp
new file mode 100644
index 000000000000..ccf08833b537
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.fail.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class Alloc, class ...UTypes>
+// tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...> const&);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+#include <memory>
+
+struct ExplicitCopy {
+ explicit ExplicitCopy(int) {}
+ explicit ExplicitCopy(ExplicitCopy const&) {}
+
+};
+
+std::tuple<ExplicitCopy> const_explicit_copy_test() {
+ const std::tuple<int> t1(42);
+ return {std::allocator_arg, std::allocator<void>{}, t1};
+ // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
+}
+
+std::tuple<ExplicitCopy> non_const_explicit_copy_test() {
+ std::tuple<int> t1(42);
+ return {std::allocator_arg, std::allocator<void>{}, t1};
+ // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
+}
+
+int main()
+{
+
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
index 8acfde7a98eb..36d9f32879cb 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
@@ -17,12 +17,23 @@
// UNSUPPORTED: c++98, c++03
#include <tuple>
+#include <memory>
#include <cassert>
#include "allocators.h"
#include "../alloc_first.h"
#include "../alloc_last.h"
+struct Explicit {
+ int value;
+ explicit Explicit(int x) : value(x) {}
+};
+
+struct Implicit {
+ int value;
+ Implicit(int x) : value(x) {}
+};
+
int main()
{
{
@@ -66,4 +77,14 @@ int main()
assert(std::get<1>(t1) == 2);
assert(std::get<2>(t1) == 3);
}
+ {
+ const std::tuple<int> t1(42);
+ std::tuple<Explicit> t2{std::allocator_arg, std::allocator<void>{}, t1};
+ assert(std::get<0>(t2).value == 42);
+ }
+ {
+ const std::tuple<int> t1(42);
+ std::tuple<Implicit> t2 = {std::allocator_arg, std::allocator<void>{}, t1};
+ assert(std::get<0>(t2).value == 42);
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.fail.cpp
new file mode 100644
index 000000000000..d3539cebf950
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.fail.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class Alloc, class ...UTypes>
+// tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+#include <memory>
+
+struct ExplicitCopy {
+ explicit ExplicitCopy(int) {}
+ explicit ExplicitCopy(ExplicitCopy const&) {}
+};
+
+std::tuple<ExplicitCopy> explicit_move_test() {
+ std::tuple<int> t1(42);
+ return {std::allocator_arg, std::allocator<void>{}, std::move(t1)};
+ // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
+}
+
+int main()
+{
+
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp
index c862d3b64d56..d3a6add5da6a 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp
@@ -40,6 +40,16 @@ struct D
explicit D(int i) : B(i) {}
};
+struct Explicit {
+ int value;
+ explicit Explicit(int x) : value(x) {}
+};
+
+struct Implicit {
+ int value;
+ Implicit(int x) : value(x) {}
+};
+
int main()
{
{
@@ -81,4 +91,14 @@ int main()
assert(std::get<1>(t1) == 2);
assert(std::get<2>(t1)->id_ == 3);
}
+ {
+ std::tuple<int> t1(42);
+ std::tuple<Explicit> t2{std::allocator_arg, std::allocator<void>{}, std::move(t1)};
+ assert(std::get<0>(t2).value == 42);
+ }
+ {
+ std::tuple<int> t1(42);
+ std::tuple<Implicit> t2 = {std::allocator_arg, std::allocator<void>{}, std::move(t1)};
+ assert(std::get<0>(t2).value == 42);
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp
index 14e127e59ba9..7c9f60cbf901 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp
@@ -52,6 +52,8 @@ int main()
assert(alloc_last::allocator_constructed);
assert(std::get<0>(t) == 2);
}
+// testing extensions
+#ifdef _LIBCPP_VERSION
{
typedef std::tuple<alloc_first, alloc_last> T;
T t0(2, 3);
@@ -75,4 +77,5 @@ int main()
assert(std::get<1>(t) == 2);
assert(std::get<2>(t) == 3);
}
+#endif
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp
index 54d3f7ee0c07..a3e1a9de6195 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp
@@ -53,6 +53,8 @@ int main()
assert(alloc_last::allocator_constructed);
assert(std::get<0>(t) == 1);
}
+// testing extensions
+#ifdef _LIBCPP_VERSION
{
typedef std::tuple<MoveOnly, alloc_first> T;
T t0(0 ,1);
@@ -74,4 +76,5 @@ int main()
assert(std::get<1>(t) == 2);
assert(std::get<2>(t) == 3);
}
+#endif
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.fail.cpp
index 00e2af265b36..b72f0fc2efec 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.fail.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.fail.cpp
@@ -19,9 +19,30 @@
#include <string>
#include <cassert>
+struct ExplicitCopy {
+ ExplicitCopy(int) {}
+ explicit ExplicitCopy(ExplicitCopy const&) {}
+};
+
+std::tuple<ExplicitCopy> const_explicit_copy() {
+ const ExplicitCopy e(42);
+ return {e};
+ // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
+}
+
+
+std::tuple<ExplicitCopy> non_const_explicit_copy() {
+ ExplicitCopy e(42);
+ return {e};
+ // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
+}
+
+std::tuple<ExplicitCopy> const_explicit_copy_no_brace() {
+ const ExplicitCopy e(42);
+ return e;
+ // expected-error@-1 {{no viable conversion}}
+}
+
int main()
{
- {
- std::tuple<int*> t = 0;
- }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp
index bbadf8de1600..367f19e5d8dd 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp
@@ -53,13 +53,40 @@ struct NoValueCtorEmpty
{ static_assert(never<T>::value, "This should not be instantiated"); }
};
+
+struct ImplicitCopy {
+ explicit ImplicitCopy(int) {}
+ ImplicitCopy(ImplicitCopy const&) {}
+};
+
+// Test that tuple(std::allocator_arg, Alloc, Types const&...) allows implicit
+// copy conversions in return value expressions.
+std::tuple<ImplicitCopy> testImplicitCopy1() {
+ ImplicitCopy i(42);
+ return {i};
+}
+
+std::tuple<ImplicitCopy> testImplicitCopy2() {
+ const ImplicitCopy i(42);
+ return {i};
+}
+
+std::tuple<ImplicitCopy> testImplicitCopy3() {
+ const ImplicitCopy i(42);
+ return i;
+}
+
int main()
{
{
+ // check that the literal '0' can implicitly initialize a stored pointer.
+ std::tuple<int*> t = 0;
+ }
+ {
std::tuple<int> t(2);
assert(std::get<0>(t) == 2);
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
{
constexpr std::tuple<int> t(2);
static_assert(std::get<0>(t) == 2, "");
@@ -74,7 +101,7 @@ int main()
assert(std::get<0>(t) == 2);
assert(std::get<1>(t) == nullptr);
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
{
constexpr std::tuple<int, char*> t(2, nullptr);
static_assert(std::get<0>(t) == 2, "");
@@ -109,7 +136,8 @@ int main()
assert(std::get<2>(t) == 2);
assert(std::get<3>(t) == 3);
}
- // extensions
+// extensions
+#ifdef _LIBCPP_VERSION
{
std::tuple<int, char*, std::string> t(2);
assert(std::get<0>(t) == 2);
@@ -129,4 +157,5 @@ int main()
assert(std::get<2>(t) == "text");
assert(std::get<3>(t) == 0.0);
}
+#endif
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp
index 740b6589e511..d6d489fd0ea4 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp
@@ -29,7 +29,7 @@ int main()
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == short('a'));
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
{
typedef std::pair<double, char> P0;
typedef std::tuple<int, short> T1;
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
index 5ad4f9227f48..b7fa2e3a03cc 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
@@ -20,6 +20,16 @@
#include <string>
#include <cassert>
+struct Explicit {
+ int value;
+ explicit Explicit(int x) : value(x) {}
+};
+
+struct Implicit {
+ int value;
+ Implicit(int x) : value(x) {}
+};
+
struct B
{
int id_;
@@ -33,7 +43,7 @@ struct D
explicit D(int i) : B(i) {}
};
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
struct A
{
@@ -62,7 +72,7 @@ int main()
T1 t1 = t0;
assert(std::get<0>(t1) == 2);
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
{
typedef std::tuple<double> T0;
typedef std::tuple<A> T1;
@@ -115,4 +125,14 @@ int main()
assert(std::get<1>(t1) == int('a'));
assert(std::get<2>(t1).id_ == 3);
}
+ {
+ const std::tuple<int> t1(42);
+ std::tuple<Explicit> t2(t1);
+ assert(std::get<0>(t2).value == 42);
+ }
+ {
+ const std::tuple<int> t1(42);
+ std::tuple<Implicit> t2 = t1;
+ assert(std::get<0>(t2).value == 42);
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp
index 3a6abd3a95af..8423f5d0145f 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp
@@ -20,6 +20,16 @@
#include <memory>
#include <cassert>
+struct Explicit {
+ int value;
+ explicit Explicit(int x) : value(x) {}
+};
+
+struct Implicit {
+ int value;
+ Implicit(int x) : value(x) {}
+};
+
struct B
{
int id_;
@@ -81,4 +91,14 @@ int main()
assert(std::get<1>(t1) == int('a'));
assert(std::get<2>(t1)->id_ == 3);
}
+ {
+ std::tuple<int> t1(42);
+ std::tuple<Explicit> t2(std::move(t1));
+ assert(std::get<0>(t2).value == 42);
+ }
+ {
+ std::tuple<int> t1(42);
+ std::tuple<Implicit> t2 = std::move(t1);
+ assert(std::get<0>(t2).value == 42);
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
index 0cda96846f71..1bd7d6d4e8a8 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
@@ -29,8 +29,10 @@ struct ConstructsWithTupleLeaf
ConstructsWithTupleLeaf(ConstructsWithTupleLeaf &&) {}
template <class T>
- ConstructsWithTupleLeaf(T t)
- { assert(false); }
+ ConstructsWithTupleLeaf(T t) {
+ static_assert(!std::is_same<T, T>::value,
+ "Constructor instantiated for type other than int");
+ }
};
int main()
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/test_lazy_sfinae.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/test_lazy_sfinae.pass.cpp
new file mode 100644
index 000000000000..76f7e794a8e8
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/test_lazy_sfinae.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+#include <utility>
+#include <cassert>
+
+template <class ConstructFrom>
+struct ConstructibleFromT {
+ ConstructibleFromT() = default;
+ ConstructibleFromT(ConstructFrom v) : value(v) {}
+ ConstructFrom value;
+};
+
+template <class AssertOn>
+struct CtorAssertsT {
+ bool defaulted;
+ CtorAssertsT() : defaulted(true) {}
+ template <class T>
+ constexpr CtorAssertsT(T) : defaulted(false) {
+ static_assert(!std::is_same<T, AssertOn>::value, "");
+ }
+};
+
+template <class AllowT, class AssertT>
+struct AllowAssertT {
+ AllowAssertT() = default;
+ AllowAssertT(AllowT) {}
+ template <class U>
+ constexpr AllowAssertT(U) {
+ static_assert(!std::is_same<U, AssertT>::value, "");
+ }
+};
+
+// Construct a tuple<T1, T2> from pair<int, int> where T1 and T2
+// are not constructible from ints but T1 is constructible from std::pair.
+// This considers the following constructors:
+// (1) tuple(TupleLike) -> checks is_constructible<Tn, int>
+// (2) tuple(UTypes...) -> checks is_constructible<T1, pair<int, int>>
+// and is_default_constructible<T2>
+// The point of this test is to ensure that the consideration of (1)
+// short circuits before evaluating is_constructible<T2, int>, which
+// will cause a static assertion.
+void test_tuple_like_lazy_sfinae() {
+#if defined(_LIBCPP_VERSION)
+ // This test requires libc++'s reduced arity initialization.
+ using T1 = ConstructibleFromT<std::pair<int, int>>;
+ using T2 = CtorAssertsT<int>;
+ std::pair<int, int> p(42, 100);
+ std::tuple<T1, T2> t(p);
+ assert(std::get<0>(t).value == p);
+ assert(std::get<1>(t).defaulted);
+#endif
+}
+
+
+struct NonConstCopyable {
+ NonConstCopyable() = default;
+ explicit NonConstCopyable(int v) : value(v) {}
+ NonConstCopyable(NonConstCopyable&) = default;
+ NonConstCopyable(NonConstCopyable const&) = delete;
+ int value;
+};
+
+template <class T>
+struct BlowsUpOnConstCopy {
+ BlowsUpOnConstCopy() = default;
+ constexpr BlowsUpOnConstCopy(BlowsUpOnConstCopy const&) {
+ static_assert(!std::is_same<T, T>::value, "");
+ }
+ BlowsUpOnConstCopy(BlowsUpOnConstCopy&) = default;
+};
+
+// Test the following constructors:
+// (1) tuple(Types const&...)
+// (2) tuple(UTypes&&...)
+// Test that (1) short circuits before evaluating the copy constructor of the
+// second argument. Constructor (2) should be selected.
+void test_const_Types_lazy_sfinae()
+{
+ NonConstCopyable v(42);
+ BlowsUpOnConstCopy<int> b;
+ std::tuple<NonConstCopyable, BlowsUpOnConstCopy<int>> t(v, b);
+ assert(std::get<0>(t).value == 42);
+}
+
+int main() {
+ test_tuple_like_lazy_sfinae();
+ test_const_Types_lazy_sfinae();
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
index 0e556b1b6c8e..2dbe81513a1a 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
@@ -20,7 +20,7 @@
template <class Tuple>
void
-test0(const Tuple& t)
+test0(const Tuple&)
{
static_assert(std::tuple_size<Tuple>::value == 0, "");
}
@@ -56,8 +56,8 @@ test2a(const Tuple& t)
#if _LIBCPP_STD_VER > 11
template <class Tuple>
-constexpr int
-test3(const Tuple& t)
+constexpr int
+test3(const Tuple&)
{
return std::tuple_size<Tuple>::value;
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp
index 2ee96dc7ebf4..f27e8a09fb97 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp
@@ -40,7 +40,7 @@ int main()
assert(i == 0);
assert(j == 0);
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
{
constexpr auto t1 = std::make_tuple(0, 1, 3.14);
constexpr int i1 = std::get<1>(t1);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp
index e21768cb6f5f..002ad148ad6d 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp
@@ -36,7 +36,7 @@ int main()
assert(std::get<0>(t) == "high");
assert(std::get<1>(t) == 5);
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
{
typedef std::tuple<double, int> T;
constexpr T t(2.718, 5);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp
index 1c2b17ad8832..86d1191db556 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp
@@ -21,7 +21,9 @@
#include <string>
#include <cassert>
-#if __cplusplus > 201103L
+#include "test_macros.h"
+
+#if TEST_STD_VER > 11
struct Empty {};
@@ -69,7 +71,7 @@ int main()
assert(std::get<2>(t) == 4);
assert(d == 2.5);
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
{ // get on an rvalue tuple
static_assert ( std::get<0> ( std::make_tuple ( 0.0f, 1, 2.0, 3L )) == 0, "" );
static_assert ( std::get<1> ( std::make_tuple ( 0.0f, 1, 2.0, 3L )) == 1, "" );
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp
new file mode 100644
index 000000000000..74e6efd983bd
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+#include <tuple>
+#include <string>
+
+struct UserType {};
+
+void test_bad_index() {
+ std::tuple<long, long, char, std::string, char, UserType, char> t1;
+ (void)std::get<int>(t1); // expected-error@tuple:* {{type not found}}
+ (void)std::get<long>(t1); // expected-note {{requested here}}
+ (void)std::get<char>(t1); // expected-note {{requested here}}
+ // expected-error@tuple:* 2 {{type occurs more than once}}
+ std::tuple<> t0;
+ (void)std::get<char*>(t0); // expected-node {{requested here}}
+ // expected-error@tuple:* 1 {{type not in empty type list}}
+}
+
+void test_bad_return_type() {
+ typedef std::unique_ptr<int> upint;
+ std::tuple<upint> t;
+ upint p = std::get<upint>(t); // expected-error{{deleted copy constructor}}
+}
+
+int main()
+{
+ test_bad_index();
+ test_bad_return_type();
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp
index b661a78de8db..01ee1ca1f434 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp
@@ -11,6 +11,7 @@
#include <tuple>
#include <utility>
+#include <memory>
#include <string>
#include <complex>
#include <type_traits>
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.array.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.array.pass.cpp
index d8a72c617cb5..57da4b04cdfd 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.array.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.array.pass.cpp
@@ -18,7 +18,7 @@
// typedef Ti type;
// };
//
-// LWG #2212 says that tuple_size and tuple_element must be
+// LWG #2212 says that tuple_size and tuple_element must be
// available after including <utility>
#include <array>
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.utility.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.utility.pass.cpp
index 8c8357d95d99..bd015ab5bbd6 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.utility.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.utility.pass.cpp
@@ -15,9 +15,10 @@
// class tuple_size<tuple<Types...>>
// : public integral_constant<size_t, sizeof...(Types)> { };
//
-// LWG #2212 says that tuple_size and tuple_element must be
+// LWG #2212 says that tuple_size and tuple_element must be
// available after including <utility>
+#include <cstddef>
#include <utility>
#include <type_traits>
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp
new file mode 100644
index 000000000000..4cb73573e7c9
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <size_t I, class... Types>
+// class tuple_element<I, tuple<Types...> >
+// {
+// public:
+// typedef Ti type;
+// };
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+#include <type_traits>
+
+int main()
+{
+ using T = std::tuple<int, long, void*>;
+ using E1 = typename std::tuple_element<1, T &>::type; // expected-error{{undefined template}}
+ using E2 = typename std::tuple_element<3, T>::type;
+ using E3 = typename std::tuple_element<4, T const>::type;
+ // expected-error@__tuple:* 2 {{static_assert failed}}
+
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.fail.cpp
new file mode 100644
index 000000000000..3f132e47b626
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.fail.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <tuple>
+
+// template <class... Types>
+// class tuple_size<tuple<Types...>>
+// : public integral_constant<size_t, sizeof...(Types)> { };
+
+// Expect failures with a reference type, pointer type, and a non-tuple type.
+
+#include <tuple>
+
+int main()
+{
+ (void)std::tuple_size<std::tuple<> &>::value; // expected-error {{implicit instantiation of undefined template}}
+ (void)std::tuple_size<int>::value; // expected-error {{implicit instantiation of undefined template}}
+ (void)std::tuple_size<std::tuple<>*>::value; // expected-error {{implicit instantiation of undefined template}}
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.fail.cpp
new file mode 100644
index 000000000000..957a683b47f8
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.fail.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <tuple>
+
+// template <class T> constexpr size_t tuple_size_v = tuple_size<T>::value;
+
+// Expect failures with a reference type, pointer type, and a non-tuple type.
+
+#include <tuple>
+
+int main()
+{
+ (void)std::tuple_size_v<std::tuple<> &>; // expected-note {{requested here}}
+ (void)std::tuple_size_v<int>; // expected-note {{requested here}}
+ (void)std::tuple_size_v<std::tuple<>*>; // expected-note {{requested here}}
+ // expected-error@tuple:* 3 {{implicit instantiation of undefined template}}
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.pass.cpp
new file mode 100644
index 000000000000..24878a1d560e
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <tuple>
+
+// template <class T> constexpr size_t tuple_size_v = tuple_size<T>::value;
+
+#include <tuple>
+#include <utility>
+#include <array>
+
+template <class Tuple, int Expect>
+void test()
+{
+ static_assert(std::tuple_size_v<Tuple> == Expect, "");
+ static_assert(std::tuple_size_v<Tuple> == std::tuple_size<Tuple>::value, "");
+ static_assert(std::tuple_size_v<Tuple const> == std::tuple_size<Tuple>::value, "");
+ static_assert(std::tuple_size_v<Tuple volatile> == std::tuple_size<Tuple>::value, "");
+ static_assert(std::tuple_size_v<Tuple const volatile> == std::tuple_size<Tuple>::value, "");
+}
+
+int main()
+{
+ test<std::tuple<>, 0>();
+
+ test<std::tuple<int>, 1>();
+ test<std::array<int, 1>, 1>();
+
+ test<std::tuple<int, int>, 2>();
+ test<std::pair<int, int>, 2>();
+ test<std::array<int, 2>, 2>();
+
+ test<std::tuple<int, int, int>, 3>();
+ test<std::array<int, 3>, 3>();
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp
index 0d25edc4547b..e5991df636f8 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp
@@ -143,7 +143,7 @@ int main()
assert(!(t1 == t2));
assert(t1 != t2);
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
{
typedef std::tuple<char, int, double> T1;
typedef std::tuple<double, char, int> T2;
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp
index eac84a9c35f6..34aafb1e1347 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp
@@ -195,7 +195,7 @@ int main()
assert(!(t1 > t2));
assert(!(t1 >= t2));
}
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11
{
typedef std::tuple<char, int, double> T1;
typedef std::tuple<double, char, int> T2;
diff --git a/test/std/utilities/utility/as_const/as_const.pass.cpp b/test/std/utilities/utility/as_const/as_const.pass.cpp
index ff3f84a5532f..7bb5849d0bd0 100644
--- a/test/std/utilities/utility/as_const/as_const.pass.cpp
+++ b/test/std/utilities/utility/as_const/as_const.pass.cpp
@@ -27,7 +27,7 @@ void test(T& t)
static_assert(std::is_const<typename std::remove_reference<decltype(std::as_const<const T>(t))>::type>::value, "");
static_assert(std::is_const<typename std::remove_reference<decltype(std::as_const<volatile T>(t))>::type>::value, "");
static_assert(std::is_const<typename std::remove_reference<decltype(std::as_const<const volatile T>(t))>::type>::value, "");
-
+
assert(std::as_const(t) == t);
assert(std::as_const< T>(t) == t);
assert(std::as_const<const T>(t) == t);
diff --git a/test/std/utilities/utility/exchange/exchange.pass.cpp b/test/std/utilities/utility/exchange/exchange.pass.cpp
index 620b4149d1d0..5ef0ac3b09f5 100644
--- a/test/std/utilities/utility/exchange/exchange.pass.cpp
+++ b/test/std/utilities/utility/exchange/exchange.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
// utilities
// exchange
@@ -17,7 +18,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
{
int v = 12;
assert ( std::exchange ( v, 23 ) == 12 );
@@ -27,7 +27,7 @@ int main()
assert ((std::exchange<int, float> ( v, {} )) == 67 );
assert ( v == 0 );
-
+
}
{
@@ -48,11 +48,9 @@ int main()
s3 = s2; // Dad
assert ( std::exchange ( s3, {} ) == s2 );
assert ( s3.size () == 0 );
-
+
s3 = s2; // Dad
assert ( std::exchange ( s3, "" ) == s2 );
assert ( s3.size () == 0 );
}
-
-#endif
}
diff --git a/test/std/utilities/utility/forward/forward.pass.cpp b/test/std/utilities/utility/forward/forward.pass.cpp
index 357b36fafa96..94575485df04 100644
--- a/test/std/utilities/utility/forward/forward.pass.cpp
+++ b/test/std/utilities/utility/forward/forward.pass.cpp
@@ -39,6 +39,9 @@ int main()
A a;
const A ca = A();
+ ((void)a); // Prevent unused warning
+ ((void)ca); // Prevent unused warning
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
static_assert(sizeof(test(std::forward<A&>(a))) == 1, "");
static_assert(sizeof(test(std::forward<A>(a))) == 4, "");
diff --git a/test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp b/test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp
index fcda3664d9b6..9ef7bcff2ba8 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp
@@ -18,6 +18,8 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -27,7 +29,7 @@ int main()
assert(std::get<1>(p) == 4);
}
-#if __cplusplus > 201103L
+#if TEST_STD_VER > 11
{
typedef std::pair<int, short> P;
constexpr P p1(3, 4);
diff --git a/test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp b/test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp
index 6d61c47ffbf0..47b4c06134d9 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp
@@ -18,7 +18,9 @@
#include <utility>
#include <cassert>
-#if __cplusplus > 201103L
+#include "test_macros.h"
+
+#if TEST_STD_VER > 11
struct S {
std::pair<int, int> a;
int k;
@@ -41,7 +43,7 @@ int main()
assert(std::get<1>(p) == 6);
}
-#if __cplusplus > 201103L
+#if TEST_STD_VER > 11
{
static_assert(S().k == 1, "");
static_assert(std::get<1>(getP()) == 4, "");
diff --git a/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp b/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp
index 27194effe5c3..f0d55a661822 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
#include <utility>
#include <complex>
@@ -14,11 +15,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
typedef std::complex<float> cf;
auto t1 = std::make_pair<int, double> ( 42, 3.4 );
assert (( std::get<cf>(t1) == cf {1,2} )); // no such type
-#else
-#error
-#endif
}
diff --git a/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type2.fail.cpp b/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type2.fail.cpp
index f9e3942d7e77..72e637592483 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type2.fail.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type2.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
#include <utility>
#include <complex>
@@ -14,11 +15,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
typedef std::complex<float> cf;
auto t1 = std::make_pair<int, int> ( 42, 43 );
assert ( std::get<int>(t1) == 42 ); // two ints
-#else
-#error
-#endif
}
diff --git a/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type3.fail.cpp b/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type3.fail.cpp
index 484347345747..d5179e4355b9 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type3.fail.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type3.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
#include <utility>
#include <complex>
@@ -14,11 +15,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
typedef std::unique_ptr<int> upint;
std::pair<upint, int> t(upint(new int(4)), 23);
upint p = std::get<upint>(t);
-#else
-#error
-#endif
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp
index 4b54f717045a..1117db3297b8 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp
@@ -16,6 +16,8 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -25,10 +27,7 @@ int main()
assert(p2.first == 3);
assert(p2.second == 4);
}
-
- static_assert((std::is_trivially_copy_constructible<std::pair<int, int> >::value), "");
-
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<int, short> P1;
constexpr P1 p1(3, 4);
diff --git a/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
index d83328b8f2d0..97182d24d021 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
@@ -13,9 +13,15 @@
// constexpr pair();
+// This test doesn't pass due to a constexpr bug in GCC 4.9 that fails
+// to initialize any type without a user provided constructor in a constant
+// expression (ie float).
+// XFAIL: gcc-4.9
+
// NOTE: The SFINAE on the default constructor is tested in
// default-sfinae.pass.cpp
+
#include <utility>
#include <type_traits>
#include <cassert>
diff --git a/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp
new file mode 100644
index 000000000000..06cb5e5658c9
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// pair(pair&&) = default;
+
+#include <utility>
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Dummy {
+ Dummy(Dummy const&) = delete;
+ Dummy(Dummy &&) = default;
+};
+
+int main()
+{
+ {
+ typedef std::pair<int, short> P1;
+ static_assert(std::is_move_constructible<P1>::value, "");
+ P1 p1(3, 4);
+ P1 p2 = std::move(p1);
+ assert(p2.first == 3);
+ assert(p2.second == 4);
+ }
+ {
+ using P = std::pair<Dummy, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ }
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
index 0ad5786bce29..dfea61eeacdb 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
@@ -17,7 +17,7 @@
#include <cassert>
struct S {
- int i;
+ int i;
S() : i(0) {}
S(int j) : i(j) {}
S * operator& () { assert(false); return this; }
diff --git a/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
new file mode 100644
index 000000000000..53cf56700df8
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// pair(pair const&) = default;
+// pair(pair&&) = default;
+
+// Doesn't pass due to use of is_trivially_* trait.
+// XFAIL: gcc-4.9
+
+#include <utility>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Dummy {
+ Dummy(Dummy const&) = delete;
+ Dummy(Dummy &&) = default;
+};
+
+int main()
+{
+ typedef std::pair<int, short> P;
+ {
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ }
+#if TEST_STD_VER >= 11
+ {
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ }
+ {
+ using P1 = std::pair<Dummy, int>;
+ static_assert(!std::is_copy_constructible<P1>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P1>::value, "");
+ static_assert(std::is_move_constructible<P1>::value, "");
+ static_assert(std::is_trivially_move_constructible<P1>::value, "");
+ }
+#endif
+}
diff --git a/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp b/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp
index 48e09735abb0..4a6d71e7b9c8 100644
--- a/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp
@@ -23,7 +23,7 @@ int main()
assert(p1.first == 3);
assert(p1.second == 4);
}
-
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<int>, short> P1;
diff --git a/test/std/utilities/utility/synopsis.pass.cpp b/test/std/utilities/utility/synopsis.pass.cpp
new file mode 100644
index 000000000000..5f5b4eeaad52
--- /dev/null
+++ b/test/std/utilities/utility/synopsis.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+// XFAIL: c++98, c++03
+
+// #include <initializer_list>
+
+#include <utility>
+
+int main()
+{
+ std::initializer_list<int> x;
+}
+
diff --git a/test/std/utilities/utility/utility.swap/swap.pass.cpp b/test/std/utilities/utility/utility.swap/swap.pass.cpp
index 8606611f6603..c9c9f3b52760 100644
--- a/test/std/utilities/utility/utility.swap/swap.pass.cpp
+++ b/test/std/utilities/utility/utility.swap/swap.pass.cpp
@@ -16,38 +16,88 @@
#include <utility>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
-#endif
-void
-test()
-{
- int i = 1;
- int j = 2;
- std::swap(i, j);
- assert(i == 2);
- assert(j == 1);
-}
+#include "test_macros.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
+struct CopyOnly {
+ CopyOnly() {}
+ CopyOnly(CopyOnly const&) noexcept {}
+ CopyOnly& operator=(CopyOnly const&) { return *this; }
+};
-void
-test1()
-{
- std::unique_ptr<int> i(new int(1));
- std::unique_ptr<int> j(new int(2));
- std::swap(i, j);
- assert(*i == 2);
- assert(*j == 1);
-}
+struct MoveOnly {
+ MoveOnly() {}
+ MoveOnly(MoveOnly&&) {}
+ MoveOnly& operator=(MoveOnly&&) noexcept { return *this; }
+};
+
+struct NoexceptMoveOnly {
+ NoexceptMoveOnly() {}
+ NoexceptMoveOnly(NoexceptMoveOnly&&) noexcept {}
+ NoexceptMoveOnly& operator=(NoexceptMoveOnly&&) noexcept { return *this; }
+};
+
+struct NotMoveConstructible {
+ NotMoveConstructible& operator=(NotMoveConstructible&&) { return *this; }
+private:
+ NotMoveConstructible(NotMoveConstructible&&);
+};
+
+struct NotMoveAssignable {
+ NotMoveAssignable(NotMoveAssignable&&);
+private:
+ NotMoveAssignable& operator=(NotMoveAssignable&&);
+};
+
+template <class Tp>
+auto can_swap_test(int) -> decltype(std::swap(std::declval<Tp>(), std::declval<Tp>()));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class Tp>
+auto can_swap_test(...) -> std::false_type;
+
+template <class Tp>
+constexpr bool can_swap() {
+ return std::is_same<decltype(can_swap_test<Tp>(0)), void>::value;
+}
+#endif
int main()
{
- test();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- test1();
+
+ {
+ int i = 1;
+ int j = 2;
+ std::swap(i, j);
+ assert(i == 2);
+ assert(j == 1);
+ }
+#if TEST_STD_VER >= 11
+ {
+
+ std::unique_ptr<int> i(new int(1));
+ std::unique_ptr<int> j(new int(2));
+ std::swap(i, j);
+ assert(*i == 2);
+ assert(*j == 1);
+
+ }
+ {
+ // test that the swap
+ static_assert(can_swap<CopyOnly&>(), "");
+ static_assert(can_swap<MoveOnly&>(), "");
+ static_assert(can_swap<NoexceptMoveOnly&>(), "");
+
+ static_assert(!can_swap<NotMoveConstructible&>(), "");
+ static_assert(!can_swap<NotMoveAssignable&>(), "");
+
+ CopyOnly c;
+ MoveOnly m;
+ NoexceptMoveOnly nm;
+ static_assert(!noexcept(std::swap(c, c)), "");
+ static_assert(!noexcept(std::swap(m, m)), "");
+ static_assert(noexcept(std::swap(nm, nm)), "");
+ }
#endif
}
diff --git a/test/std/utilities/utility/utility.swap/swap_array.pass.cpp b/test/std/utilities/utility/utility.swap/swap_array.pass.cpp
index b1209c3c3651..ad39934b20ca 100644
--- a/test/std/utilities/utility/utility.swap/swap_array.pass.cpp
+++ b/test/std/utilities/utility/utility.swap/swap_array.pass.cpp
@@ -16,50 +16,86 @@
#include <utility>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
-#endif
-void
-test()
-{
- int i[3] = {1, 2, 3};
- int j[3] = {4, 5, 6};
- std::swap(i, j);
- assert(i[0] == 4);
- assert(i[1] == 5);
- assert(i[2] == 6);
- assert(j[0] == 1);
- assert(j[1] == 2);
- assert(j[2] == 3);
-}
+#include "test_macros.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void
-test1()
-{
- std::unique_ptr<int> i[3];
- for (int k = 0; k < 3; ++k)
- i[k].reset(new int(k+1));
- std::unique_ptr<int> j[3];
- for (int k = 0; k < 3; ++k)
- j[k].reset(new int(k+4));
- std::swap(i, j);
- assert(*i[0] == 4);
- assert(*i[1] == 5);
- assert(*i[2] == 6);
- assert(*j[0] == 1);
- assert(*j[1] == 2);
- assert(*j[2] == 3);
+#if TEST_STD_VER >= 11
+struct CopyOnly {
+ CopyOnly() {}
+ CopyOnly(CopyOnly const&) noexcept {}
+ CopyOnly& operator=(CopyOnly const&) { return *this; }
+};
+
+
+struct NoexceptMoveOnly {
+ NoexceptMoveOnly() {}
+ NoexceptMoveOnly(NoexceptMoveOnly&&) noexcept {}
+ NoexceptMoveOnly& operator=(NoexceptMoveOnly&&) noexcept { return *this; }
+};
+
+struct NotMoveConstructible {
+ NotMoveConstructible() {}
+ NotMoveConstructible& operator=(NotMoveConstructible&&) { return *this; }
+private:
+ NotMoveConstructible(NotMoveConstructible&&);
+};
+
+template <class Tp>
+auto can_swap_test(int) -> decltype(std::swap(std::declval<Tp>(), std::declval<Tp>()));
+
+template <class Tp>
+auto can_swap_test(...) -> std::false_type;
+
+template <class Tp>
+constexpr bool can_swap() {
+ return std::is_same<decltype(can_swap_test<Tp>(0)), void>::value;
}
+#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
- test();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- test1();
+ {
+ int i[3] = {1, 2, 3};
+ int j[3] = {4, 5, 6};
+ std::swap(i, j);
+ assert(i[0] == 4);
+ assert(i[1] == 5);
+ assert(i[2] == 6);
+ assert(j[0] == 1);
+ assert(j[1] == 2);
+ assert(j[2] == 3);
+ }
+#if TEST_STD_VER >= 11
+ {
+ std::unique_ptr<int> i[3];
+ for (int k = 0; k < 3; ++k)
+ i[k].reset(new int(k+1));
+ std::unique_ptr<int> j[3];
+ for (int k = 0; k < 3; ++k)
+ j[k].reset(new int(k+4));
+ std::swap(i, j);
+ assert(*i[0] == 4);
+ assert(*i[1] == 5);
+ assert(*i[2] == 6);
+ assert(*j[0] == 1);
+ assert(*j[1] == 2);
+ assert(*j[2] == 3);
+ }
+ {
+ using CA = CopyOnly[42];
+ using MA = NoexceptMoveOnly[42];
+ using NA = NotMoveConstructible[42];
+ static_assert(can_swap<CA&>(), "");
+ static_assert(can_swap<MA&>(), "");
+ static_assert(!can_swap<NA&>(), "");
+
+ CA ca;
+ MA ma;
+ static_assert(!noexcept(std::swap(ca, ca)), "");
+ static_assert(noexcept(std::swap(ma, ma)), "");
+ }
#endif
}
diff --git a/test/support/Counter.h b/test/support/Counter.h
index 2bc3642f5059..eb6e04e72ef6 100644
--- a/test/support/Counter.h
+++ b/test/support/Counter.h
@@ -13,7 +13,7 @@
#include <functional> // for std::hash
struct Counter_base { static int gConstructed; };
-
+
template <typename T>
class Counter : public Counter_base
{
@@ -27,7 +27,7 @@ public:
Counter& operator=(Counter&& rhs) { ++gConstructed; data_ = std::move(rhs.data_); return *this; }
#endif
~Counter() { --gConstructed; }
-
+
const T& get() const {return data_;}
bool operator==(const Counter& x) const {return data_ == x.data_;}
diff --git a/test/support/MoveOnly.h b/test/support/MoveOnly.h
index ee6ae7c7e5f9..a3e9cca89ee5 100644
--- a/test/support/MoveOnly.h
+++ b/test/support/MoveOnly.h
@@ -10,6 +10,8 @@
#ifndef MOVEONLY_H
#define MOVEONLY_H
+#include "test_macros.h"
+
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <cstddef>
diff --git a/test/support/allocators.h b/test/support/allocators.h
index 7c2103ff2721..4aa467f824aa 100644
--- a/test/support/allocators.h
+++ b/test/support/allocators.h
@@ -101,7 +101,7 @@ public:
A2& operator=(const A2& a) TEST_NOEXCEPT { id_ = a.id(); copy_called = true; return *this;}
A2& operator=(A2&& a) TEST_NOEXCEPT { id_ = a.id(); move_called = true; return *this;}
- T* allocate(std::size_t n, const void* hint)
+ T* allocate(std::size_t, const void* hint)
{
allocate_called = true;
return (T*)hint;
diff --git a/test/support/asan_testing.h b/test/support/asan_testing.h
index 45ad04b1bb2c..678f12a91b65 100644
--- a/test/support/asan_testing.h
+++ b/test/support/asan_testing.h
@@ -10,12 +10,12 @@
#ifndef ASAN_TESTING_H
#define ASAN_TESTING_H
-#include <__config>
+#include "test_macros.h"
-#ifndef _LIBCPP_HAS_NO_ASAN
+#if TEST_HAS_FEATURE(address_sanitizer)
extern "C" int __sanitizer_verify_contiguous_container
( const void *beg, const void *mid, const void *end );
-
+
template <typename T, typename Alloc>
bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &c )
{
@@ -27,11 +27,11 @@ bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &c )
#else
template <typename T, typename Alloc>
-bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &c )
+bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &)
{
return true;
}
#endif
-
+
#endif // ASAN_TESTING_H
diff --git a/test/support/assert_checkpoint.h b/test/support/assert_checkpoint.h
new file mode 100644
index 000000000000..6627b35eb30d
--- /dev/null
+++ b/test/support/assert_checkpoint.h
@@ -0,0 +1,73 @@
+#ifndef SUPPORT_ASSERT_CHECKPOINT_H
+#define SUPPORT_ASSERT_CHECKPOINT_H
+
+#include <csignal>
+#include <iostream>
+#include <cstdlib>
+
+struct Checkpoint {
+ const char* file;
+ const char* func;
+ int line;
+ const char* msg;
+
+ Checkpoint() : file(nullptr), func(nullptr), line(-1), msg(nullptr) {}
+ Checkpoint(const char* xfile, const char* xfunc, int xline, const char* xmsg)
+ : file(xfile), func(xfunc), line(xline), msg(xmsg)
+ {}
+
+ template <class Stream>
+ void print(Stream& s) const {
+ if (!file) {
+ s << "NO CHECKPOINT\n";
+ return;
+ }
+ s << file << ":" << line << " " << func << ": Checkpoint";
+ if (msg)
+ s << " '" << msg << "'";
+ s << std::endl;
+ }
+};
+
+inline Checkpoint& globalCheckpoint() {
+ static Checkpoint C;
+ return C;
+}
+
+inline void clearCheckpoint() {
+ globalCheckpoint() = Checkpoint();
+}
+
+#if defined(__GNUC__)
+#define CHECKPOINT_FUNCTION_NAME __PRETTY_FUNCTION__
+#else
+#define CHECKPOINT_FUNCTION_NAME __func__
+#endif
+
+#define CHECKPOINT(msg) globalCheckpoint() = Checkpoint(__FILE__, CHECKPOINT_FUNCTION_NAME, __LINE__, msg);
+
+inline void checkpointSignalHandler(int signal) {
+ if (signal == SIGABRT) {
+ globalCheckpoint().print(std::cerr);
+ } else {
+ std::cerr << "Unexpected signal " << signal << " received\n";
+ }
+ std::_Exit(EXIT_FAILURE);
+}
+
+inline bool initCheckpointHandler() {
+ typedef void(*HandlerT)(int);
+ static bool isInit = false;
+ if (isInit) return true;
+ HandlerT prev_h = std::signal(SIGABRT, checkpointSignalHandler);
+ if (prev_h == SIG_ERR) {
+ std::cerr << "Setup failed.\n";
+ std::_Exit(EXIT_FAILURE);
+ }
+ isInit = true;
+ return false;
+}
+
+static bool initDummy = initCheckpointHandler();
+
+#endif
diff --git a/test/support/constexpr_char_traits.hpp b/test/support/constexpr_char_traits.hpp
index b069c90076a2..0a73d3ad1ead 100644
--- a/test/support/constexpr_char_traits.hpp
+++ b/test/support/constexpr_char_traits.hpp
@@ -11,9 +11,9 @@
#ifndef _CONSTEXPR_CHAR_TRAITS
#define _CONSTEXPR_CHAR_TRAITS
-#include <__config>
#include <string>
+#include "test_macros.h"
template <class _CharT>
struct constexpr_char_traits
@@ -24,41 +24,41 @@ struct constexpr_char_traits
typedef std::streampos pos_type;
typedef std::mbstate_t state_type;
- static _LIBCPP_CONSTEXPR_AFTER_CXX11 void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+ static TEST_CONSTEXPR_CXX14 void assign(char_type& __c1, const char_type& __c2) TEST_NOEXCEPT
{__c1 = __c2;}
- static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+ static TEST_CONSTEXPR bool eq(char_type __c1, char_type __c2) TEST_NOEXCEPT
{return __c1 == __c2;}
- static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+ static TEST_CONSTEXPR bool lt(char_type __c1, char_type __c2) TEST_NOEXCEPT
{return __c1 < __c2;}
- static _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(const char_type* __s1, const char_type* __s2, size_t __n);
- static _LIBCPP_CONSTEXPR_AFTER_CXX11 size_t length(const char_type* __s);
- static _LIBCPP_CONSTEXPR_AFTER_CXX11 const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
- static _LIBCPP_CONSTEXPR_AFTER_CXX11 char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
- static _LIBCPP_CONSTEXPR_AFTER_CXX11 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
- static _LIBCPP_CONSTEXPR_AFTER_CXX11 char_type* assign(char_type* __s, size_t __n, char_type __a);
+ static TEST_CONSTEXPR_CXX14 int compare(const char_type* __s1, const char_type* __s2, size_t __n);
+ static TEST_CONSTEXPR_CXX14 size_t length(const char_type* __s);
+ static TEST_CONSTEXPR_CXX14 const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
+ static TEST_CONSTEXPR_CXX14 char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
+ static TEST_CONSTEXPR_CXX14 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
+ static TEST_CONSTEXPR_CXX14 char_type* assign(char_type* __s, size_t __n, char_type __a);
- static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
+ static TEST_CONSTEXPR int_type not_eof(int_type __c) TEST_NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+ static TEST_CONSTEXPR char_type to_char_type(int_type __c) TEST_NOEXCEPT
{return char_type(__c);}
- static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
+ static TEST_CONSTEXPR int_type to_int_type(char_type __c) TEST_NOEXCEPT
{return int_type(__c);}
- static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+ static TEST_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) TEST_NOEXCEPT
{return __c1 == __c2;}
- static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
+ static TEST_CONSTEXPR int_type eof() TEST_NOEXCEPT
{return int_type(EOF);}
};
template <class _CharT>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 int
+TEST_CONSTEXPR_CXX14 int
constexpr_char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
for (; __n; --__n, ++__s1, ++__s2)
@@ -72,7 +72,7 @@ constexpr_char_traits<_CharT>::compare(const char_type* __s1, const char_type* _
}
template <class _CharT>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 size_t
+TEST_CONSTEXPR_CXX14 size_t
constexpr_char_traits<_CharT>::length(const char_type* __s)
{
size_t __len = 0;
@@ -82,7 +82,7 @@ constexpr_char_traits<_CharT>::length(const char_type* __s)
}
template <class _CharT>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 const _CharT*
+TEST_CONSTEXPR_CXX14 const _CharT*
constexpr_char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a)
{
for (; __n; --__n)
@@ -95,7 +95,7 @@ constexpr_char_traits<_CharT>::find(const char_type* __s, size_t __n, const char
}
template <class _CharT>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 _CharT*
+TEST_CONSTEXPR_CXX14 _CharT*
constexpr_char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
{
char_type* __r = __s1;
@@ -115,7 +115,7 @@ constexpr_char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size
}
template <class _CharT>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 _CharT*
+TEST_CONSTEXPR_CXX14 _CharT*
constexpr_char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
@@ -126,7 +126,7 @@ constexpr_char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size
}
template <class _CharT>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 _CharT*
+TEST_CONSTEXPR_CXX14 _CharT*
constexpr_char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
{
char_type* __r = __s;
diff --git a/test/support/container_test_types.h b/test/support/container_test_types.h
new file mode 100644
index 000000000000..0b97f2e94e75
--- /dev/null
+++ b/test/support/container_test_types.h
@@ -0,0 +1,492 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef SUPPORT_CONTAINER_TEST_TYPES_H
+#define SUPPORT_CONTAINER_TEST_TYPES_H
+
+// container_test_types.h - A set of types used for testing STL containers.
+// The types container within this header are used to test the requirements in
+// [container.requirements.general]. The header is made up of 3 main components:
+//
+// * test-types: 'CopyInsertable', 'MoveInsertable' and 'EmplaceConstructible' -
+// These test types are used to test the container requirements of the same
+// name. These test types use the global 'AllocatorConstructController' to
+// assert that they are only constructed by the containers allocator.
+//
+// * test-allocator: 'ContainerTestAllocator' - This test allocator is used to
+// test the portions of [container.requirements.general] that pertain to the
+// containers allocator. The three primary jobs of the test allocator are:
+// 1. Enforce that 'a.construct(...)' and 'a.destroy(...)' are only ever
+// instantiated for 'Container::value_type'.
+// 2. Provide a mechanism of checking calls to 'a.construct(Args...)'.
+// Including controlling when and with what types 'a.construct(...)'
+// may be called with.
+// 3. Support the test types internals by controlling the global
+// 'AllocatorConstructController' object.
+//
+// * 'AllocatorConstructController' - This type defines an interface for testing
+// the construction of types using an allocator. This type is used to communicate
+// between the test author, the containers allocator, and the types
+// being constructed by the container.
+// The controllers primary functions are:
+// 1. Allow calls to 'a.construct(p, args...)' to be checked by a test.
+// The test uses 'cc->expect<Args...>()' to specify that the allocator
+// should expect one call to 'a.construct' with the specified argument
+// types.
+// 2. Controlling the value of 'cc->isInAllocatorConstruct()' within the
+// 'construct' method. The test-types use this value to assert that
+// they are being constructed by the allocator.
+//
+// 'AllocatorConstructController' enforces the Singleton pattern since the
+// test-types, test-allocator and test need to share the same controller
+// object. A pointer to the global controller is returned by
+// 'getConstructController()'.
+//
+//----------------------------------------------------------------------------
+/*
+ * Usage: The following example checks that 'unordered_map::emplace(Args&&...)'
+ * with 'Args = [CopyInsertable<1> const&, CopyInsertible<2>&&]'
+ * calls 'alloc.construct(value_type*, Args&&...)' with the same types.
+ *
+ * // Typedefs for container
+ * using Key = CopyInsertible<1>;
+ * using Value = CopyInsertible<2>;
+ * using ValueTp = std::pair<const Key, Value>;
+ * using Alloc = ContainerTestAllocator<ValueTp, ValueTp>;
+ * using Map = std::unordered_map<Key, Value, std::hash<Key>, std::equal_to<Key>, Alloc>;
+ *
+ * // Get the global controller, reset it, and construct an allocator with
+ * // the controller.
+ * ConstructController* cc = getConstructController();
+ * cc->reset();
+ *
+ * // Create a Map and a Key and Value to insert. Note that the test-allocator
+ * // does not need to be given 'cc'.
+ * Map m;
+ * const Key k(1);
+ * Value v(1);
+ *
+ * // Tell the controller to expect a construction from the specified types.
+ * cc->expect<Key const&, Value&&>();
+ *
+ * // Emplace the objects into the container. 'Alloc.construct(p, UArgs...)'
+ * // will assert 'cc->check<UArgs&&>()' is true which will consume
+ * // the call to 'cc->expect<...>()'.
+ * m.emplace(k, std::move(v));
+ *
+ * // Assert that the "expect" was consumed by a matching "check" call within
+ * // Alloc.
+ * assert(!cc->unexpected());
+ *
+ */
+
+#include <functional>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER < 11
+#error This header requires C++11 or greater
+#endif
+
+namespace detail {
+// TypeID - Represent a unique identifier for a type. TypeID allows equality
+// comparisons between different types.
+struct TypeID {
+ friend bool operator==(TypeID const& LHS, TypeID const& RHS)
+ {return LHS.m_id == RHS.m_id; }
+ friend bool operator!=(TypeID const& LHS, TypeID const& RHS)
+ {return LHS.m_id != RHS.m_id; }
+private:
+ explicit constexpr TypeID(const int* xid) : m_id(xid) {}
+ const int* const m_id;
+ template <class T> friend class TypeInfo;
+};
+
+// TypeInfo - Represent information for the specified type 'T', including a
+// unique TypeID.
+template <class T>
+class TypeInfo {
+public:
+ typedef T value_type;
+ typedef TypeID ID;
+ static ID const& GetID() { static ID id(&dummy_addr); return id; }
+
+private:
+ static const int dummy_addr;
+};
+
+template <class L, class R>
+inline bool operator==(TypeInfo<L> const&, TypeInfo<R> const&)
+{ return std::is_same<L, R>::value; }
+
+template <class L, class R>
+inline bool operator!=(TypeInfo<L> const& lhs, TypeInfo<R> const& rhs)
+{ return !(lhs == rhs); }
+
+template <class T>
+const int TypeInfo<T>::dummy_addr = 42;
+
+// makeTypeID - Return the TypeID for the specified type 'T'.
+template <class T>
+inline constexpr TypeID const& makeTypeID() { return TypeInfo<T>::GetID(); }
+
+template <class ...Args>
+struct ArgumentListID {};
+
+// makeArgumentID - Create and return a unique identifier for a given set
+// of arguments.
+template <class ...Args>
+inline constexpr TypeID const& makeArgumentID() {
+ return makeTypeID<ArgumentListID<Args...>>();
+}
+
+} // namespace detail
+
+//===----------------------------------------------------------------------===//
+// AllocatorConstructController
+//===----------------------------------------------------------------------===//
+
+struct AllocatorConstructController {
+ const detail::TypeID* m_expected_args;
+ bool m_allow_constructions;
+ bool m_allow_unchecked;
+ int m_expected_count;
+
+ void clear() {
+ m_expected_args = nullptr;
+ m_expected_count = -1;
+ }
+
+ // Check for and consume an expected construction added by 'expect'.
+ // Return true if the construction was expected and false otherwise.
+ // This should only be called by 'Allocator.construct'.
+ bool check(detail::TypeID const& tid) {
+ if (!m_expected_args)
+ assert(m_allow_unchecked);
+ bool res = *m_expected_args == tid;
+ if (m_expected_count == -1 || --m_expected_count == -1)
+ m_expected_args = nullptr;
+ return res;
+ }
+
+ // Return true iff there is an unchecked construction expression.
+ bool unchecked() {
+ return m_expected_args != nullptr;
+ }
+
+ // Expect a call to Allocator::construct with Args that match 'tid'.
+ void expect(detail::TypeID const& tid) {
+ assert(!unchecked());
+ m_expected_args = &tid;
+ }
+
+ template <class ...Args>
+ void expect(int times = 1) {
+ assert(!unchecked());
+ assert(times > 0);
+ m_expected_count = times - 1;
+ m_expected_args = &detail::makeArgumentID<Args...>();
+ }
+ template <class ...Args>
+ bool check() {
+ return check(detail::makeArgumentID<Args...>());
+ }
+
+
+ // Return true iff the program is currently within a call to "Allocator::construct"
+ bool isInAllocatorConstruct() const {
+ return m_allow_constructions;
+ }
+
+ void inAllocatorConstruct(bool value = true) {
+ m_allow_constructions = value;
+ }
+
+ void allowUnchecked(bool value = true) {
+ m_allow_unchecked = value;
+ }
+
+ void reset() {
+ m_allow_constructions = false;
+ m_expected_args = nullptr;
+ m_allow_unchecked = false;
+ m_expected_count = -1;
+ }
+
+private:
+ friend AllocatorConstructController* getConstructController();
+ AllocatorConstructController() { reset(); }
+ AllocatorConstructController(AllocatorConstructController const&);
+ AllocatorConstructController& operator=(AllocatorConstructController const&);
+};
+
+typedef AllocatorConstructController ConstructController;
+
+// getConstructController - Return the global allocator construction controller.
+inline ConstructController* getConstructController() {
+ static ConstructController c;
+ return &c;
+}
+
+//===----------------------------------------------------------------------===//
+// ContainerTestAllocator
+//===----------------------------------------------------------------------===//
+
+// ContainerTestAllocator - A STL allocator type that only allows 'construct'
+// and 'destroy' to be called for 'AllowConstructT' types. ContainerTestAllocator
+// uses the 'AllocatorConstructionController' interface.
+template <class T, class AllowConstructT>
+class ContainerTestAllocator
+{
+ struct InAllocatorConstructGuard {
+ ConstructController *m_cc;
+ bool m_old;
+ InAllocatorConstructGuard(ConstructController* cc) : m_cc(cc) {
+ if (m_cc) {
+ m_old = m_cc->isInAllocatorConstruct();
+ m_cc->inAllocatorConstruct(true);
+ }
+ }
+ ~InAllocatorConstructGuard() {
+ if (m_cc) m_cc->inAllocatorConstruct(m_old);
+ }
+ private:
+ InAllocatorConstructGuard(InAllocatorConstructGuard const&);
+ InAllocatorConstructGuard& operator=(InAllocatorConstructGuard const&);
+ };
+
+public:
+ typedef T value_type;
+
+ int construct_called;
+ int destroy_called;
+ ConstructController* controller;
+
+ ContainerTestAllocator() TEST_NOEXCEPT
+ : controller(getConstructController()) {}
+
+ explicit ContainerTestAllocator(ConstructController* c)
+ : controller(c)
+ {}
+
+ template <class U>
+ ContainerTestAllocator(ContainerTestAllocator<U, AllowConstructT> other) TEST_NOEXCEPT
+ : controller(other.controller)
+ {}
+
+ T* allocate(std::size_t n)
+ {
+ return static_cast<T*>(::operator new(n*sizeof(T)));
+ }
+
+ void deallocate(T* p, std::size_t)
+ {
+ return ::operator delete(static_cast<void*>(p));
+ }
+
+ template <class Up, class ...Args>
+ void construct(Up* p, Args&&... args) {
+ static_assert((std::is_same<Up, AllowConstructT>::value),
+ "Only allowed to construct Up");
+ assert(controller->check<Args&&...>());
+ {
+ InAllocatorConstructGuard g(controller);
+ ::new ((void*)p) Up(std::forward<Args>(args)...);
+ }
+ }
+
+ template <class Up>
+ void destroy(Up* p) {
+ static_assert((std::is_same<Up, AllowConstructT>::value),
+ "Only allowed to destroy Up");
+ {
+ InAllocatorConstructGuard g(controller);
+ p->~Up();
+ }
+ }
+
+ friend bool operator==(ContainerTestAllocator, ContainerTestAllocator) {return true;}
+ friend bool operator!=(ContainerTestAllocator x, ContainerTestAllocator y) {return !(x == y);}
+};
+
+
+namespace test_detail {
+typedef ContainerTestAllocator<int, int> A1;
+typedef std::allocator_traits<A1> A1T;
+typedef ContainerTestAllocator<float, int> A2;
+typedef std::allocator_traits<A2> A2T;
+
+static_assert(std::is_same<A1T::rebind_traits<float>, A2T>::value, "");
+static_assert(std::is_same<A2T::rebind_traits<int>, A1T>::value, "");
+} // end namespace test_detail
+
+//===----------------------------------------------------------------------===//
+// 'CopyInsertable', 'MoveInsertable' and 'EmplaceConstructible' test types
+//===----------------------------------------------------------------------===//
+
+template <int Dummy = 0>
+struct CopyInsertable {
+ int data;
+ mutable bool copied_once;
+ bool constructed_under_allocator;
+
+ explicit CopyInsertable(int val) : data(val), copied_once(false),
+ constructed_under_allocator(false) {
+ if (getConstructController()->isInAllocatorConstruct()) {
+ copied_once = true;
+ constructed_under_allocator = true;
+ }
+ }
+
+ CopyInsertable() : data(0), copied_once(false), constructed_under_allocator(true)
+ {
+ assert(getConstructController()->isInAllocatorConstruct());
+ }
+
+ CopyInsertable(CopyInsertable const& other) : data(other.data),
+ copied_once(true),
+ constructed_under_allocator(true) {
+ assert(getConstructController()->isInAllocatorConstruct());
+ assert(other.copied_once == false);
+ other.copied_once = true;
+ }
+
+ CopyInsertable(CopyInsertable& other) : data(other.data), copied_once(true),
+ constructed_under_allocator(true) {
+ assert(getConstructController()->isInAllocatorConstruct());
+ assert(other.copied_once == false);
+ other.copied_once = true;
+ }
+
+ CopyInsertable(CopyInsertable&& other) : CopyInsertable(other) {}
+
+ // Forgive pair for not downcasting this to an lvalue it its constructors.
+ CopyInsertable(CopyInsertable const && other) : CopyInsertable(other) {}
+
+
+ template <class ...Args>
+ CopyInsertable(Args&&... args) {
+ assert(false);
+ }
+
+ ~CopyInsertable() {
+ assert(constructed_under_allocator == getConstructController()->isInAllocatorConstruct());
+ }
+
+ void reset(int value) {
+ data = value;
+ copied_once = false;
+ constructed_under_allocator = false;
+ }
+};
+
+template <int ID>
+bool operator==(CopyInsertable<ID> const& L, CopyInsertable<ID> const& R) {
+ return L.data == R.data;
+}
+
+
+template <int ID>
+bool operator!=(CopyInsertable<ID> const& L, CopyInsertable<ID> const& R) {
+ return L.data != R.data;
+}
+
+template <int ID>
+bool operator <(CopyInsertable<ID> const& L, CopyInsertable<ID> const& R) {
+ return L.data < R.data;
+}
+
+
+#ifdef _LIBCPP_BEGIN_NAMESPACE_STD
+_LIBCPP_BEGIN_NAMESPACE_STD
+#else
+namespace std {
+#endif
+ template <int ID>
+ struct hash< ::CopyInsertable<ID> > {
+ typedef ::CopyInsertable<ID> argument_type;
+ typedef size_t result_type;
+
+ size_t operator()(argument_type const& arg) const {
+ return arg.data;
+ }
+ };
+
+ template <class _Key, class _Value, class _Less, class _Alloc>
+ class map;
+ template <class _Key, class _Value, class _Less, class _Alloc>
+ class multimap;
+ template <class _Value, class _Less, class _Alloc>
+ class set;
+ template <class _Value, class _Less, class _Alloc>
+ class multiset;
+ template <class _Key, class _Value, class _Hash, class _Equals, class _Alloc>
+ class unordered_map;
+ template <class _Key, class _Value, class _Hash, class _Equals, class _Alloc>
+ class unordered_multimap;
+ template <class _Value, class _Hash, class _Equals, class _Alloc>
+ class unordered_set;
+ template <class _Value, class _Hash, class _Equals, class _Alloc>
+ class unordered_multiset;
+
+#ifdef _LIBCPP_END_NAMESPACE_STD
+_LIBCPP_END_NAMESPACE_STD
+#else
+} // end namespace std
+#endif
+
+// TCT - Test container type
+namespace TCT {
+
+template <class Key = CopyInsertable<1>, class Value = CopyInsertable<2>,
+ class ValueTp = std::pair<const Key, Value> >
+using unordered_map =
+ std::unordered_map<Key, Value, std::hash<Key>, std::equal_to<Key>,
+ ContainerTestAllocator<ValueTp, ValueTp> >;
+
+template <class Key = CopyInsertable<1>, class Value = CopyInsertable<2>,
+ class ValueTp = std::pair<const Key, Value> >
+using map =
+ std::map<Key, Value, std::less<Key>,
+ ContainerTestAllocator<ValueTp, ValueTp> >;
+
+template <class Key = CopyInsertable<1>, class Value = CopyInsertable<2>,
+ class ValueTp = std::pair<const Key, Value> >
+using unordered_multimap =
+ std::unordered_multimap<Key, Value, std::hash<Key>, std::equal_to<Key>,
+ ContainerTestAllocator<ValueTp, ValueTp> >;
+
+template <class Key = CopyInsertable<1>, class Value = CopyInsertable<2>,
+ class ValueTp = std::pair<const Key, Value> >
+using multimap =
+ std::multimap<Key, Value, std::less<Key>,
+ ContainerTestAllocator<ValueTp, ValueTp> >;
+
+template <class Value = CopyInsertable<1> >
+using unordered_set =
+ std::unordered_set<Value, std::hash<Value>, std::equal_to<Value>,
+ ContainerTestAllocator<Value, Value> >;
+
+template <class Value = CopyInsertable<1> >
+using set =
+ std::set<Value, std::less<Value>, ContainerTestAllocator<Value, Value> >;
+
+template <class Value = CopyInsertable<1> >
+using unordered_multiset =
+ std::unordered_multiset<Value, std::hash<Value>, std::equal_to<Value>,
+ ContainerTestAllocator<Value, Value> >;
+
+template <class Value = CopyInsertable<1> >
+using multiset =
+ std::multiset<Value, std::less<Value>, ContainerTestAllocator<Value, Value> >;
+
+} // end namespace TCT
+
+
+#endif // SUPPORT_CONTAINER_TEST_TYPES_H
diff --git a/test/support/count_new.hpp b/test/support/count_new.hpp
index e8968a93de98..923e49513487 100644
--- a/test/support/count_new.hpp
+++ b/test/support/count_new.hpp
@@ -14,16 +14,24 @@
# include <cassert>
# include <new>
-#ifndef __has_feature
-# define __has_feature(x) 0
-#endif
+#include "test_macros.h"
-#if __has_feature(address_sanitizer) \
- || __has_feature(memory_sanitizer) \
- || __has_feature(thread_sanitizer)
+#if defined(TEST_HAS_SANITIZERS)
#define DISABLE_NEW_COUNT
#endif
+namespace detail
+{
+ TEST_NORETURN
+ inline void throw_bad_alloc_helper() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw std::bad_alloc();
+#else
+ std::abort();
+#endif
+ }
+}
+
class MemCounter
{
public:
@@ -43,6 +51,11 @@ public:
// code doesn't perform any allocations.
bool disable_allocations;
+ // number of allocations to throw after. Default (unsigned)-1. If
+ // throw_after has the default value it will never be decremented.
+ static const unsigned never_throw_value = static_cast<unsigned>(-1);
+ unsigned throw_after;
+
int outstanding_new;
int new_called;
int delete_called;
@@ -58,6 +71,12 @@ public:
{
assert(disable_allocations == false);
assert(s);
+ if (throw_after == 0) {
+ throw_after = never_throw_value;
+ detail::throw_bad_alloc_helper();
+ } else if (throw_after != never_throw_value) {
+ --throw_after;
+ }
++new_called;
++outstanding_new;
last_new_size = s;
@@ -74,6 +93,12 @@ public:
{
assert(disable_allocations == false);
assert(s);
+ if (throw_after == 0) {
+ throw_after = never_throw_value;
+ detail::throw_bad_alloc_helper();
+ } else {
+ // don't decrement throw_after here. newCalled will end up doing that.
+ }
++outstanding_array_new;
++new_array_called;
last_new_array_size = s;
@@ -96,9 +121,11 @@ public:
disable_allocations = false;
}
+
void reset()
{
disable_allocations = false;
+ throw_after = never_throw_value;
outstanding_new = 0;
new_called = 0;
@@ -132,6 +159,11 @@ public:
return disable_checking || n != new_called;
}
+ bool checkNewCalledGreaterThan(int n) const
+ {
+ return disable_checking || new_called > n;
+ }
+
bool checkDeleteCalledEq(int n) const
{
return disable_checking || n == delete_called;
@@ -205,7 +237,10 @@ MemCounter globalMemCounter((MemCounter::MemCounterCtorArg_()));
void* operator new(std::size_t s) throw(std::bad_alloc)
{
globalMemCounter.newCalled(s);
- return std::malloc(s);
+ void* ret = std::malloc(s);
+ if (ret == nullptr)
+ detail::throw_bad_alloc_helper();
+ return ret;
}
void operator delete(void* p) throw()
@@ -255,4 +290,33 @@ private:
DisableAllocationGuard& operator=(DisableAllocationGuard const&);
};
+
+struct RequireAllocationGuard {
+ explicit RequireAllocationGuard(std::size_t RequireAtLeast = 1)
+ : m_req_alloc(RequireAtLeast),
+ m_new_count_on_init(globalMemCounter.new_called),
+ m_outstanding_new_on_init(globalMemCounter.outstanding_new),
+ m_exactly(false)
+ {
+ }
+
+ void requireAtLeast(std::size_t N) { m_req_alloc = N; m_exactly = false; }
+ void requireExactly(std::size_t N) { m_req_alloc = N; m_exactly = true; }
+
+ ~RequireAllocationGuard() {
+ assert(globalMemCounter.checkOutstandingNewEq(m_outstanding_new_on_init));
+ std::size_t Expect = m_new_count_on_init + m_req_alloc;
+ assert(globalMemCounter.checkNewCalledEq(Expect) ||
+ (!m_exactly && globalMemCounter.checkNewCalledGreaterThan(Expect)));
+ }
+
+private:
+ std::size_t m_req_alloc;
+ const std::size_t m_new_count_on_init;
+ const std::size_t m_outstanding_new_on_init;
+ bool m_exactly;
+ RequireAllocationGuard(RequireAllocationGuard const&);
+ RequireAllocationGuard& operator=(RequireAllocationGuard const&);
+};
+
#endif /* COUNT_NEW_HPP */
diff --git a/test/support/counting_predicates.hpp b/test/support/counting_predicates.hpp
index aab6a9785772..2bd1426934e5 100644
--- a/test/support/counting_predicates.hpp
+++ b/test/support/counting_predicates.hpp
@@ -16,11 +16,11 @@ struct unary_counting_predicate : public std::unary_function<Arg, bool> {
public:
unary_counting_predicate(Predicate p) : p_(p), count_(0) {}
~unary_counting_predicate() {}
-
+
bool operator () (const Arg &a) const { ++count_; return p_(a); }
size_t count() const { return count_; }
void reset() { count_ = 0; }
-
+
private:
Predicate p_;
mutable size_t count_;
@@ -33,7 +33,7 @@ public:
binary_counting_predicate ( Predicate p ) : p_(p), count_(0) {}
~binary_counting_predicate() {}
-
+
bool operator () (const Arg1 &a1, const Arg2 &a2) const { ++count_; return p_(a1, a2); }
size_t count() const { return count_; }
void reset() { count_ = 0; }
diff --git a/test/support/disable_missing_braces_warning.h b/test/support/disable_missing_braces_warning.h
index 97fd8a89a51a..c53eef8a951d 100644
--- a/test/support/disable_missing_braces_warning.h
+++ b/test/support/disable_missing_braces_warning.h
@@ -11,6 +11,8 @@
// std::array is explicitly allowed to be initialized with A a = { init-list };.
// Disable the missing braces warning for this reason.
+#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wmissing-braces"
+#endif
#endif // SUPPORT_DISABLE_MISSING_BRACES_WARNING_H
diff --git a/test/support/filesystem_dynamic_test_helper.py b/test/support/filesystem_dynamic_test_helper.py
new file mode 100644
index 000000000000..1f48c9527982
--- /dev/null
+++ b/test/support/filesystem_dynamic_test_helper.py
@@ -0,0 +1,85 @@
+import sys
+import os
+import stat
+
+# Ensure that this is being run on a specific platform
+assert sys.platform.startswith('linux') or sys.platform.startswith('darwin') \
+ or sys.platform.startswith('cygwin') or sys.platform.startswith('freebsd')
+
+def env_path():
+ ep = os.environ.get('LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT')
+ assert ep is not None
+ ep = os.path.realpath(ep)
+ assert os.path.isdir(ep)
+ return ep
+
+env_path_global = env_path()
+
+# Make sure we don't try and write outside of env_path.
+# All paths used should be sanitized
+def sanitize(p):
+ p = os.path.realpath(p)
+ if os.path.commonprefix([env_path_global, p]):
+ return p
+ assert False
+
+"""
+Some of the tests restrict permissions to induce failures.
+Before we delete the test enviroment, we have to walk it and re-raise the
+permissions.
+"""
+def clean_recursive(root_p):
+ if not os.path.islink(root_p):
+ os.chmod(root_p, 0o777)
+ for ent in os.listdir(root_p):
+ p = os.path.join(root_p, ent)
+ if os.path.islink(p) or not os.path.isdir(p):
+ os.remove(p)
+ else:
+ assert os.path.isdir(p)
+ clean_recursive(p)
+ os.rmdir(p)
+
+
+def init_test_directory(root_p):
+ root_p = sanitize(root_p)
+ assert not os.path.exists(root_p)
+ os.makedirs(root_p)
+
+
+def destroy_test_directory(root_p):
+ root_p = sanitize(root_p)
+ clean_recursive(root_p)
+ os.rmdir(root_p)
+
+
+def create_file(fname, size):
+ with open(sanitize(fname), 'w') as f:
+ f.write('c' * size)
+
+
+def create_dir(dname):
+ os.mkdir(sanitize(dname))
+
+
+def create_symlink(source, link):
+ os.symlink(sanitize(source), sanitize(link))
+
+
+def create_hardlink(source, link):
+ os.link(sanitize(source), sanitize(link))
+
+
+def create_fifo(source):
+ os.mkfifo(sanitize(source))
+
+
+def create_socket(source):
+ mode = 0600|stat.S_IFSOCK
+ os.mknod(sanitize(source), mode)
+
+
+if __name__ == '__main__':
+ command = " ".join(sys.argv[1:])
+ eval(command)
+ sys.exit(0)
diff --git a/test/support/filesystem_test_helper.hpp b/test/support/filesystem_test_helper.hpp
new file mode 100644
index 000000000000..7150f79739b6
--- /dev/null
+++ b/test/support/filesystem_test_helper.hpp
@@ -0,0 +1,403 @@
+#ifndef FILESYSTEM_TEST_HELPER_HPP
+#define FILESYSTEM_TEST_HELPER_HPP
+
+#include <experimental/filesystem>
+#include <cassert>
+#include <cstdio> // for printf
+#include <string>
+#include <fstream>
+#include <random>
+#include <chrono>
+
+namespace fs = std::experimental::filesystem;
+
+// static test helpers
+
+#ifndef LIBCXX_FILESYSTEM_STATIC_TEST_ROOT
+#warning "STATIC TESTS DISABLED"
+#else // LIBCXX_FILESYSTEM_STATIC_TEST_ROOT
+
+namespace StaticEnv {
+
+inline fs::path makePath(fs::path const& p) {
+ // env_path is expected not to contain symlinks.
+ static const fs::path env_path = LIBCXX_FILESYSTEM_STATIC_TEST_ROOT;
+ return env_path / p;
+}
+
+static const fs::path Root = LIBCXX_FILESYSTEM_STATIC_TEST_ROOT;
+
+static const fs::path TestFileList[] = {
+ makePath("empty_file"),
+ makePath("non_empty_file"),
+ makePath("dir1/file1"),
+ makePath("dir1/file2")
+};
+const std::size_t TestFileListSize = sizeof(TestFileList) / sizeof(fs::path);
+
+static const fs::path TestDirList[] = {
+ makePath("dir1"),
+ makePath("dir1/dir2"),
+ makePath("dir1/dir2/dir3")
+};
+const std::size_t TestDirListSize = sizeof(TestDirList) / sizeof(fs::path);
+
+static const fs::path File = TestFileList[0];
+static const fs::path Dir = TestDirList[0];
+static const fs::path Dir2 = TestDirList[1];
+static const fs::path Dir3 = TestDirList[2];
+static const fs::path SymlinkToFile = makePath("symlink_to_empty_file");
+static const fs::path SymlinkToDir = makePath("symlink_to_dir");
+static const fs::path BadSymlink = makePath("bad_symlink");
+static const fs::path DNE = makePath("DNE");
+static const fs::path EmptyFile = TestFileList[0];
+static const fs::path NonEmptyFile = TestFileList[1];
+static const fs::path CharFile = "/dev/null"; // Hopefully this exists
+
+static const fs::path DirIterationList[] = {
+ makePath("dir1/dir2"),
+ makePath("dir1/file1"),
+ makePath("dir1/file2")
+};
+const std::size_t DirIterationListSize = sizeof(DirIterationList)
+ / sizeof(fs::path);
+
+static const fs::path DirIterationListDepth1[] = {
+ makePath("dir1/dir2/afile3"),
+ makePath("dir1/dir2/dir3"),
+ makePath("dir1/dir2/symlink_to_dir3"),
+ makePath("dir1/dir2/file4"),
+};
+
+static const fs::path RecDirIterationList[] = {
+ makePath("dir1/dir2"),
+ makePath("dir1/file1"),
+ makePath("dir1/file2"),
+ makePath("dir1/dir2/afile3"),
+ makePath("dir1/dir2/dir3"),
+ makePath("dir1/dir2/symlink_to_dir3"),
+ makePath("dir1/dir2/file4"),
+ makePath("dir1/dir2/dir3/file5")
+};
+
+static const fs::path RecDirFollowSymlinksIterationList[] = {
+ makePath("dir1/dir2"),
+ makePath("dir1/file1"),
+ makePath("dir1/file2"),
+ makePath("dir1/dir2/afile3"),
+ makePath("dir1/dir2/dir3"),
+ makePath("dir1/dir2/file4"),
+ makePath("dir1/dir2/dir3/file5"),
+ makePath("dir1/dir2/symlink_to_dir3"),
+ makePath("dir1/dir2/symlink_to_dir3/file5"),
+};
+
+} // namespace StaticEnv
+
+#endif // LIBCXX_FILESYSTEM_STATIC_TEST_ROOT
+
+#ifndef LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT
+#warning LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT must be defined
+#else // LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT
+
+#ifndef LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER
+#error LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER must be defined
+#endif
+
+struct scoped_test_env
+{
+ scoped_test_env() : test_root(random_env_path())
+ { fs_helper_run(fs_make_cmd("init_test_directory", test_root)); }
+
+ ~scoped_test_env()
+ { fs_helper_run(fs_make_cmd("destroy_test_directory", test_root)); }
+
+ scoped_test_env(scoped_test_env const &) = delete;
+ scoped_test_env & operator=(scoped_test_env const &) = delete;
+
+ fs::path make_env_path(std::string p) { return sanitize_path(p); }
+
+ std::string sanitize_path(std::string raw) {
+ assert(raw.find("..") == std::string::npos);
+ std::string const& root = test_root.native();
+ if (root.compare(0, root.size(), raw, 0, root.size()) != 0) {
+ assert(raw.front() != '\\');
+ fs::path tmp(test_root);
+ tmp /= raw;
+ return std::move(const_cast<std::string&>(tmp.native()));
+ }
+ return raw;
+ }
+
+ std::string create_file(std::string filename, std::size_t size = 0) {
+ filename = sanitize_path(std::move(filename));
+ std::string out_str(size, 'a');
+ {
+ std::ofstream out(filename.c_str());
+ out << out_str;
+ }
+ return filename;
+ }
+
+ std::string create_dir(std::string filename) {
+ filename = sanitize_path(std::move(filename));
+ fs_helper_run(fs_make_cmd("create_dir", filename));
+ return filename;
+ }
+
+ std::string create_symlink(std::string source, std::string to) {
+ source = sanitize_path(std::move(source));
+ to = sanitize_path(std::move(to));
+ fs_helper_run(fs_make_cmd("create_symlink", source, to));
+ return to;
+ }
+
+ std::string create_hardlink(std::string source, std::string to) {
+ source = sanitize_path(std::move(source));
+ to = sanitize_path(std::move(to));
+ fs_helper_run(fs_make_cmd("create_hardlink", source, to));
+ return to;
+ }
+
+ std::string create_fifo(std::string file) {
+ file = sanitize_path(std::move(file));
+ fs_helper_run(fs_make_cmd("create_fifo", file));
+ return file;
+ }
+
+ // OS X and FreeBSD doesn't support socket files so we shouldn't even
+ // allow tests to call this unguarded.
+#if !defined(__FreeBSD__) && !defined(__APPLE__)
+ std::string create_socket(std::string file) {
+ file = sanitize_path(std::move(file));
+ fs_helper_run(fs_make_cmd("create_socket", file));
+ return file;
+ }
+#endif
+
+ fs::path const test_root;
+
+private:
+ static char to_hex(int ch) {
+ return ch < 10 ? static_cast<char>('0' + ch)
+ : static_cast<char>('a' + (ch - 10));
+ }
+
+ static char random_hex_char() {
+ static std::mt19937 rd { std::random_device{}() };
+ static std::uniform_int_distribution<int> mrand{0, 15};
+ return to_hex( mrand(rd) );
+ }
+
+ static std::string unique_path_suffix() {
+ std::string model = "test.%%%%%%";
+ for (auto & ch : model) {
+ if (ch == '%') ch = random_hex_char();
+ }
+ return model;
+ }
+
+ // This could potentially introduce a filesystem race with other tests
+ // running at the same time, but oh well, it's just test code.
+ static inline fs::path random_env_path() {
+ static const char* env_path = LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT;
+ fs::path p = fs::path(env_path) / unique_path_suffix();
+ assert(p.parent_path() == env_path);
+ return p;
+ }
+
+ static inline std::string make_arg(std::string const& arg) {
+ return "'" + arg + "'";
+ }
+
+ static inline std::string make_arg(std::size_t arg) {
+ return std::to_string(arg);
+ }
+
+ template <class T>
+ static inline std::string
+ fs_make_cmd(std::string const& cmd_name, T const& arg) {
+ return cmd_name + "(" + make_arg(arg) + ")";
+ }
+
+ template <class T, class U>
+ static inline std::string
+ fs_make_cmd(std::string const& cmd_name, T const& arg1, U const& arg2) {
+ return cmd_name + "(" + make_arg(arg1) + ", " + make_arg(arg2) + ")";
+ }
+
+ static inline void fs_helper_run(std::string const& raw_cmd) {
+ // check that the fs test root in the enviroment matches what we were
+ // compiled with.
+ static bool checked = checkDynamicTestRoot();
+ std::string cmd = LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER;
+ cmd += " \"" + raw_cmd + "\"";
+ int ret = std::system(cmd.c_str());
+ assert(ret == 0);
+ }
+
+ static bool checkDynamicTestRoot() {
+ // LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT is expected not to contain symlinks.
+ char* fs_root = std::getenv("LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT");
+ if (!fs_root) {
+ std::printf("ERROR: LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT must be a defined "
+ "environment variable when running the test.\n");
+ std::abort();
+ }
+ if (std::string(fs_root) != LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT) {
+ std::printf("ERROR: LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT enviroment variable"
+ " must have the same value as when the test was compiled.\n");
+ std::printf(" Current Value: '%s'\n", fs_root);
+ std::printf(" Expected Value: '%s'\n", LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT);
+ std::abort();
+ }
+ return true;
+ }
+
+};
+
+#endif // LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT
+
+// Misc test types
+
+#define CONCAT2(LHS, RHS) LHS##RHS
+#define CONCAT(LHS, RHS) CONCAT2(LHS, RHS)
+#define MKSTR(Str) {Str, CONCAT(L, Str), CONCAT(u, Str), CONCAT(U, Str)}
+
+struct MultiStringType {
+ const char* s;
+ const wchar_t* w;
+ const char16_t* u16;
+ const char32_t* u32;
+
+ operator const char* () const { return s; }
+ operator const wchar_t* () const { return w; }
+ operator const char16_t* () const { return u16; }
+ operator const char32_t* () const { return u32; }
+};
+
+const MultiStringType PathList[] = {
+ MKSTR(""),
+ MKSTR(" "),
+ MKSTR("//"),
+ MKSTR("."),
+ MKSTR(".."),
+ MKSTR("foo"),
+ MKSTR("/"),
+ MKSTR("/foo"),
+ MKSTR("foo/"),
+ MKSTR("/foo/"),
+ MKSTR("foo/bar"),
+ MKSTR("/foo/bar"),
+ MKSTR("//net"),
+ MKSTR("//net/foo"),
+ MKSTR("///foo///"),
+ MKSTR("///foo///bar"),
+ MKSTR("/."),
+ MKSTR("./"),
+ MKSTR("/.."),
+ MKSTR("../"),
+ MKSTR("foo/."),
+ MKSTR("foo/.."),
+ MKSTR("foo/./"),
+ MKSTR("foo/./bar"),
+ MKSTR("foo/../"),
+ MKSTR("foo/../bar"),
+ MKSTR("c:"),
+ MKSTR("c:/"),
+ MKSTR("c:foo"),
+ MKSTR("c:/foo"),
+ MKSTR("c:foo/"),
+ MKSTR("c:/foo/"),
+ MKSTR("c:/foo/bar"),
+ MKSTR("prn:"),
+ MKSTR("c:\\"),
+ MKSTR("c:\\foo"),
+ MKSTR("c:foo\\"),
+ MKSTR("c:\\foo\\"),
+ MKSTR("c:\\foo/"),
+ MKSTR("c:/foo\\bar"),
+ MKSTR("//"),
+ MKSTR("/finally/we/need/one/really/really/really/really/really/really/really/long/string")
+};
+const unsigned PathListSize = sizeof(PathList) / sizeof(MultiStringType);
+
+template <class Iter>
+Iter IterEnd(Iter B) {
+ using VT = typename std::iterator_traits<Iter>::value_type;
+ for (; *B != VT{}; ++B)
+ ;
+ return B;
+}
+
+template <class CharT>
+const CharT* StrEnd(CharT const* P) {
+ return IterEnd(P);
+}
+
+template <class CharT>
+std::size_t StrLen(CharT const* P) {
+ return StrEnd(P) - P;
+}
+
+// Testing the allocation behavior of the code_cvt functions requires
+// *knowing* that the allocation was not done by "path::__str_".
+// This hack forces path to allocate enough memory.
+inline void PathReserve(fs::path& p, std::size_t N) {
+ auto const& native_ref = p.native();
+ const_cast<std::string&>(native_ref).reserve(N);
+}
+
+template <class Iter1, class Iter2>
+bool checkCollectionsEqual(
+ Iter1 start1, Iter1 const end1
+ , Iter2 start2, Iter2 const end2
+ )
+{
+ while (start1 != end1 && start2 != end2) {
+ if (*start1 != *start2) {
+ return false;
+ }
+ ++start1; ++start2;
+ }
+ return (start1 == end1 && start2 == end2);
+}
+
+
+template <class Iter1, class Iter2>
+bool checkCollectionsEqualBackwards(
+ Iter1 const start1, Iter1 end1
+ , Iter2 const start2, Iter2 end2
+ )
+{
+ while (start1 != end1 && start2 != end2) {
+ --end1; --end2;
+ if (*end1 != *end2) {
+ return false;
+ }
+ }
+ return (start1 == end1 && start2 == end2);
+}
+
+// We often need to test that the error_code was cleared if no error occurs
+// this function returns a error_code which is set to an error that will
+// never be returned by the filesystem functions.
+inline std::error_code GetTestEC() {
+ return std::make_error_code(std::errc::address_family_not_supported);
+}
+
+// Provide our own Sleep routine since std::this_thread::sleep_for is not
+// available in single-threaded mode.
+void SleepFor(std::chrono::seconds dur) {
+ using namespace std::chrono;
+#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK)
+ using Clock = system_clock;
+#else
+ using Clock = steady_clock;
+#endif
+ const auto wake_time = Clock::now() + dur;
+ while (Clock::now() < wake_time)
+ ;
+}
+
+#endif /* FILESYSTEM_TEST_HELPER_HPP */
diff --git a/test/support/hexfloat.h b/test/support/hexfloat.h
index 7ef093714fed..19008d1d54ab 100644
--- a/test/support/hexfloat.h
+++ b/test/support/hexfloat.h
@@ -15,7 +15,6 @@
#ifndef HEXFLOAT_H
#define HEXFLOAT_H
-#include <algorithm>
#include <cmath>
#include <climits>
@@ -23,13 +22,26 @@ template <class T>
class hexfloat
{
T value_;
+
+ static int CountLeadingZeros(unsigned long long n) {
+ const std::size_t Digits = sizeof(unsigned long long) * CHAR_BIT;
+ const unsigned long long TopBit = 1ull << (Digits - 1);
+ if (n == 0) return Digits;
+ int LeadingZeros = 0;
+ while ((n & TopBit) == 0) {
+ ++LeadingZeros;
+ n <<= 1;
+ }
+ return LeadingZeros;
+ }
+
public:
hexfloat(long long m1, unsigned long long m0, int exp)
{
- const std::size_t n = sizeof(unsigned long long) * CHAR_BIT;
+ const std::size_t Digits = sizeof(unsigned long long) * CHAR_BIT;
int s = m1 < 0 ? -1 : 1;
- value_ = std::ldexp(m1 + s * std::ldexp(T(m0), -static_cast<int>(n -
- std::__clz(m0)/4*4)), exp);
+ int exp2 = -static_cast<int>(Digits - CountLeadingZeros(m0)/4*4);
+ value_ = std::ldexp(m1 + s * std::ldexp(T(m0), exp2), exp);
}
operator T() const {return value_;}
diff --git a/test/support/is_transparent.h b/test/support/is_transparent.h
index 58255248abc9..d76b00536b52 100644
--- a/test/support/is_transparent.h
+++ b/test/support/is_transparent.h
@@ -10,7 +10,7 @@
#ifndef TRANSPARENT_H
#define TRANSPARENT_H
-// testing transparent
+// testing transparent
#if _LIBCPP_STD_VER > 11
struct transparent_less
@@ -63,7 +63,7 @@ struct C2Int { // comparable to int
private:
int i_;
};
-
+
bool operator <(int rhs, const C2Int& lhs) { return rhs < lhs.get(); }
bool operator <(const C2Int& rhs, const C2Int& lhs) { return rhs.get() < lhs.get(); }
bool operator <(const C2Int& rhs, int lhs) { return rhs.get() < lhs; }
diff --git a/test/support/min_allocator.h b/test/support/min_allocator.h
index 5e3ae5d2a136..701159e0481a 100644
--- a/test/support/min_allocator.h
+++ b/test/support/min_allocator.h
@@ -11,6 +11,9 @@
#define MIN_ALLOCATOR_H
#include <cstddef>
+#include <cstdlib>
+#include <cstddef>
+#include <cassert>
#include "test_macros.h"
@@ -39,8 +42,59 @@ public:
friend bool operator!=(bare_allocator x, bare_allocator y) {return !(x == y);}
};
+struct malloc_allocator_base {
+ static size_t alloc_count;
+ static size_t dealloc_count;
+ static bool disable_default_constructor;
+
+ static size_t outstanding_alloc() {
+ assert(alloc_count >= dealloc_count);
+ return (alloc_count - dealloc_count);
+ }
+
+ static void reset() {
+ assert(outstanding_alloc() == 0);
+ disable_default_constructor = false;
+ alloc_count = 0;
+ dealloc_count = 0;
+ }
+};
+
+
+size_t malloc_allocator_base::alloc_count = 0;
+size_t malloc_allocator_base::dealloc_count = 0;
+bool malloc_allocator_base::disable_default_constructor = false;
+
+
+template <class T>
+class malloc_allocator : public malloc_allocator_base
+{
+public:
+ typedef T value_type;
+
+ malloc_allocator() TEST_NOEXCEPT { assert(!disable_default_constructor); }
+
+ template <class U>
+ malloc_allocator(malloc_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n)
+ {
+ ++alloc_count;
+ return static_cast<T*>(std::malloc(n*sizeof(T)));
+ }
+
+ void deallocate(T* p, std::size_t)
+ {
+ ++dealloc_count;
+ std::free(static_cast<void*>(p));
+ }
+
+ friend bool operator==(malloc_allocator, malloc_allocator) {return true;}
+ friend bool operator!=(malloc_allocator x, malloc_allocator y) {return !(x == y);}
+};
+
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
#include <memory>
@@ -286,6 +340,6 @@ public:
friend bool operator!=(min_allocator x, min_allocator y) {return !(x == y);}
};
-#endif // __cplusplus >= 201103L
+#endif // TEST_STD_VER >= 11
#endif // MIN_ALLOCATOR_H
diff --git a/test/support/nasty_containers.hpp b/test/support/nasty_containers.hpp
index 5a2e19505424..b571469227d4 100644
--- a/test/support/nasty_containers.hpp
+++ b/test/support/nasty_containers.hpp
@@ -7,9 +7,10 @@
//
//===----------------------------------------------------------------------===//
-#ifndef NASTY_VECTOR_H
-#define NASTY_VECTOR_H
+#ifndef NASTY_CONTAINERS_H
+#define NASTY_CONTAINERS_H
+#include <cassert>
#include <vector>
#include <list>
@@ -99,7 +100,7 @@ public:
{ return v_.emplace(pos, std::forward<Args>(args)...); }
#endif
#endif
-
+
iterator insert(const_iterator pos, const value_type& x) { return v_.insert(pos, x); }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
iterator insert(const_iterator pos, value_type&& x) { return v_.insert(pos, std::forward<value_type>(x)); }
@@ -123,10 +124,10 @@ public:
void swap(nasty_vector &nv) _NOEXCEPT_(std::__is_nothrow_swappable<nested_container>::value)
{ v_.swap(nv.v_); }
-
- nasty_vector *operator &() { return nullptr; } // nasty
- const nasty_vector *operator &() const { return nullptr; } // nasty
-
+
+ nasty_vector *operator &() { assert(false); return nullptr; } // nasty
+ const nasty_vector *operator &() const { assert(false); return nullptr; } // nasty
+
nested_container v_;
};
@@ -220,7 +221,7 @@ public:
{ return l_.emplace(pos, std::forward<Args>(args)...); }
#endif
#endif
-
+
iterator insert(const_iterator pos, const value_type& x) { return l_.insert(pos, x); }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
iterator insert(const_iterator pos, value_type&& x) { return l_.insert(pos, std::forward<value_type>(x)); }
@@ -242,7 +243,7 @@ public:
void swap(nasty_list &nl) _NOEXCEPT_(std::__is_nothrow_swappable<nested_container>::value)
{ l_.swap(nl.l_); }
-
+
void clear() _NOEXCEPT { l_.clear(); }
// void splice(const_iterator position, list& x);
@@ -253,7 +254,7 @@ public:
// const_iterator last);
// void splice(const_iterator position, list&& x, const_iterator first,
// const_iterator last);
-//
+//
// void remove(const value_type& value);
// template <class Pred> void remove_if(Pred pred);
// void unique();
@@ -270,8 +271,8 @@ public:
// void sort(Compare comp);
// void reverse() noexcept;
- nasty_list *operator &() { return nullptr; } // nasty
- const nasty_list *operator &() const { return nullptr; } // nasty
+ nasty_list *operator &() { assert(false); return nullptr; } // nasty
+ const nasty_list *operator &() const { assert(false); return nullptr; } // nasty
nested_container l_;
};
@@ -279,4 +280,30 @@ public:
template <class T>
bool operator==(const nasty_list<T>& x, const nasty_list<T>& y) { return x.l_ == y.l_; }
+// Not really a mutex, but can play one in tests
+class nasty_mutex
+{
+public:
+ nasty_mutex() _NOEXCEPT {}
+ ~nasty_mutex() {}
+
+ nasty_mutex *operator& () { assert(false); return nullptr; }
+ template <typename T>
+ void operator, (const T &) { assert(false); }
+
+private:
+ nasty_mutex(const nasty_mutex&) { assert(false); }
+ nasty_mutex& operator=(const nasty_mutex&) { assert(false); return *this; }
+
+public:
+ void lock() {}
+ bool try_lock() _NOEXCEPT { return true; }
+ void unlock() _NOEXCEPT {}
+
+ // Shared ownership
+ void lock_shared() {}
+ bool try_lock_shared() { return true; }
+ void unlock_shared() {}
+};
+
#endif
diff --git a/test/support/platform_support.h b/test/support/platform_support.h
index 233e721ff515..f4c2247e0dfb 100644
--- a/test/support/platform_support.h
+++ b/test/support/platform_support.h
@@ -15,8 +15,6 @@
#ifndef PLATFORM_SUPPORT_H
#define PLATFORM_SUPPORT_H
-#include <__config>
-
// locale names
#ifdef _WIN32
// WARNING: Windows does not support UTF-8 codepages.
@@ -54,8 +52,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string>
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
-#include <io.h> // _mktemp
+#if defined(_WIN32) || defined(__MINGW32__)
+#include <io.h> // _mktemp_s
#else
#include <unistd.h> // close
#endif
@@ -67,17 +65,20 @@ extern "C" {
}
#endif
-#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+#ifndef __CloudABI__
inline
-std::string
-get_temp_file_name()
+std::string get_temp_file_name()
{
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
- char Path[MAX_PATH+1];
- char FN[MAX_PATH+1];
+#if defined(__MINGW32__)
+ char Path[MAX_PATH + 1];
+ char FN[MAX_PATH + 1];
do { } while (0 == GetTempPath(MAX_PATH+1, Path));
do { } while (0 == GetTempFileName(Path, "libcxx", 0, FN));
return FN;
+#elif defined(_WIN32)
+ char Name[] = "libcxx.XXXXXX";
+ if (_mktemp_s(Name, sizeof(Name)) != 0) abort();
+ return Name;
#else
std::string Name;
int FD = -1;
@@ -93,6 +94,6 @@ get_temp_file_name()
return Name;
#endif
}
-#endif // _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+#endif // __CloudABI__
#endif // PLATFORM_SUPPORT_H
diff --git a/test/support/propagate_const_helpers.h b/test/support/propagate_const_helpers.h
new file mode 100644
index 000000000000..581565a34270
--- /dev/null
+++ b/test/support/propagate_const_helpers.h
@@ -0,0 +1,119 @@
+ // A lightweight class, with pointer-like methods, that contains an int
+struct X
+{
+ int i_;
+
+ constexpr const int &operator*() const { return i_; }
+ constexpr int &operator*() { return i_; }
+ constexpr const int *get() const { return &i_; }
+ constexpr int *get() { return &i_; }
+ constexpr const int *operator->() const { return &i_; }
+ constexpr int *operator->() { return &i_; }
+
+ constexpr X(int i) : i_(i) {}
+};
+
+struct XWithImplicitIntStarConversion
+{
+ int i_;
+
+ constexpr const int &operator*() const { return i_; }
+ constexpr int &operator*() { return i_; }
+ constexpr const int *get() const { return &i_; }
+ constexpr int *get() { return &i_; }
+ constexpr const int *operator->() const { return &i_; }
+ constexpr int *operator->() { return &i_; }
+ constexpr operator int* () { return &i_; }
+
+ constexpr XWithImplicitIntStarConversion(int i) : i_(i) {}
+};
+
+struct XWithImplicitConstIntStarConversion
+{
+ int i_;
+
+ constexpr const int &operator*() const { return i_; }
+ constexpr int &operator*() { return i_; }
+ constexpr const int *get() const { return &i_; }
+ constexpr int *get() { return &i_; }
+ constexpr const int *operator->() const { return &i_; }
+ constexpr int *operator->() { return &i_; }
+ constexpr operator const int* () const { return &i_; }
+
+ constexpr XWithImplicitConstIntStarConversion(int i) : i_(i) {}
+};
+
+struct ExplicitX
+{
+ int i_;
+
+ constexpr const int &operator*() const { return i_; }
+ constexpr int &operator*() { return i_; }
+ constexpr const int *get() const { return &i_; }
+ constexpr int *get() { return &i_; }
+ constexpr const int *operator->() const { return &i_; }
+ constexpr int *operator->() { return &i_; }
+
+ constexpr explicit ExplicitX(int i) : i_(i) {}
+};
+
+struct MoveConstructibleFromX
+{
+ int i_;
+
+ constexpr const int &operator*() const { return i_; }
+ constexpr int &operator*() { return i_; }
+ constexpr const int *get() const { return &i_; }
+ constexpr int *get() { return &i_; }
+ constexpr const int *operator->() const { return &i_; }
+ constexpr int *operator->() { return &i_; }
+
+ constexpr MoveConstructibleFromX(int i) : i_(i) {}
+ constexpr MoveConstructibleFromX(X&& x) : i_(x.i_) {}
+};
+
+struct ExplicitMoveConstructibleFromX
+{
+ int i_;
+
+ constexpr const int &operator*() const { return i_; }
+ constexpr int &operator*() { return i_; }
+ constexpr const int *get() const { return &i_; }
+ constexpr int *get() { return &i_; }
+ constexpr const int *operator->() const { return &i_; }
+ constexpr int *operator->() { return &i_; }
+
+ constexpr ExplicitMoveConstructibleFromX(int i) : i_(i) {}
+ constexpr explicit ExplicitMoveConstructibleFromX(X&& x) : i_(x.i_) {}
+};
+
+struct CopyConstructibleFromX
+{
+ int i_;
+
+ constexpr const int &operator*() const { return i_; }
+ constexpr int &operator*() { return i_; }
+ constexpr const int *get() const { return &i_; }
+ constexpr int *get() { return &i_; }
+ constexpr const int *operator->() const { return &i_; }
+ constexpr int *operator->() { return &i_; }
+
+ constexpr CopyConstructibleFromX(int i) : i_(i) {}
+ constexpr CopyConstructibleFromX(const X& x) : i_(x.i_) {}
+};
+
+struct ExplicitCopyConstructibleFromX
+{
+ int i_;
+
+ constexpr const int &operator*() const { return i_; }
+ constexpr int &operator*() { return i_; }
+ constexpr const int *get() const { return &i_; }
+ constexpr int *get() { return &i_; }
+ constexpr const int *operator->() const { return &i_; }
+ constexpr int *operator->() { return &i_; }
+
+ constexpr ExplicitCopyConstructibleFromX(int i) : i_(i) {}
+ constexpr explicit ExplicitCopyConstructibleFromX(const X& x) : i_(x.i_) {}
+};
+
diff --git a/test/support/rapid-cxx-test.hpp b/test/support/rapid-cxx-test.hpp
new file mode 100644
index 000000000000..a25bda53109c
--- /dev/null
+++ b/test/support/rapid-cxx-test.hpp
@@ -0,0 +1,847 @@
+#ifndef RAPID_CXX_TEST_HPP
+#define RAPID_CXX_TEST_HPP
+
+# include <cstddef>
+# include <cstdlib>
+# include <cstdio>
+# include <cstring>
+# include <cassert>
+
+#include "test_macros.h"
+
+#if !defined(RAPID_CXX_TEST_NO_SYSTEM_HEADER) || !defined(__GNUC__)
+#pragma GCC system_header
+#endif
+
+# define RAPID_CXX_TEST_PP_CAT(x, y) RAPID_CXX_TEST_PP_CAT_2(x, y)
+# define RAPID_CXX_TEST_PP_CAT_2(x, y) x##y
+
+# define RAPID_CXX_TEST_PP_STR(...) RAPID_CXX_TEST_PP_STR_2(__VA_ARGS__)
+# define RAPID_CXX_TEST_PP_STR_2(...) #__VA_ARGS__
+
+# if defined(__GNUC__)
+# define TEST_FUNC_NAME() __PRETTY_FUNCTION__
+# define RAPID_CXX_TEST_UNUSED __attribute__((unused))
+# else
+# define TEST_FUNC_NAME() __func__
+# define RAPID_CXX_TEST_UNUSED
+# endif
+
+////////////////////////////////////////////////////////////////////////////////
+// TEST_SUITE
+////////////////////////////////////////////////////////////////////////////////
+# define TEST_SUITE(Name) \
+namespace Name \
+{ \
+ inline ::rapid_cxx_test::test_suite & get_test_suite() \
+ { \
+ static ::rapid_cxx_test::test_suite m_suite(#Name); \
+ return m_suite; \
+ } \
+ \
+ inline int unit_test_main(int, char**) \
+ { \
+ ::rapid_cxx_test::test_runner runner(get_test_suite()); \
+ return runner.run(); \
+ } \
+} \
+int main(int argc, char **argv) \
+{ \
+ return Name::unit_test_main(argc, argv); \
+} \
+namespace Name \
+{ /* namespace closed in TEST_SUITE_END */
+#
+
+////////////////////////////////////////////////////////////////////////////////
+// TEST_SUITE_END
+////////////////////////////////////////////////////////////////////////////////
+# define TEST_SUITE_END() \
+} /* namespace opened in TEST_SUITE(...) */
+#
+
+////////////////////////////////////////////////////////////////////////////////
+// TEST_CASE
+////////////////////////////////////////////////////////////////////////////////
+
+# if !defined(__clang__)
+#
+# define TEST_CASE(Name) \
+ void Name(); \
+ static void RAPID_CXX_TEST_PP_CAT(Name, _invoker)() \
+ { \
+ Name(); \
+ } \
+ static ::rapid_cxx_test::registrar \
+ RAPID_CXX_TEST_PP_CAT(rapid_cxx_test_registrar_, Name)( \
+ get_test_suite() \
+ , ::rapid_cxx_test::test_case(__FILE__, #Name, __LINE__, & RAPID_CXX_TEST_PP_CAT(Name, _invoker)) \
+ ); \
+ void Name()
+#
+# else /* __clang__ */
+#
+# define TEST_CASE(Name) \
+ void Name(); \
+ static void RAPID_CXX_TEST_PP_CAT(Name, _invoker)() \
+ { \
+ Name(); \
+ } \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \
+ static ::rapid_cxx_test::registrar \
+ RAPID_CXX_TEST_PP_CAT(rapid_cxx_test_registrar_, Name)( \
+ get_test_suite() \
+ , ::rapid_cxx_test::test_case(__FILE__, #Name, __LINE__, & RAPID_CXX_TEST_PP_CAT(Name, _invoker)) \
+ ); \
+ _Pragma("clang diagnostic pop") \
+ void Name()
+#
+# endif /* !defined(__clang__) */
+
+
+# define TEST_SET_CHECKPOINT() ::rapid_cxx_test::set_checkpoint(__FILE__, TEST_FUNC_NAME(), __LINE__)
+
+#define RAPID_CXX_TEST_OUTCOME()
+
+////////////////////////////////////////////////////////////////////////////////
+// TEST_UNSUPPORTED
+////////////////////////////////////////////////////////////////////////////////
+# define TEST_UNSUPPORTED() \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::unsupported, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "", "" \
+ ); \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ return; \
+ } while (false)
+#
+
+
+////////////////////////////////////////////////////////////////////////////////
+// BASIC ASSERTIONS
+////////////////////////////////////////////////////////////////////////////////
+# define TEST_WARN(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_WARN(" #__VA_ARGS__ ")", "" \
+ ); \
+ if (not (__VA_ARGS__)) { \
+ m_f.type = ::rapid_cxx_test::failure_type::warn; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ } while (false)
+#
+
+# define TEST_CHECK(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_CHECK(" #__VA_ARGS__ ")", "" \
+ ); \
+ if (not (__VA_ARGS__)) { \
+ m_f.type = ::rapid_cxx_test::failure_type::check; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ } while (false)
+#
+
+# define TEST_REQUIRE(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_REQUIRE(" #__VA_ARGS__ ")", "" \
+ ); \
+ if (not (__VA_ARGS__)) { \
+ m_f.type = ::rapid_cxx_test::failure_type::require; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ if (m_f.type != ::rapid_cxx_test::failure_type::none) { \
+ return; \
+ } \
+ } while (false)
+#
+
+# define TEST_ASSERT(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_ASSERT(" #__VA_ARGS__ ")", "" \
+ ); \
+ if (not (__VA_ARGS__)) { \
+ m_f.type = ::rapid_cxx_test::failure_type::assert; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ if (m_f.type != ::rapid_cxx_test::failure_type::none) { \
+ std::abort(); \
+ } \
+ } while (false)
+#
+
+////////////////////////////////////////////////////////////////////////////////
+// TEST_CHECK_NO_THROW / TEST_CHECK_THROW
+////////////////////////////////////////////////////////////////////////////////
+#ifndef TEST_HAS_NO_EXCEPTIONS
+
+# define TEST_CHECK_NO_THROW(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_CHECK_NO_THROW(" #__VA_ARGS__ ")", "" \
+ ); \
+ try { \
+ (static_cast<void>(__VA_ARGS__)); \
+ } catch (...) { \
+ m_f.type = ::rapid_cxx_test::failure_type::check; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ } while (false)
+#
+
+# define TEST_CHECK_THROW(Except, ...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_CHECK_THROW(" #Except "," #__VA_ARGS__ ")", "" \
+ ); \
+ try { \
+ (static_cast<void>(__VA_ARGS__)); \
+ m_f.type = ::rapid_cxx_test::failure_type::check; \
+ } catch (Except const &) {} \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ } while (false)
+#
+
+#else // TEST_HAS_NO_EXCEPTIONS
+
+# define TEST_CHECK_NO_THROW(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_CHECK_NO_THROW(" #__VA_ARGS__ ")", "" \
+ ); \
+ (static_cast<void>(__VA_ARGS__)); \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ } while (false)
+#
+
+#define TEST_CHECK_THROW(Except, ...) ((void)0)
+
+#endif // TEST_HAS_NO_EXCEPTIONS
+
+
+////////////////////////////////////////////////////////////////////////////////
+// TEST_REQUIRE_NO_THROW / TEST_REQUIRE_THROWs
+////////////////////////////////////////////////////////////////////////////////
+#ifndef TEST_HAS_NO_EXCEPTIONS
+
+# define TEST_REQUIRE_NO_THROW(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_REQUIRE_NO_THROW(" #__VA_ARGS__ ")", "" \
+ ); \
+ try { \
+ (static_cast<void>(__VA_ARGS__)); \
+ } catch (...) { \
+ m_f.type = ::rapid_cxx_test::failure_type::require; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ if (m_f.type != ::rapid_cxx_test::failure_type::none) { \
+ return; \
+ } \
+ } while (false)
+#
+
+# define TEST_REQUIRE_THROW(Except, ...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_REQUIRE_THROW(" #Except "," #__VA_ARGS__ ")", "" \
+ ); \
+ try { \
+ (static_cast<void>(__VA_ARGS__)); \
+ m_f.type = ::rapid_cxx_test::failure_type::require; \
+ } catch (Except const &) {} \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ if (m_f.type != ::rapid_cxx_test::failure_type::none) { \
+ return; \
+ } \
+ } while (false)
+#
+
+#else // TEST_HAS_NO_EXCEPTIONS
+
+# define TEST_REQUIRE_NO_THROW(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_REQUIRE_NO_THROW(" #__VA_ARGS__ ")", "" \
+ ); \
+ (static_cast<void>(__VA_ARGS__)); \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ } while (false)
+#
+
+#define TEST_REQUIRE_THROW(Except, ...) ((void)0)
+
+#endif // TEST_HAS_NO_EXCEPTIONS
+
+////////////////////////////////////////////////////////////////////////////////
+// TEST_ASSERT_NO_THROW / TEST_ASSERT_THROW
+////////////////////////////////////////////////////////////////////////////////
+#ifndef TEST_HAS_NO_EXCEPTIONS
+
+# define TEST_ASSERT_NO_THROW(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_ASSERT_NO_THROW(" #__VA_ARGS__ ")", "" \
+ ); \
+ try { \
+ (static_cast<void>(__VA_ARGS__)); \
+ } catch (...) { \
+ m_f.type = ::rapid_cxx_test::failure_type::assert; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ if (m_f.type != ::rapid_cxx_test::failure_type::none) { \
+ std::abort(); \
+ } \
+ } while (false)
+#
+
+# define TEST_ASSERT_THROW(Except, ...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_ASSERT_THROW(" #Except "," #__VA_ARGS__ ")", "" \
+ ); \
+ try { \
+ (static_cast<void>(__VA_ARGS__)); \
+ m_f.type = ::rapid_cxx_test::failure_type::assert; \
+ } catch (Except const &) {} \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ if (m_f.type != ::rapid_cxx_test::failure_type::none) { \
+ std::abort(); \
+ } \
+ } while (false)
+#
+
+#else // TEST_HAS_NO_EXCEPTIONS
+
+# define TEST_ASSERT_NO_THROW(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_ASSERT_NO_THROW(" #__VA_ARGS__ ")", "" \
+ ); \
+ (static_cast<void>(__VA_ARGS__)); \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ } while (false)
+#
+
+#define TEST_ASSERT_THROW(Except, ...) ((void)0)
+
+#endif // TEST_HAS_NO_EXCEPTIONS
+
+////////////////////////////////////////////////////////////////////////////////
+//
+////////////////////////////////////////////////////////////////////////////////
+
+# define TEST_WARN_EQUAL_COLLECTIONS(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_WARN_EQUAL_COLLECTIONS(" #__VA_ARGS__ ")", "" \
+ ); \
+ if (not ::rapid_cxx_test::detail::check_equal_collections_impl(__VA_ARGS__)) { \
+ m_f.type = ::rapid_cxx_test::failure_type::warn; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ } while (false)
+#
+
+# define TEST_CHECK_EQUAL_COLLECTIONS(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_CHECK_EQUAL_COLLECTIONS(" #__VA_ARGS__ ")", "" \
+ ); \
+ if (not ::rapid_cxx_test::detail::check_equal_collections_impl(__VA_ARGS__)) { \
+ m_f.type = ::rapid_cxx_test::failure_type::check; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ } while (false)
+#
+
+# define TEST_REQUIRE_EQUAL_COLLECTIONS(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_REQUIRE_EQUAL_COLLECTIONS(" #__VA_ARGS__ ")", "" \
+ ); \
+ if (not ::rapid_cxx_test::detail::check_equal_collections_impl(__VA_ARGS__)) { \
+ m_f.type = ::rapid_cxx_test::failure_type::require; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ if (m_f.type != ::rapid_cxx_test::failure_type::none) { \
+ return; \
+ } \
+ } while (false)
+#
+
+# define TEST_ASSERT_EQUAL_COLLECTIONS(...) \
+ do { \
+ TEST_SET_CHECKPOINT(); \
+ ::rapid_cxx_test::test_outcome m_f( \
+ ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
+ , "TEST_ASSERT_EQUAL_COLLECTIONS(" #__VA_ARGS__ ")", "" \
+ ); \
+ if (not ::rapid_cxx_test::detail::check_equal_collections_impl(__VA_ARGS__)) { \
+ m_f.type = ::rapid_cxx_test::failure_type::assert; \
+ } \
+ ::rapid_cxx_test::get_reporter().report(m_f); \
+ if (m_f.type != ::rapid_cxx_test::failure_type::none) { \
+ ::std::abort(); \
+ } \
+ } while (false)
+#
+
+namespace rapid_cxx_test
+{
+ typedef void (*invoker_t)();
+
+ ////////////////////////////////////////////////////////////////////////////
+ struct test_case
+ {
+ test_case()
+ : file(""), func(""), line(0), invoke(NULL)
+ {}
+
+ test_case(const char* file1, const char* func1, std::size_t line1,
+ invoker_t invoke1)
+ : file(file1), func(func1), line(line1), invoke(invoke1)
+ {}
+
+ const char *file;
+ const char *func;
+ std::size_t line;
+ invoker_t invoke;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ struct failure_type
+ {
+ enum enum_type {
+ none,
+ unsupported,
+ warn,
+ check,
+ require,
+ assert,
+ uncaught_exception
+ };
+ };
+
+ typedef failure_type::enum_type failure_type_t;
+
+ ////////////////////////////////////////////////////////////////////////////
+ struct test_outcome
+ {
+ test_outcome()
+ : type(failure_type::none),
+ file(""), func(""), line(0),
+ expression(""), message("")
+ {}
+
+ test_outcome(failure_type_t type1, const char* file1, const char* func1,
+ std::size_t line1, const char* expression1,
+ const char* message1)
+ : type(type1), file(file1), func(func1), line(line1),
+ expression(expression1), message(message1)
+ {
+ trim_func_string();
+ }
+
+ failure_type_t type;
+ const char *file;
+ const char *func;
+ std::size_t line;
+ const char *expression;
+ const char *message;
+
+ private:
+ void trim_file_string() {
+ const char* f_start = file;
+ const char* prev_start = f_start;
+ const char* last_start = f_start;
+ char last;
+ while ((last = *f_start) != '\0') {
+ ++f_start;
+ if (last == '/' && *f_start) {
+ prev_start = last_start;
+ last_start = f_start;
+ }
+ }
+ file = prev_start;
+ }
+ void trim_func_string() {
+ const char* void_loc = ::strstr(func, "void ");
+ if (void_loc == func) {
+ func += strlen("void ");
+ }
+ const char* namespace_loc = ::strstr(func, "::");
+ if (namespace_loc) {
+ func = namespace_loc + 2;
+ }
+ }
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ struct checkpoint
+ {
+ const char *file;
+ const char *func;
+ std::size_t line;
+ };
+
+ namespace detail
+ {
+ inline checkpoint & global_checkpoint()
+ {
+ static checkpoint cp = {"", "", 0};
+ return cp;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ inline void set_checkpoint(const char* file, const char* func, std::size_t line)
+ {
+ checkpoint& cp = detail::global_checkpoint();
+ cp.file = file;
+ cp.func = func;
+ cp.line = line;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ inline checkpoint const & get_checkpoint()
+ {
+ return detail::global_checkpoint();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ class test_suite
+ {
+ public:
+ typedef test_case const* iterator;
+ typedef iterator const_iterator;
+
+ public:
+ test_suite(const char *xname)
+ : m_name(xname), m_tests(), m_size(0)
+ {
+ assert(xname);
+ }
+
+ public:
+ const char *name() const { return m_name; }
+
+ std::size_t size() const { return m_size; }
+
+ test_case const & operator[](std::size_t i) const
+ {
+ assert(i < m_size);
+ return m_tests[i];
+ }
+
+ const_iterator begin() const
+ { return m_tests; }
+
+ const_iterator end() const
+ {
+ return m_tests + m_size;
+ }
+
+ public:
+ std::size_t register_test(test_case tc)
+ {
+ static std::size_t test_case_max = sizeof(m_tests) / sizeof(test_case);
+ assert(m_size < test_case_max);
+ m_tests[m_size] = tc;
+ return m_size++;
+ }
+
+ private:
+ test_suite(test_suite const &);
+ test_suite & operator=(test_suite const &);
+
+ private:
+ const char* m_name;
+ // Since fast compile times in a priority, we use simple containers
+ // with hard limits.
+ test_case m_tests[256];
+ std::size_t m_size;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ class registrar
+ {
+ public:
+ registrar(test_suite & st, test_case tc)
+ {
+ st.register_test(tc);
+ }
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ class test_reporter
+ {
+ public:
+ test_reporter()
+ : m_testcases(0), m_testcase_failures(0), m_unsupported(0),
+ m_assertions(0), m_warning_failures(0), m_check_failures(0),
+ m_require_failures(0), m_uncaught_exceptions(0), m_failure()
+ {
+ }
+
+ void test_case_begin()
+ {
+ ++m_testcases;
+ clear_failure();
+ }
+
+ void test_case_end()
+ {
+ if (m_failure.type != failure_type::none
+ && m_failure.type != failure_type::unsupported) {
+ ++m_testcase_failures;
+ }
+ }
+
+# if defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wswitch-default"
+# endif
+ // Each assertion and failure is reported through this function.
+ void report(test_outcome o)
+ {
+ ++m_assertions;
+ switch (o.type)
+ {
+ case failure_type::none:
+ break;
+ case failure_type::unsupported:
+ ++m_unsupported;
+ m_failure = o;
+ break;
+ case failure_type::warn:
+ ++m_warning_failures;
+ report_error(o);
+ break;
+ case failure_type::check:
+ ++m_check_failures;
+ report_error(o);
+ m_failure = o;
+ break;
+ case failure_type::require:
+ ++m_require_failures;
+ report_error(o);
+ m_failure = o;
+ break;
+ case failure_type::assert:
+ report_error(o);
+ break;
+ case failure_type::uncaught_exception:
+ ++m_uncaught_exceptions;
+ std::fprintf(stderr
+ , "Test case FAILED with uncaught exception:\n"
+ " last checkpoint near %s::%lu %s\n\n"
+ , o.file, o.line, o.func
+ );
+ m_failure = o;
+ break;
+ }
+ }
+# if defined(__GNUC__)
+# pragma GCC diagnostic pop
+# endif
+
+ test_outcome current_failure() const
+ {
+ return m_failure;
+ }
+
+ void clear_failure()
+ {
+ m_failure.type = failure_type::none;
+ m_failure.file = "";
+ m_failure.func = "";
+ m_failure.line = 0;
+ m_failure.expression = "";
+ m_failure.message = "";
+ }
+
+ std::size_t test_case_count() const
+ { return m_testcases; }
+
+ std::size_t test_case_failure_count() const
+ { return m_testcase_failures; }
+
+ std::size_t unsupported_count() const
+ { return m_unsupported; }
+
+ std::size_t assertion_count() const
+ { return m_assertions; }
+
+ std::size_t warning_failure_count() const
+ { return m_warning_failures; }
+
+ std::size_t check_failure_count() const
+ { return m_check_failures; }
+
+ std::size_t require_failure_count() const
+ { return m_require_failures; }
+
+ std::size_t failure_count() const
+ { return m_check_failures + m_require_failures + m_uncaught_exceptions; }
+
+ // Print a summary of what was run and the outcome.
+ void print_summary(const char* suitename) const
+ {
+ FILE* out = failure_count() ? stderr : stdout;
+ std::size_t testcases_run = m_testcases - m_unsupported;
+ std::fprintf(out, "Summary for testsuite %s:\n", suitename);
+ std::fprintf(out, " %lu of %lu test cases passed.\n", testcases_run - m_testcase_failures, testcases_run);
+ std::fprintf(out, " %lu of %lu assertions passed.\n", m_assertions - (m_warning_failures + m_check_failures + m_require_failures), m_assertions);
+ std::fprintf(out, " %lu unsupported test case%s.\n", m_unsupported, (m_unsupported != 1 ? "s" : ""));
+ }
+
+ private:
+ test_reporter(test_reporter const &);
+ test_reporter const & operator=(test_reporter const &);
+
+ void report_error(test_outcome o) const
+ {
+ std::fprintf(stderr, "In %s:%lu Assertion %s failed.\n in file: %s\n %s\n"
+ , o.func, o.line, o.expression, o.file, o.message ? o.message : ""
+ );
+ }
+
+ private:
+ // counts of testcases, failed testcases, and unsupported testcases.
+ std::size_t m_testcases;
+ std::size_t m_testcase_failures;
+ std::size_t m_unsupported;
+
+ // counts of assertions and assertion failures.
+ std::size_t m_assertions;
+ std::size_t m_warning_failures;
+ std::size_t m_check_failures;
+ std::size_t m_require_failures;
+ std::size_t m_uncaught_exceptions;
+
+ // The last failure. This is cleared between testcases.
+ test_outcome m_failure;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ inline test_reporter & get_reporter()
+ {
+ static test_reporter o;
+ return o;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ class test_runner
+ {
+ public:
+ test_runner(test_suite & ts)
+ : m_ts(ts)
+ {}
+
+ public:
+ int run()
+ {
+ // for each testcase
+ for (test_suite::const_iterator b = m_ts.begin(), e = m_ts.end();
+ b != e; ++b)
+ {
+ test_case const& tc = *b;
+ set_checkpoint(tc.file, tc.func, tc.line);
+ get_reporter().test_case_begin();
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+#endif
+ tc.invoke();
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ test_outcome o;
+ o.type = failure_type::uncaught_exception;
+ o.file = get_checkpoint().file;
+ o.func = get_checkpoint().func;
+ o.line = get_checkpoint().line;
+ o.expression = "";
+ o.message = "";
+ get_reporter().report(o);
+ }
+#endif
+ get_reporter().test_case_end();
+ }
+ auto exit_code = get_reporter().failure_count() ? EXIT_FAILURE : EXIT_SUCCESS;
+ if (exit_code == EXIT_FAILURE)
+ get_reporter().print_summary(m_ts.name());
+ return exit_code;
+ }
+
+ private:
+ test_runner(test_runner const &);
+ test_runner operator=(test_runner const &);
+
+ test_suite & m_ts;
+ };
+
+ namespace detail
+ {
+ template <class Iter1, class Iter2>
+ bool check_equal_collections_impl(
+ Iter1 start1, Iter1 const end1
+ , Iter2 start2, Iter2 const end2
+ )
+ {
+ while (start1 != end1 && start2 != end2) {
+ if (*start1 != *start2) {
+ return false;
+ }
+ ++start1; ++start2;
+ }
+ return (start1 == end1 && start2 == end2);
+ }
+ } // namespace detail
+
+} // namespace rapid_cxx_test
+
+
+# if defined(__GNUC__)
+# pragma GCC diagnostic pop
+# endif
+
+#endif /* RAPID_CXX_TEST_HPP */
diff --git a/test/support/test.support/test_convertible_header.pass.cpp b/test/support/test.support/test_convertible_header.pass.cpp
new file mode 100644
index 000000000000..a56b84b4739c
--- /dev/null
+++ b/test/support/test.support/test_convertible_header.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// "support/test_convertible.hpp"
+
+#include "test_convertible.hpp"
+
+struct ImplicitDefault {
+ ImplicitDefault() {}
+};
+static_assert(test_convertible<ImplicitDefault>(), "Must be convertible");
+
+struct ExplicitDefault {
+ explicit ExplicitDefault() {}
+};
+static_assert(!test_convertible<ExplicitDefault>(), "Must not be convertible");
+
+struct ImplicitInt {
+ ImplicitInt(int) {}
+};
+static_assert(test_convertible<ImplicitInt, int>(), "Must be convertible");
+
+struct ExplicitInt {
+ explicit ExplicitInt(int) {}
+};
+static_assert(!test_convertible<ExplicitInt, int>(), "Must not be convertible");
+
+struct ImplicitCopy {
+ ImplicitCopy(ImplicitCopy const&) {}
+};
+static_assert(test_convertible<ImplicitCopy, ImplicitCopy>(), "Must be convertible");
+
+struct ExplicitCopy {
+ explicit ExplicitCopy(ExplicitCopy const&) {}
+};
+static_assert(!test_convertible<ExplicitCopy, ExplicitCopy>(), "Must not be convertible");
+
+struct ImplicitMove {
+ ImplicitMove(ImplicitMove&&) {}
+};
+static_assert(test_convertible<ImplicitMove, ImplicitMove>(), "Must be convertible");
+
+struct ExplicitMove {
+ explicit ExplicitMove(ExplicitMove&&) {}
+};
+static_assert(!test_convertible<ExplicitMove, ExplicitMove>(), "Must not be convertible");
+
+struct ImplicitArgs {
+ ImplicitArgs(int, int, int) {}
+};
+static_assert(test_convertible<ImplicitArgs, int, int, int>(), "Must be convertible");
+
+struct ExplicitArgs {
+ explicit ExplicitArgs(int, int, int) {}
+};
+static_assert(!test_convertible<ExplicitArgs, int, int, int>(), "Must not be convertible");
+
+int main() {
+ // Nothing to do
+}
diff --git a/test/support/test.support/test_macros_header_exceptions.fail.cpp b/test/support/test.support/test_macros_header_exceptions.fail.cpp
new file mode 100644
index 000000000000..ade2cd98fe08
--- /dev/null
+++ b/test/support/test.support/test_macros_header_exceptions.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// "support/test_macros.hpp"
+
+// #define TEST_HAS_NO_EXCEPTIONS
+
+#include "test_macros.h"
+
+int main() {
+#if defined(TEST_HAS_NO_EXCEPTIONS)
+ try { ((void)0); } catch (...) {} // expected-error {{exceptions disabled}}
+#else
+ try { ((void)0); } catch (...) {}
+#error exceptions enabled
+// expected-error@-1 {{exceptions enabled}}
+#endif
+}
diff --git a/test/support/test.support/test_macros_header_exceptions.pass.cpp b/test/support/test.support/test_macros_header_exceptions.pass.cpp
new file mode 100644
index 000000000000..589e148a0032
--- /dev/null
+++ b/test/support/test.support/test_macros_header_exceptions.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-no-exceptions
+
+// "support/test_macros.hpp"
+
+// #define TEST_HAS_NO_EXCEPTIONS
+
+#include "test_macros.h"
+
+#if defined(TEST_HAS_NO_EXCEPTIONS)
+#error macro defined unexpectedly
+#endif
+
+int main() {
+ try { ((void)0); } catch (...) {}
+}
diff --git a/test/support/test.support/test_macros_header_rtti.fail.cpp b/test/support/test.support/test_macros_header_rtti.fail.cpp
new file mode 100644
index 000000000000..851a6c601416
--- /dev/null
+++ b/test/support/test.support/test_macros_header_rtti.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// "support/test_macros.hpp"
+
+// #define TEST_HAS_NO_RTTI
+
+#include "test_macros.h"
+
+struct A { virtual ~A() {} };
+struct B : A {};
+
+int main() {
+#if defined(TEST_HAS_NO_RTTI)
+ A* ptr = new B;
+ (void)dynamic_cast<B*>(ptr); // expected-error{{cannot use dynamic_cast}}
+#else
+ A* ptr = new B;
+ (void)dynamic_cast<B*>(ptr);
+#error RTTI enabled
+// expected-error@-1{{RTTI enabled}}
+#endif
+}
diff --git a/test/support/test.support/test_macros_header_rtti.pass.cpp b/test/support/test.support/test_macros_header_rtti.pass.cpp
new file mode 100644
index 000000000000..d189a0efc2fc
--- /dev/null
+++ b/test/support/test.support/test_macros_header_rtti.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-no-rtti
+
+// "support/test_macros.hpp"
+
+// #define TEST_HAS_NO_RTTI
+
+#include "test_macros.h"
+
+#if defined(TEST_HAS_NO_RTTI)
+#error Macro defined unexpectedly
+#endif
+
+struct A { virtual ~A() {} };
+struct B : A {};
+
+int main() {
+ A* ptr = new B;
+ (void)dynamic_cast<B*>(ptr);
+}
diff --git a/test/support/test_allocator.h b/test/support/test_allocator.h
index 3ca672f89a9b..466c7fabc66d 100644
--- a/test/support/test_allocator.h
+++ b/test/support/test_allocator.h
@@ -76,18 +76,22 @@ public:
++alloc_count;
return (pointer)::operator new(n * sizeof(T));
}
- void deallocate(pointer p, size_type n)
+ void deallocate(pointer p, size_type)
{assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);}
size_type max_size() const throw()
{return UINT_MAX / sizeof(T);}
+#if TEST_STD_VER < 11
void construct(pointer p, const T& val)
- {::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void construct(pointer p, T&& val)
- {::new(p) T(std::move(val));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void destroy(pointer p) {p->~T();}
-
+ {::new(static_cast<void*>(p)) T(val);}
+#else
+ template <class U> void construct(pointer p, U&& val)
+ {::new(static_cast<void*>(p)) T(std::forward<U>(val));}
+#endif
+ void destroy(pointer p)
+ {
+ p->~T();
+ ((void)p); // Prevent MSVC's spurious unused warning
+ }
friend bool operator==(const test_allocator& x, const test_allocator& y)
{return x.data_ == y.data_;}
friend bool operator!=(const test_allocator& x, const test_allocator& y)
@@ -136,16 +140,17 @@ public:
++alloc_count;
return (pointer)::operator new (n * sizeof(T));
}
- void deallocate(pointer p, size_type n)
+ void deallocate(pointer p, size_type)
{assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); }
size_type max_size() const throw()
{return UINT_MAX / sizeof(T);}
+#if TEST_STD_VER < 11
void construct(pointer p, const T& val)
- {::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void construct(pointer p, T&& val)
- {::new(p) T(std::move(val));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {::new(static_cast<void*>(p)) T(val);}
+#else
+ template <class U> void construct(pointer p, U&& val)
+ {::new(static_cast<void*>(p)) T(std::forward<U>(val));}
+#endif
void destroy(pointer p) {p->~T();}
friend bool operator==(const non_default_test_allocator& x, const non_default_test_allocator& y)
@@ -201,7 +206,7 @@ public:
: data_(a.data_) {}
T* allocate(std::size_t n)
{return (T*)::operator new(n * sizeof(T));}
- void deallocate(T* p, std::size_t n)
+ void deallocate(T* p, std::size_t)
{::operator delete((void*)p);}
other_allocator select_on_container_copy_construction() const
@@ -223,4 +228,82 @@ public:
};
+#if TEST_STD_VER >= 11
+
+struct Ctor_Tag {};
+
+template <typename T> class TaggingAllocator;
+
+struct Tag_X {
+ // All constructors must be passed the Tag type.
+
+ // DefaultInsertable into vector<X, TaggingAllocator<X>>,
+ Tag_X(Ctor_Tag) {}
+ // CopyInsertable into vector<X, TaggingAllocator<X>>,
+ Tag_X(Ctor_Tag, const Tag_X&) {}
+ // MoveInsertable into vector<X, TaggingAllocator<X>>, and
+ Tag_X(Ctor_Tag, Tag_X&&) {}
+
+ // EmplaceConstructible into vector<X, TaggingAllocator<X>> from args.
+ template<typename... Args>
+ Tag_X(Ctor_Tag, Args&&...) { }
+
+ // not DefaultConstructible, CopyConstructible or MoveConstructible.
+ Tag_X() = delete;
+ Tag_X(const Tag_X&) = delete;
+ Tag_X(Tag_X&&) = delete;
+
+ // CopyAssignable.
+ Tag_X& operator=(const Tag_X&) { return *this; }
+
+ // MoveAssignable.
+ Tag_X& operator=(Tag_X&&) { return *this; }
+
+private:
+ // Not Destructible.
+ ~Tag_X() { }
+
+ // Erasable from vector<X, TaggingAllocator<X>>.
+ friend class TaggingAllocator<Tag_X>;
+};
+
+
+template<typename T>
+class TaggingAllocator {
+public:
+ using value_type = T;
+ TaggingAllocator() = default;
+
+ template<typename U>
+ TaggingAllocator(const TaggingAllocator<U>&) { }
+
+ T* allocate(std::size_t n) { return std::allocator<T>{}.allocate(n); }
+
+ void deallocate(T* p, std::size_t n) { std::allocator<T>{}.deallocate(p, n); }
+
+ template<typename... Args>
+ void construct(Tag_X* p, Args&&... args)
+ { ::new((void*)p) Tag_X(Ctor_Tag{}, std::forward<Args>(args)...); }
+
+ template<typename U, typename... Args>
+ void construct(U* p, Args&&... args)
+ { ::new((void*)p) U(std::forward<Args>(args)...); }
+
+ template<typename U, typename... Args>
+ void destroy(U* p)
+ { p->~U(); }
+};
+
+template<typename T, typename U>
+bool
+operator==(const TaggingAllocator<T>&, const TaggingAllocator<U>&)
+{ return true; }
+
+template<typename T, typename U>
+bool
+operator!=(const TaggingAllocator<T>&, const TaggingAllocator<U>&)
+{ return false; }
+#endif
+
+
#endif // TEST_ALLOCATOR_H
diff --git a/test/support/test_convertible.hpp b/test/support/test_convertible.hpp
new file mode 100644
index 000000000000..787cef6568f2
--- /dev/null
+++ b/test/support/test_convertible.hpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUPPORT_TEST_CONVERTIBLE_HPP
+#define SUPPORT_TEST_CONVERTIBLE_HPP
+
+// "test_convertible<Tp, Args...>()" is a metafunction used to check if 'Tp'
+// is implicitly convertible from 'Args...' for any number of arguments,
+// Unlike 'std::is_convertible' which only allows checking for single argument
+// conversions.
+
+#include <type_traits>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER < 11
+#error test_convertible.hpp requires C++11 or newer
+#endif
+
+namespace detail {
+ template <class Tp> void eat_type(Tp);
+
+ template <class Tp, class ...Args>
+ constexpr auto test_convertible_imp(int)
+ -> decltype(eat_type<Tp>({std::declval<Args>()...}), true)
+ { return true; }
+
+ template <class Tp, class ...Args>
+ constexpr auto test_convertible_imp(long) -> bool { return false; }
+}
+
+template <class Tp, class ...Args>
+constexpr bool test_convertible()
+{ return detail::test_convertible_imp<Tp, Args...>(0); }
+
+#endif // SUPPORT_TEST_CONVERTIBLE_HPP \ No newline at end of file
diff --git a/test/support/test_iterators.h b/test/support/test_iterators.h
index d814879fa272..d4a079971b15 100644
--- a/test/support/test_iterators.h
+++ b/test/support/test_iterators.h
@@ -12,6 +12,7 @@
#include <iterator>
#include <stdexcept>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -335,116 +336,137 @@ struct ThrowingIterator {
typedef const T * pointer;
typedef const T & reference;
- enum ThrowingAction { TAIncrement, TADecrement, TADereference, TAAssignment, TAComparison };
-
-// Constructors
- ThrowingIterator ()
- : begin_(nullptr), end_(nullptr), current_(nullptr), action_(TADereference), index_(0) {}
- ThrowingIterator (const T *first, const T *last, size_t index = 0, ThrowingAction action = TADereference)
- : begin_(first), end_(last), current_(first), action_(action), index_(index) {}
- ThrowingIterator (const ThrowingIterator &rhs)
- : begin_(rhs.begin_), end_(rhs.end_), current_(rhs.current_), action_(rhs.action_), index_(rhs.index_) {}
- ThrowingIterator & operator= (const ThrowingIterator &rhs)
- {
- if (action_ == TAAssignment)
- {
- if (index_ == 0)
- throw std::runtime_error ("throw from iterator assignment");
- else
- --index_;
- }
- begin_ = rhs.begin_;
- end_ = rhs.end_;
- current_ = rhs.current_;
- action_ = rhs.action_;
- index_ = rhs.index_;
- return *this;
- }
-
-// iterator operations
- reference operator*() const
- {
- if (action_ == TADereference)
- {
- if (index_ == 0)
- throw std::runtime_error ("throw from iterator dereference");
- else
- --index_;
- }
- return *current_;
- }
-
- ThrowingIterator & operator++()
- {
- if (action_ == TAIncrement)
- {
- if (index_ == 0)
- throw std::runtime_error ("throw from iterator increment");
- else
- --index_;
- }
- ++current_;
- return *this;
- }
-
- ThrowingIterator operator++(int)
- {
- ThrowingIterator temp = *this;
- ++(*this);
- return temp;
- }
-
- ThrowingIterator & operator--()
- {
- if (action_ == TADecrement)
- {
- if (index_ == 0)
- throw std::runtime_error ("throw from iterator decrement");
- else
- --index_;
- }
- --current_;
- return *this;
- }
-
- ThrowingIterator operator--(int) {
- ThrowingIterator temp = *this;
- --(*this);
- return temp;
- }
-
- bool operator== (const ThrowingIterator &rhs) const
- {
- if (action_ == TAComparison)
- {
- if (index_ == 0)
- throw std::runtime_error ("throw from iterator comparison");
- else
- --index_;
- }
- bool atEndL = current_ == end_;
- bool atEndR = rhs.current_ == rhs.end_;
- if (atEndL != atEndR) return false; // one is at the end (or empty), the other is not.
- if (atEndL) return true; // both are at the end (or empty)
- return current_ == rhs.current_;
- }
+ enum ThrowingAction { TAIncrement, TADecrement, TADereference, TAAssignment, TAComparison };
+
+// Constructors
+ ThrowingIterator ()
+ : begin_(nullptr), end_(nullptr), current_(nullptr), action_(TADereference), index_(0) {}
+ ThrowingIterator (const T *first, const T *last, size_t index = 0, ThrowingAction action = TADereference)
+ : begin_(first), end_(last), current_(first), action_(action), index_(index) {}
+ ThrowingIterator (const ThrowingIterator &rhs)
+ : begin_(rhs.begin_), end_(rhs.end_), current_(rhs.current_), action_(rhs.action_), index_(rhs.index_) {}
+ ThrowingIterator & operator= (const ThrowingIterator &rhs)
+ {
+ if (action_ == TAAssignment)
+ {
+ if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw std::runtime_error ("throw from iterator assignment");
+#else
+ assert(false);
+#endif
+
+ else
+ --index_;
+ }
+ begin_ = rhs.begin_;
+ end_ = rhs.end_;
+ current_ = rhs.current_;
+ action_ = rhs.action_;
+ index_ = rhs.index_;
+ return *this;
+ }
+
+// iterator operations
+ reference operator*() const
+ {
+ if (action_ == TADereference)
+ {
+ if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw std::runtime_error ("throw from iterator dereference");
+#else
+ assert(false);
+#endif
+ else
+ --index_;
+ }
+ return *current_;
+ }
+
+ ThrowingIterator & operator++()
+ {
+ if (action_ == TAIncrement)
+ {
+ if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw std::runtime_error ("throw from iterator increment");
+#else
+ assert(false);
+#endif
+ else
+ --index_;
+ }
+ ++current_;
+ return *this;
+ }
+
+ ThrowingIterator operator++(int)
+ {
+ ThrowingIterator temp = *this;
+ ++(*this);
+ return temp;
+ }
+
+ ThrowingIterator & operator--()
+ {
+ if (action_ == TADecrement)
+ {
+ if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw std::runtime_error ("throw from iterator decrement");
+#else
+ assert(false);
+#endif
+ else
+ --index_;
+ }
+ --current_;
+ return *this;
+ }
+
+ ThrowingIterator operator--(int) {
+ ThrowingIterator temp = *this;
+ --(*this);
+ return temp;
+ }
+
+ bool operator== (const ThrowingIterator &rhs) const
+ {
+ if (action_ == TAComparison)
+ {
+ if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw std::runtime_error ("throw from iterator comparison");
+#else
+ assert(false);
+#endif
+ else
+ --index_;
+ }
+ bool atEndL = current_ == end_;
+ bool atEndR = rhs.current_ == rhs.end_;
+ if (atEndL != atEndR) return false; // one is at the end (or empty), the other is not.
+ if (atEndL) return true; // both are at the end (or empty)
+ return current_ == rhs.current_;
+ }
private:
- const T* begin_;
- const T* end_;
- const T* current_;
- ThrowingAction action_;
- mutable size_t index_;
+ const T* begin_;
+ const T* end_;
+ const T* current_;
+ ThrowingAction action_;
+ mutable size_t index_;
};
template <typename T>
bool operator== (const ThrowingIterator<T>& a, const ThrowingIterator<T>& b)
-{ return a.operator==(b); }
+{ return a.operator==(b); }
template <typename T>
bool operator!= (const ThrowingIterator<T>& a, const ThrowingIterator<T>& b)
-{ return !a.operator==(b); }
-
+{ return !a.operator==(b); }
+
template <typename T>
struct NonThrowingIterator {
typedef std::bidirectional_iterator_tag iterator_category;
@@ -453,75 +475,75 @@ struct NonThrowingIterator {
typedef const T * pointer;
typedef const T & reference;
-// Constructors
- NonThrowingIterator ()
- : begin_(nullptr), end_(nullptr), current_(nullptr) {}
- NonThrowingIterator (const T *first, const T* last)
- : begin_(first), end_(last), current_(first) {}
- NonThrowingIterator (const NonThrowingIterator &rhs)
- : begin_(rhs.begin_), end_(rhs.end_), current_(rhs.current_) {}
- NonThrowingIterator & operator= (const NonThrowingIterator &rhs) TEST_NOEXCEPT
- {
- begin_ = rhs.begin_;
- end_ = rhs.end_;
- current_ = rhs.current_;
- return *this;
- }
-
-// iterator operations
- reference operator*() const TEST_NOEXCEPT
- {
- return *current_;
- }
-
- NonThrowingIterator & operator++() TEST_NOEXCEPT
- {
- ++current_;
- return *this;
- }
-
- NonThrowingIterator operator++(int) TEST_NOEXCEPT
- {
- NonThrowingIterator temp = *this;
- ++(*this);
- return temp;
- }
-
- NonThrowingIterator & operator--() TEST_NOEXCEPT
- {
- --current_;
- return *this;
- }
-
- NonThrowingIterator operator--(int) TEST_NOEXCEPT
- {
- NonThrowingIterator temp = *this;
- --(*this);
- return temp;
- }
-
- bool operator== (const NonThrowingIterator &rhs) const TEST_NOEXCEPT
- {
- bool atEndL = current_ == end_;
- bool atEndR = rhs.current_ == rhs.end_;
- if (atEndL != atEndR) return false; // one is at the end (or empty), the other is not.
- if (atEndL) return true; // both are at the end (or empty)
- return current_ == rhs.current_;
- }
+// Constructors
+ NonThrowingIterator ()
+ : begin_(nullptr), end_(nullptr), current_(nullptr) {}
+ NonThrowingIterator (const T *first, const T* last)
+ : begin_(first), end_(last), current_(first) {}
+ NonThrowingIterator (const NonThrowingIterator &rhs)
+ : begin_(rhs.begin_), end_(rhs.end_), current_(rhs.current_) {}
+ NonThrowingIterator & operator= (const NonThrowingIterator &rhs) TEST_NOEXCEPT
+ {
+ begin_ = rhs.begin_;
+ end_ = rhs.end_;
+ current_ = rhs.current_;
+ return *this;
+ }
+
+// iterator operations
+ reference operator*() const TEST_NOEXCEPT
+ {
+ return *current_;
+ }
+
+ NonThrowingIterator & operator++() TEST_NOEXCEPT
+ {
+ ++current_;
+ return *this;
+ }
+
+ NonThrowingIterator operator++(int) TEST_NOEXCEPT
+ {
+ NonThrowingIterator temp = *this;
+ ++(*this);
+ return temp;
+ }
+
+ NonThrowingIterator & operator--() TEST_NOEXCEPT
+ {
+ --current_;
+ return *this;
+ }
+
+ NonThrowingIterator operator--(int) TEST_NOEXCEPT
+ {
+ NonThrowingIterator temp = *this;
+ --(*this);
+ return temp;
+ }
+
+ bool operator== (const NonThrowingIterator &rhs) const TEST_NOEXCEPT
+ {
+ bool atEndL = current_ == end_;
+ bool atEndR = rhs.current_ == rhs.end_;
+ if (atEndL != atEndR) return false; // one is at the end (or empty), the other is not.
+ if (atEndL) return true; // both are at the end (or empty)
+ return current_ == rhs.current_;
+ }
private:
- const T* begin_;
- const T* end_;
- const T* current_;
+ const T* begin_;
+ const T* end_;
+ const T* current_;
};
template <typename T>
bool operator== (const NonThrowingIterator<T>& a, const NonThrowingIterator<T>& b) TEST_NOEXCEPT
-{ return a.operator==(b); }
+{ return a.operator==(b); }
template <typename T>
bool operator!= (const NonThrowingIterator<T>& a, const NonThrowingIterator<T>& b) TEST_NOEXCEPT
-{ return !a.operator==(b); }
+{ return !a.operator==(b); }
#undef DELETE_FUNCTION
diff --git a/test/support/test_macros.h b/test/support/test_macros.h
index c34e8cf7ef14..a072e31b77b7 100644
--- a/test/support/test_macros.h
+++ b/test/support/test_macros.h
@@ -11,6 +11,8 @@
#ifndef SUPPORT_TEST_MACROS_HPP
#define SUPPORT_TEST_MACROS_HPP
+#include <ciso646> // Get STL specific macros like _LIBCPP_VERSION
+
#define TEST_CONCAT1(X, Y) X##Y
#define TEST_CONCAT(X, Y) TEST_CONCAT1(X, Y)
@@ -33,6 +35,7 @@
#endif
/* Make a nice name for the standard version */
+#ifndef TEST_STD_VER
#if __cplusplus <= 199711L
# define TEST_STD_VER 3
#elif __cplusplus <= 201103L
@@ -40,15 +43,8 @@
#elif __cplusplus <= 201402L
# define TEST_STD_VER 14
#else
-# define TEST_STD_VER 99 // greater than current standard
+# define TEST_STD_VER 16 // current year; greater than current standard
#endif
-
-/* Features that were introduced in C++11 */
-#if TEST_STD_VER >= 11
-#define TEST_HAS_RVALUE_REFERENCES
-#define TEST_HAS_VARIADIC_TEMPLATES
-#define TEST_HAS_INITIALIZER_LISTS
-#define TEST_HAS_BASIC_CONSTEXPR
#endif
/* Features that were introduced in C++14 */
@@ -61,44 +57,27 @@
#if TEST_STD_VER > 14
#endif
-#if TEST_HAS_EXTENSION(cxx_decltype) || TEST_STD_VER >= 11
-#define TEST_DECLTYPE(T) decltype(T)
-#else
-#define TEST_DECLTYPE(T) __typeof__(T)
-#endif
-
#if TEST_STD_VER >= 11
#define TEST_CONSTEXPR constexpr
#define TEST_NOEXCEPT noexcept
+# if TEST_STD_VER >= 14
+# define TEST_CONSTEXPR_CXX14 constexpr
+# else
+# define TEST_CONSTEXPR_CXX14
+# endif
#else
#define TEST_CONSTEXPR
+#define TEST_CONSTEXPR_CXX14
#define TEST_NOEXCEPT
#endif
-#if TEST_HAS_EXTENSION(cxx_static_assert) || TEST_STD_VER >= 11
-# define TEST_STATIC_ASSERT(Expr, Msg) static_assert(Expr, Msg)
-#else
-# define TEST_STATIC_ASSERT(Expr, Msg) \
- typedef ::test_detail::static_assert_check<sizeof( \
- ::test_detail::static_assert_incomplete_test<(Expr)>)> \
- TEST_CONCAT(test_assert, __LINE__)
-#
-#endif
-
-namespace test_detail {
-
-template <bool> struct static_assert_incomplete_test;
-template <> struct static_assert_incomplete_test<true> {};
-template <unsigned> struct static_assert_check {};
-
-} // end namespace test_detail
-
-
-#if !TEST_HAS_FEATURE(cxx_rtti) && !defined(__cxx_rtti)
+#if !TEST_HAS_FEATURE(cxx_rtti) && !defined(__cpp_rtti) \
+ && !defined(__GXX_RTTI)
#define TEST_HAS_NO_RTTI
#endif
-#if !TEST_HAS_FEATURE(cxx_exceptions) && !defined(__cxx_exceptions)
+#if !TEST_HAS_FEATURE(cxx_exceptions) && !defined(__cpp_exceptions) \
+ && !defined(__EXCEPTIONS)
#define TEST_HAS_NO_EXCEPTIONS
#endif
@@ -107,4 +86,36 @@ template <unsigned> struct static_assert_check {};
#define TEST_HAS_SANITIZERS
#endif
+#if defined(_LIBCPP_NORETURN)
+#define TEST_NORETURN _LIBCPP_NORETURN
+#else
+#define TEST_NORETURN [[noreturn]]
+#endif
+
+/* Macros for testing libc++ specific behavior and extensions */
+#if defined(_LIBCPP_VERSION)
+#define LIBCPP_ASSERT(...) assert(__VA_ARGS__)
+#define LIBCPP_STATIC_ASSERT(...) static_assert(__VA_ARGS__)
+#else
+#define LIBCPP_ASSERT(...) ((void)0)
+#define LIBCPP_STATIC_ASSERT(...) ((void)0)
+#endif
+
+#define ASSERT_NOEXCEPT(...) \
+ static_assert(noexcept(__VA_ARGS__), "Operation must be noexcept")
+
+#define ASSERT_NOT_NOEXCEPT(...) \
+ static_assert(!noexcept(__VA_ARGS__), "Operation must NOT be noexcept")
+
+namespace test_macros_detail {
+template <class T, class U>
+struct is_same { enum { value = 0};} ;
+template <class T>
+struct is_same<T, T> { enum {value = 1}; };
+} // namespace test_macros_detail
+
+#define ASSERT_SAME_TYPE(...) \
+ static_assert(test_macros_detail::is_same<__VA_ARGS__>::value, \
+ "Types differ uexpectedly")
+
#endif // SUPPORT_TEST_MACROS_HPP
diff --git a/test/support/test_memory_resource.hpp b/test/support/test_memory_resource.hpp
new file mode 100644
index 000000000000..e7b067cf631d
--- /dev/null
+++ b/test/support/test_memory_resource.hpp
@@ -0,0 +1,507 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUPPORT_TEST_MEMORY_RESOURCE_HPP
+#define SUPPORT_TEST_MEMORY_RESOURCE_HPP
+
+#include <experimental/memory_resource>
+#include <memory>
+#include <type_traits>
+#include <cstddef>
+#include <cstdlib>
+#include <cstring>
+#include <cstdint>
+#include <cassert>
+#include "test_macros.h"
+
+struct AllocController;
+ // 'AllocController' is a concrete type that instruments and controls the
+ // behavior of of test allocators.
+
+template <class T>
+class CountingAllocator;
+ // 'CountingAllocator' is an basic implementation of the 'Allocator'
+ // requirements that use the 'AllocController' interface.
+
+template <class T>
+class MinAlignAllocator;
+ // 'MinAlignAllocator' is an instrumented test type which implements the
+ // 'Allocator' requirements. 'MinAlignAllocator' ensures that it *never*
+ // returns a pointer to over-aligned storage. For example
+ // 'MinAlignPointer<char>{}.allocate(...)' will never a 2-byte aligned
+ // pointer.
+
+template <class T>
+class NullAllocator;
+ // 'NullAllocator' is an instrumented test type which implements the
+ // 'Allocator' requirements except that 'allocator' and 'deallocate' are
+ // nops.
+
+
+#define DISALLOW_COPY(Type) \
+ Type(Type const&) = delete; \
+ Type& operator=(Type const&) = delete
+
+constexpr std::size_t MaxAlignV = alignof(std::max_align_t);
+
+struct TestException {};
+
+struct AllocController {
+ int copy_constructed = 0;
+ int move_constructed = 0;
+
+ int alive = 0;
+ int alloc_count = 0;
+ int dealloc_count = 0;
+ int is_equal_count = 0;
+
+ std::size_t alive_size;
+ std::size_t allocated_size;
+ std::size_t deallocated_size;
+
+ std::size_t last_size = 0;
+ std::size_t last_align = 0;
+ void * last_pointer = 0;
+
+ std::size_t last_alloc_size = 0;
+ std::size_t last_alloc_align = 0;
+ void * last_alloc_pointer = nullptr;
+
+ std::size_t last_dealloc_size = 0;
+ std::size_t last_dealloc_align = 0;
+ void * last_dealloc_pointer = nullptr;
+
+ bool throw_on_alloc = false;
+
+ AllocController() = default;
+
+ void countAlloc(void* p, size_t s, size_t a) {
+ ++alive;
+ ++alloc_count;
+ alive_size += s;
+ allocated_size += s;
+ last_pointer = last_alloc_pointer = p;
+ last_size = last_alloc_size = s;
+ last_align = last_alloc_align = a;
+ }
+
+ void countDealloc(void* p, size_t s, size_t a) {
+ --alive;
+ ++dealloc_count;
+ alive_size -= s;
+ deallocated_size += s;
+ last_pointer = last_dealloc_pointer = p;
+ last_size = last_dealloc_size = s;
+ last_align = last_dealloc_align = a;
+ }
+
+ void reset() { std::memset(this, 0, sizeof(*this)); }
+
+public:
+ bool checkAlloc(void* p, size_t s, size_t a) const {
+ return p == last_alloc_pointer &&
+ s == last_alloc_size &&
+ a == last_alloc_align;
+ }
+
+ bool checkAlloc(void* p, size_t s) const {
+ return p == last_alloc_pointer &&
+ s == last_alloc_size;
+ }
+
+ bool checkAllocAtLeast(void* p, size_t s, size_t a) const {
+ return p == last_alloc_pointer &&
+ s <= last_alloc_size &&
+ a <= last_alloc_align;
+ }
+
+ bool checkAllocAtLeast(void* p, size_t s) const {
+ return p == last_alloc_pointer &&
+ s <= last_alloc_size;
+ }
+
+ bool checkDealloc(void* p, size_t s, size_t a) const {
+ return p == last_dealloc_pointer &&
+ s == last_dealloc_size &&
+ a == last_dealloc_align;
+ }
+
+ bool checkDealloc(void* p, size_t s) const {
+ return p == last_dealloc_pointer &&
+ s == last_dealloc_size;
+ }
+
+ bool checkDeallocMatchesAlloc() const {
+ return last_dealloc_pointer == last_alloc_pointer &&
+ last_dealloc_size == last_alloc_size &&
+ last_dealloc_align == last_alloc_align;
+ }
+
+ void countIsEqual() {
+ ++is_equal_count;
+ }
+
+ bool checkIsEqualCalledEq(int n) const {
+ return is_equal_count == n;
+ }
+private:
+ DISALLOW_COPY(AllocController);
+};
+
+template <class T>
+class CountingAllocator
+{
+public:
+ typedef T value_type;
+ typedef T* pointer;
+ CountingAllocator() = delete;
+ explicit CountingAllocator(AllocController& PP) : P(&PP) {}
+
+ CountingAllocator(CountingAllocator const& other) : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ CountingAllocator(CountingAllocator&& other) : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ template <class U>
+ CountingAllocator(CountingAllocator<U> const& other) TEST_NOEXCEPT : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ template <class U>
+ CountingAllocator(CountingAllocator<U>&& other) TEST_NOEXCEPT : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ T* allocate(std::size_t n)
+ {
+ void* ret = ::operator new(n*sizeof(T));
+ P->countAlloc(ret, n*sizeof(T), alignof(T));
+ return static_cast<T*>(ret);
+ }
+
+ void deallocate(T* p, std::size_t n)
+ {
+ void* vp = static_cast<void*>(p);
+ P->countDealloc(vp, n*sizeof(T), alignof(T));
+ ::operator delete(vp);
+ }
+
+ AllocController& getController() const { return *P; }
+
+private:
+ template <class Tp> friend class CountingAllocator;
+ AllocController *P;
+};
+
+template <class T, class U>
+inline bool operator==(CountingAllocator<T> const& x,
+ CountingAllocator<U> const& y) {
+ return &x.getController() == &y.getController();
+}
+
+template <class T, class U>
+inline bool operator!=(CountingAllocator<T> const& x,
+ CountingAllocator<U> const& y) {
+ return !(x == y);
+}
+
+template <class T>
+class MinAlignedAllocator
+{
+public:
+ typedef T value_type;
+ typedef T* pointer;
+
+ MinAlignedAllocator() = delete;
+
+ explicit MinAlignedAllocator(AllocController& R) : P(&R) {}
+
+ MinAlignedAllocator(MinAlignedAllocator const& other) : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ MinAlignedAllocator(MinAlignedAllocator&& other) : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ template <class U>
+ MinAlignedAllocator(MinAlignedAllocator<U> const& other) TEST_NOEXCEPT : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ template <class U>
+ MinAlignedAllocator(MinAlignedAllocator<U>&& other) TEST_NOEXCEPT : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ T* allocate(std::size_t n) {
+ char* aligned_ptr = (char*)::operator new(alloc_size(n*sizeof(T)));
+ assert(is_max_aligned(aligned_ptr));
+
+ char* unaligned_ptr = aligned_ptr + alignof(T);
+ assert(is_min_aligned(unaligned_ptr));
+
+ P->countAlloc(unaligned_ptr, n * sizeof(T), alignof(T));
+
+ return ((T*)unaligned_ptr);
+ }
+
+ void deallocate(T* p, std::size_t n) {
+ assert(is_min_aligned(p));
+
+ char* aligned_ptr = ((char*)p) - alignof(T);
+ assert(is_max_aligned(aligned_ptr));
+
+ P->countDealloc(p, n*sizeof(T), alignof(T));
+
+ return ::operator delete(static_cast<void*>(aligned_ptr));
+ }
+
+ AllocController& getController() const { return *P; }
+
+private:
+ static const std::size_t BlockSize = alignof(std::max_align_t);
+
+ static std::size_t alloc_size(std::size_t s) {
+ std::size_t bytes = (s + BlockSize - 1) & ~(BlockSize - 1);
+ bytes += BlockSize;
+ assert(bytes % BlockSize == 0);
+ return bytes;
+ }
+
+ static bool is_max_aligned(void* p) {
+ return reinterpret_cast<std::uintptr_t>(p) % BlockSize == 0;
+ }
+
+ static bool is_min_aligned(void* p) {
+ if (alignof(T) == BlockSize) {
+ return is_max_aligned(p);
+ } else {
+ return reinterpret_cast<std::uintptr_t>(p) % BlockSize == alignof(T);
+ }
+ }
+
+ template <class Tp> friend class MinAlignedAllocator;
+ mutable AllocController *P;
+};
+
+
+template <class T, class U>
+inline bool operator==(MinAlignedAllocator<T> const& x,
+ MinAlignedAllocator<U> const& y) {
+ return &x.getController() == &y.getController();
+}
+
+template <class T, class U>
+inline bool operator!=(MinAlignedAllocator<T> const& x,
+ MinAlignedAllocator<U> const& y) {
+ return !(x == y);
+}
+
+template <class T>
+class NullAllocator
+{
+public:
+ typedef T value_type;
+ typedef T* pointer;
+ NullAllocator() = delete;
+ explicit NullAllocator(AllocController& PP) : P(&PP) {}
+
+ NullAllocator(NullAllocator const& other) : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ NullAllocator(NullAllocator&& other) : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ template <class U>
+ NullAllocator(NullAllocator<U> const& other) TEST_NOEXCEPT : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ template <class U>
+ NullAllocator(NullAllocator<U>&& other) TEST_NOEXCEPT : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ T* allocate(std::size_t n)
+ {
+ P->countAlloc(nullptr, n*sizeof(T), alignof(T));
+ return nullptr;
+ }
+
+ void deallocate(T* p, std::size_t n)
+ {
+ void* vp = static_cast<void*>(p);
+ P->countDealloc(vp, n*sizeof(T), alignof(T));
+ }
+
+ AllocController& getController() const { return *P; }
+
+private:
+ template <class Tp> friend class NullAllocator;
+ AllocController *P;
+};
+
+template <class T, class U>
+inline bool operator==(NullAllocator<T> const& x,
+ NullAllocator<U> const& y) {
+ return &x.getController() == &y.getController();
+}
+
+template <class T, class U>
+inline bool operator!=(NullAllocator<T> const& x,
+ NullAllocator<U> const& y) {
+ return !(x == y);
+}
+
+
+
+template <class ProviderT, int = 0>
+class TestResourceImp : public std::experimental::pmr::memory_resource
+{
+public:
+ static int resource_alive;
+ static int resource_constructed;
+ static int resource_destructed;
+
+ static void resetStatics() {
+ assert(resource_alive == 0);
+ resource_alive = 0;
+ resource_constructed = 0;
+ resource_destructed = 0;
+ }
+
+ using memory_resource = std::experimental::pmr::memory_resource;
+ using Provider = ProviderT;
+
+ int value;
+
+ explicit TestResourceImp(int val = 0) : value(val) {
+ ++resource_alive;
+ ++resource_constructed;
+ }
+
+ ~TestResourceImp() noexcept {
+ --resource_alive;
+ ++resource_destructed;
+ }
+
+ void reset() { C.reset(); P.reset(); }
+ AllocController& getController() { return C; }
+
+ bool checkAlloc(void* p, std::size_t s, std::size_t a) const
+ { return C.checkAlloc(p, s, a); }
+
+ bool checkDealloc(void* p, std::size_t s, std::size_t a) const
+ { return C.checkDealloc(p, s, a); }
+
+ bool checkIsEqualCalledEq(int n) const { return C.checkIsEqualCalledEq(n); }
+
+protected:
+ virtual void * do_allocate(std::size_t s, std::size_t a) {
+ if (C.throw_on_alloc) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw TestException{};
+#else
+ assert(false);
+#endif
+ }
+ void* ret = P.allocate(s, a);
+ C.countAlloc(ret, s, a);
+ return ret;
+ }
+
+ virtual void do_deallocate(void * p, std::size_t s, std::size_t a) {
+ C.countDealloc(p, s, a);
+ P.deallocate(p, s, a);
+ }
+
+ virtual bool do_is_equal(memory_resource const & other) const noexcept {
+ C.countIsEqual();
+ TestResourceImp const * o = dynamic_cast<TestResourceImp const *>(&other);
+ return o && o->value == value;
+ }
+private:
+ mutable AllocController C;
+ mutable Provider P;
+ DISALLOW_COPY(TestResourceImp);
+};
+
+template <class Provider, int N>
+int TestResourceImp<Provider, N>::resource_alive = 0;
+
+template <class Provider, int N>
+int TestResourceImp<Provider, N>::resource_constructed = 0;
+
+template <class Provider, int N>
+int TestResourceImp<Provider, N>::resource_destructed = 0;
+
+
+struct NullProvider {
+ NullProvider() {}
+ void* allocate(size_t, size_t) { return nullptr; }
+ void deallocate(void*, size_t, size_t) {}
+ void reset() {}
+private:
+ DISALLOW_COPY(NullProvider);
+};
+
+struct NewDeleteProvider {
+ NewDeleteProvider() {}
+ void* allocate(size_t s, size_t) { return ::operator new(s); }
+ void deallocate(void* p, size_t, size_t) { ::operator delete(p); }
+ void reset() {}
+private:
+ DISALLOW_COPY(NewDeleteProvider);
+};
+
+template <size_t Size = 4096 * 10> // 10 pages worth of memory.
+struct BufferProvider {
+ char buffer[Size];
+ void* next = &buffer;
+ size_t space = Size;
+
+ BufferProvider() {}
+
+ void* allocate(size_t s, size_t a) {
+ void* ret = std::align(s, a, next, space);
+ if (ret == nullptr) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw std::bad_alloc();
+#else
+ assert(false);
+#endif
+ }
+
+ return ret;
+ }
+
+ void deallocate(void*, size_t, size_t) {}
+
+ void reset() {
+ next = &buffer;
+ space = Size;
+ }
+private:
+ DISALLOW_COPY(BufferProvider);
+};
+
+using NullResource = TestResourceImp<NullProvider, 0>;
+using NewDeleteResource = TestResourceImp<NewDeleteProvider, 0>;
+using TestResource = TestResourceImp<BufferProvider<>, 0>;
+using TestResource1 = TestResourceImp<BufferProvider<>, 1>;
+using TestResource2 = TestResourceImp<BufferProvider<>, 2>;
+
+
+#endif /* SUPPORT_TEST_MEMORY_RESOURCE_HPP */
diff --git a/test/support/type_id.h b/test/support/type_id.h
new file mode 100644
index 000000000000..309f0884e4a7
--- /dev/null
+++ b/test/support/type_id.h
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef SUPPORT_TYPE_ID_H
+#define SUPPORT_TYPE_ID_H
+
+#include <functional>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER < 11
+#error This header requires C++11 or greater
+#endif
+
+// TypeID - Represent a unique identifier for a type. TypeID allows equality
+// comparisons between different types.
+struct TypeID {
+ friend bool operator==(TypeID const& LHS, TypeID const& RHS)
+ {return LHS.m_id == RHS.m_id; }
+ friend bool operator!=(TypeID const& LHS, TypeID const& RHS)
+ {return LHS.m_id != RHS.m_id; }
+private:
+ explicit constexpr TypeID(const int* xid) : m_id(xid) {}
+
+ TypeID(const TypeID&) = delete;
+ TypeID& operator=(TypeID const&) = delete;
+
+ const int* const m_id;
+ template <class T> friend TypeID const& makeTypeID();
+
+};
+
+// makeTypeID - Return the TypeID for the specified type 'T'.
+template <class T>
+inline TypeID const& makeTypeID() {
+ static int dummy;
+ static const TypeID id(&dummy);
+ return id;
+}
+
+template <class ...Args>
+struct ArgumentListID {};
+
+// makeArgumentID - Create and return a unique identifier for a given set
+// of arguments.
+template <class ...Args>
+inline TypeID const& makeArgumentID() {
+ return makeTypeID<ArgumentListID<Args...>>();
+}
+
+#endif // SUPPORT_TYPE_ID_H
diff --git a/test/support/uses_alloc_types.hpp b/test/support/uses_alloc_types.hpp
new file mode 100644
index 000000000000..834e57729a7a
--- /dev/null
+++ b/test/support/uses_alloc_types.hpp
@@ -0,0 +1,298 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef USES_ALLOC_TYPES_HPP
+#define USES_ALLOC_TYPES_HPP
+
+# include <experimental/memory_resource>
+# include <experimental/utility>
+# include <memory>
+# include <cassert>
+
+#include "test_memory_resource.hpp"
+#include "type_id.h"
+
+// There are two forms of uses-allocator construction:
+// (1) UA_AllocArg: 'T(allocator_arg_t, Alloc const&, Args&&...)'
+// (2) UA_AllocLast: 'T(Args&&..., Alloc const&)'
+// 'UA_None' represents non-uses allocator construction.
+enum class UsesAllocatorType {
+ UA_None = 0,
+ UA_AllocArg = 2,
+ UA_AllocLast = 4
+};
+constexpr UsesAllocatorType UA_None = UsesAllocatorType::UA_None;
+constexpr UsesAllocatorType UA_AllocArg = UsesAllocatorType::UA_AllocArg;
+constexpr UsesAllocatorType UA_AllocLast = UsesAllocatorType::UA_AllocLast;
+
+template <class Alloc, std::size_t N>
+class UsesAllocatorV1;
+ // Implements form (1) of uses-allocator construction from the specified
+ // 'Alloc' type and exactly 'N' additional arguments. It also provides
+ // non-uses allocator construction from 'N' arguments. This test type
+ // blows up when form (2) of uses-allocator is even considered.
+
+template <class Alloc, std::size_t N>
+class UsesAllocatorV2;
+ // Implements form (2) of uses-allocator construction from the specified
+ // 'Alloc' type and exactly 'N' additional arguments. It also provides
+ // non-uses allocator construction from 'N' arguments.
+
+template <class Alloc, std::size_t N>
+class UsesAllocatorV3;
+ // Implements both form (1) and (2) of uses-allocator construction from
+ // the specified 'Alloc' type and exactly 'N' additional arguments. It also
+ // provides non-uses allocator construction from 'N' arguments.
+
+template <class Alloc, std::size_t>
+class NotUsesAllocator;
+ // Implements both form (1) and (2) of uses-allocator construction from
+ // the specified 'Alloc' type and exactly 'N' additional arguments. It also
+ // provides non-uses allocator construction from 'N' arguments. However
+ // 'NotUsesAllocator' never provides a 'allocator_type' typedef so it is
+ // never automatically uses-allocator constructed.
+
+
+template <class ...ArgTypes, class TestType>
+bool checkConstruct(TestType& value, UsesAllocatorType form,
+ typename TestType::CtorAlloc const& alloc)
+ // Check that 'value' was constructed using the specified 'form' of
+ // construction and with the specified 'ArgTypes...'. Additionally
+ // check that 'value' was constructed using the specified 'alloc'.
+{
+ if (form == UA_None) {
+ return value.template checkConstruct<ArgTypes&&...>(form);
+ } else {
+ return value.template checkConstruct<ArgTypes&&...>(form, alloc);
+ }
+}
+
+
+template <class ...ArgTypes, class TestType>
+bool checkConstruct(TestType& value, UsesAllocatorType form) {
+ return value.template checkConstruct<ArgTypes&&...>(form);
+}
+
+template <class TestType>
+bool checkConstructionEquiv(TestType& T, TestType& U)
+ // check that 'T' and 'U' where initialized in the exact same manner.
+{
+ return T.checkConstructEquiv(U);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+namespace detail {
+
+template <bool IsZero, size_t N, class ArgList, class ...Args>
+struct TakeNImp;
+
+template <class ArgList, class ...Args>
+struct TakeNImp<true, 0, ArgList, Args...> {
+ typedef ArgList type;
+};
+
+template <size_t N, class ...A1, class F, class ...R>
+struct TakeNImp<false, N, ArgumentListID<A1...>, F, R...>
+ : TakeNImp<N-1 == 0, N - 1, ArgumentListID<A1..., F>, R...> {};
+
+template <size_t N, class ...Args>
+struct TakeNArgs : TakeNImp<N == 0, N, ArgumentListID<>, Args...> {};
+
+template <class T>
+struct Identity { typedef T type; };
+
+template <class T>
+using IdentityT = typename Identity<T>::type;
+
+template <bool Value>
+using EnableIfB = typename std::enable_if<Value, bool>::type;
+
+} // end namespace detail
+
+using detail::EnableIfB;
+
+struct AllocLastTag {};
+
+template <class Alloc>
+struct UsesAllocatorTestBase {
+public:
+ using CtorAlloc = typename std::conditional<
+ std::is_same<Alloc, std::experimental::erased_type>::value,
+ std::experimental::pmr::memory_resource*,
+ Alloc
+ >::type;
+
+ template <class ...ArgTypes>
+ bool checkConstruct(UsesAllocatorType expectType) const {
+ return expectType == constructor_called &&
+ makeArgumentID<ArgTypes...>() == *args_id;
+ }
+
+ template <class ...ArgTypes>
+ bool checkConstruct(UsesAllocatorType expectType,
+ CtorAlloc const& expectAlloc) const {
+ return expectType == constructor_called &&
+ makeArgumentID<ArgTypes...>() == *args_id &&
+ expectAlloc == allocator;
+ }
+
+ bool checkConstructEquiv(UsesAllocatorTestBase& O) const {
+ return constructor_called == O.constructor_called
+ && *args_id == *O.args_id
+ && allocator == O.allocator;
+ }
+
+protected:
+ explicit UsesAllocatorTestBase(const TypeID* aid)
+ : args_id(aid), constructor_called(UA_None), allocator()
+ {}
+
+ template <class ...Args>
+ UsesAllocatorTestBase(std::allocator_arg_t, CtorAlloc const& a, Args&&...)
+ : args_id(&makeArgumentID<Args&&...>()),
+ constructor_called(UA_AllocArg),
+ allocator(a)
+ {}
+
+ template <class ...Args, class ArgsIDL = detail::TakeNArgs<sizeof...(Args) - 1, Args&&...>>
+ UsesAllocatorTestBase(AllocLastTag, Args&&... args)
+ : args_id(&makeTypeID<typename ArgsIDL::type>()),
+ constructor_called(UA_AllocLast),
+ allocator(getAllocatorFromPack(
+ typename ArgsIDL::type{},
+ std::forward<Args>(args)...))
+ {
+ }
+
+private:
+ template <class ...LArgs, class ...Args>
+ static CtorAlloc getAllocatorFromPack(ArgumentListID<LArgs...>, Args&&... args) {
+ return getAllocatorFromPackImp<LArgs const&...>(args...);
+ }
+
+ template <class ...LArgs>
+ static CtorAlloc getAllocatorFromPackImp(
+ typename detail::Identity<LArgs>::type..., CtorAlloc const& alloc) {
+ return alloc;
+ }
+
+ const TypeID* args_id;
+ UsesAllocatorType constructor_called = UA_None;
+ CtorAlloc allocator;
+};
+
+template <class Alloc, size_t Arity>
+class UsesAllocatorV1 : public UsesAllocatorTestBase<Alloc>
+{
+public:
+ typedef Alloc allocator_type;
+
+ using Base = UsesAllocatorTestBase<Alloc>;
+ using CtorAlloc = typename Base::CtorAlloc;
+
+ UsesAllocatorV1() : Base(&makeArgumentID<>()) {}
+
+ // Non-Uses Allocator Ctor
+ template <class ...Args, EnableIfB<sizeof...(Args) == Arity> = false>
+ UsesAllocatorV1(Args&&... args) : Base(&makeArgumentID<Args&&...>()) {};
+
+ // Uses Allocator Arg Ctor
+ template <class ...Args>
+ UsesAllocatorV1(std::allocator_arg_t tag, CtorAlloc const & a, Args&&... args)
+ : Base(tag, a, std::forward<Args>(args)...)
+ { }
+
+ // BLOWS UP: Uses Allocator Last Ctor
+ template <class _First, class ...Args, EnableIfB<sizeof...(Args) == Arity> _Dummy = false>
+ constexpr UsesAllocatorV1(_First&& __first, Args&&... args)
+ {
+ static_assert(!std::is_same<_First, _First>::value, "");
+ }
+};
+
+
+template <class Alloc, size_t Arity>
+class UsesAllocatorV2 : public UsesAllocatorTestBase<Alloc>
+{
+public:
+ typedef Alloc allocator_type;
+
+ using Base = UsesAllocatorTestBase<Alloc>;
+ using CtorAlloc = typename Base::CtorAlloc;
+
+ UsesAllocatorV2() : Base(&makeArgumentID<>()) {}
+
+ // Non-Uses Allocator Ctor
+ template <class ...Args, EnableIfB<sizeof...(Args) == Arity> = false>
+ UsesAllocatorV2(Args&&... args) : Base(&makeArgumentID<Args&&...>()) {};
+
+ // Uses Allocator Last Ctor
+ template <class ...Args, EnableIfB<sizeof...(Args) == Arity + 1> = false>
+ UsesAllocatorV2(Args&&... args)
+ : Base(AllocLastTag{}, std::forward<Args>(args)...)
+ {}
+};
+
+template <class Alloc, size_t Arity>
+class UsesAllocatorV3 : public UsesAllocatorTestBase<Alloc>
+{
+public:
+ typedef Alloc allocator_type;
+
+ using Base = UsesAllocatorTestBase<Alloc>;
+ using CtorAlloc = typename Base::CtorAlloc;
+
+ UsesAllocatorV3() : Base(&makeArgumentID<>()) {}
+
+ // Non-Uses Allocator Ctor
+ template <class ...Args, EnableIfB<sizeof...(Args) == Arity> = false>
+ UsesAllocatorV3(Args&&... args) : Base(&makeArgumentID<Args&&...>()) {};
+
+ // Uses Allocator Arg Ctor
+ template <class ...Args>
+ UsesAllocatorV3(std::allocator_arg_t tag, CtorAlloc const& alloc, Args&&... args)
+ : Base(tag, alloc, std::forward<Args>(args)...)
+ {}
+
+ // Uses Allocator Last Ctor
+ template <class ...Args, EnableIfB<sizeof...(Args) == Arity + 1> = false>
+ UsesAllocatorV3(Args&&... args)
+ : Base(AllocLastTag{}, std::forward<Args>(args)...)
+ {}
+};
+
+template <class Alloc, size_t Arity>
+class NotUsesAllocator : public UsesAllocatorTestBase<Alloc>
+{
+public:
+ // no allocator_type typedef provided
+
+ using Base = UsesAllocatorTestBase<Alloc>;
+ using CtorAlloc = typename Base::CtorAlloc;
+
+ NotUsesAllocator() : Base(&makeArgumentID<>()) {}
+
+ // Non-Uses Allocator Ctor
+ template <class ...Args, EnableIfB<sizeof...(Args) == Arity> = false>
+ NotUsesAllocator(Args&&... args) : Base(&makeArgumentID<Args&&...>()) {};
+
+ // Uses Allocator Arg Ctor
+ template <class ...Args>
+ NotUsesAllocator(std::allocator_arg_t tag, CtorAlloc const& alloc, Args&&... args)
+ : Base(tag, alloc, std::forward<Args>(args)...)
+ {}
+
+ // Uses Allocator Last Ctor
+ template <class ...Args, EnableIfB<sizeof...(Args) == Arity + 1> = false>
+ NotUsesAllocator(Args&&... args)
+ : Base(AllocLastTag{}, std::forward<Args>(args)...)
+ {}
+};
+
+#endif /* USES_ALLOC_TYPES_HPP */
diff --git a/test/ubsan_blacklist.txt b/test/ubsan_blacklist.txt
new file mode 100644
index 000000000000..8331d7f41f63
--- /dev/null
+++ b/test/ubsan_blacklist.txt
@@ -0,0 +1 @@
+fun:*__hash_table*