summaryrefslogtreecommitdiff
path: root/test/std
diff options
context:
space:
mode:
Diffstat (limited to 'test/std')
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp27
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp8
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp8
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp8
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp2
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp2
-rw-r--r--test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp2
-rw-r--r--test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp12
-rw-r--r--test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp26
-rw-r--r--test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp50
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_move.pass.cpp46
-rw-r--r--test/std/atomics/atomics.types.generic/integral.pass.cpp32
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h16
-rw-r--r--test/std/containers/Emplaceable.h4
-rw-r--r--test/std/containers/NotConstructible.h4
-rw-r--r--test/std/containers/associative/map/map.access/at.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.access/empty.fail.cpp28
-rw-r--r--test/std/containers/associative/map/map.cons/compare.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp10
-rw-r--r--test/std/containers/associative/map/map.ops/count0.pass.cpp4
-rw-r--r--test/std/containers/associative/map/map.ops/count1.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/count2.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/count3.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range0.pass.cpp10
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range1.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range2.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range3.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/find0.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/find1.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/find2.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/find3.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp6
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/empty.fail.cpp28
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp10
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp4
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp10
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp6
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp2
-rw-r--r--test/std/containers/associative/multiset/empty.fail.cpp28
-rw-r--r--test/std/containers/associative/multiset/equal_range.pass.cpp4
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp7
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp10
-rw-r--r--test/std/containers/associative/set/empty.fail.cpp28
-rw-r--r--test/std/containers/associative/set/set.cons/compare.pass.cpp9
-rw-r--r--test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp10
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.fail.cpp28
-rw-r--r--test/std/containers/container.adaptors/priority.queue/types.fail.cpp2
-rw-r--r--test/std/containers/container.adaptors/queue/queue.defn/empty.fail.cpp28
-rw-r--r--test/std/containers/container.adaptors/queue/queue.defn/types.fail.cpp2
-rw-r--r--test/std/containers/container.adaptors/stack/stack.defn/empty.fail.cpp28
-rw-r--r--test/std/containers/container.adaptors/stack/stack.defn/types.fail.cpp2
-rw-r--r--test/std/containers/sequences/array/at.pass.cpp6
-rw-r--r--test/std/containers/sequences/array/empty.fail.cpp28
-rw-r--r--test/std/containers/sequences/array/empty.pass.cpp36
-rw-r--r--test/std/containers/sequences/array/front_back.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/indexing.pass.cpp2
-rw-r--r--test/std/containers/sequences/array/max_size.pass.cpp36
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/empty.fail.cpp28
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp46
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/size.pass.cpp62
-rw-r--r--test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp10
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp10
-rw-r--r--test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/empty.fail.cpp28
-rw-r--r--test/std/containers/sequences/forwardlist/empty.pass.cpp46
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.capacity/empty.fail.cpp28
-rw-r--r--test/std/containers/sequences/list/list.capacity/empty.pass.cpp46
-rw-r--r--test/std/containers/sequences/list/list.capacity/size.pass.cpp62
-rw-r--r--test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/types.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector.bool/construct_default.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector.bool/empty.fail.cpp28
-rw-r--r--test/std/containers/sequences/vector.bool/empty.pass.cpp46
-rw-r--r--test/std/containers/sequences/vector.bool/reference.swap.pass.cpp16
-rw-r--r--test/std/containers/sequences/vector.bool/size.pass.cpp62
-rw-r--r--test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/empty.fail.cpp28
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp46
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/size.pass.cpp62
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.data/data.pass.cpp12
-rw-r--r--test/std/containers/sequences/vector/vector.data/data_const.pass.cpp12
-rw-r--r--test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp2
-rw-r--r--test/std/containers/test_compare.h9
-rw-r--r--test/std/containers/unord/unord.map/empty.fail.cpp28
-rw-r--r--test/std/containers/unord/unord.map/empty.pass.cpp46
-rw-r--r--test/std/containers/unord/unord.map/rehash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/size.pass.cpp62
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp10
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp8
-rw-r--r--test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp4
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/empty.fail.cpp28
-rw-r--r--test/std/containers/unord/unord.multimap/empty.pass.cpp46
-rw-r--r--test/std/containers/unord/unord.multimap/rehash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/size.pass.cpp62
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp10
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp10
-rw-r--r--test/std/containers/unord/unord.multiset/empty.fail.cpp28
-rw-r--r--test/std/containers/unord/unord.multiset/empty.pass.cpp46
-rw-r--r--test/std/containers/unord/unord.multiset/rehash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/size.pass.cpp62
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp10
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp10
-rw-r--r--test/std/containers/unord/unord.set/empty.fail.cpp28
-rw-r--r--test/std/containers/unord/unord.set/empty.pass.cpp46
-rw-r--r--test/std/containers/unord/unord.set/rehash.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/size.pass.cpp62
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp10
-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/hash_copy_constructible.fail.cpp10
-rw-r--r--test/std/depr/depr.c.headers/complex.h.pass.cpp1
-rw-r--r--test/std/depr/depr.c.headers/tgmath_h.pass.cpp1
-rw-r--r--test/std/depr/depr.c.headers/uchar_h.pass.cpp1
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp2
-rw-r--r--test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp2
-rw-r--r--test/std/diagnostics/syserr/is_error_code_enum.pass.cpp4
-rw-r--r--test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp4
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp1
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp1
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/types.pass.cpp24
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/types.pass.cpp (renamed from test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp)18
-rw-r--r--test/std/experimental/algorithms/alg.search/search.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp2
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp16
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp19
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp4
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp28
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp16
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp248
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp8
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp4
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp28
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp2
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp2
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp2
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp2
-rw-r--r--test/std/experimental/iterator/ostream.joiner/ostream.joiner.cons/ostream_joiner.cons.pass.cpp60
-rw-r--r--test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.assign.pass.cpp130
-rw-r--r--test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp2
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp2
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp4
-rw-r--r--test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp1
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp2
-rw-r--r--test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp1
-rw-r--r--test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp62
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp62
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp2
-rw-r--r--test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp2
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp43
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp23
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/string.pass.cpp12
-rw-r--r--test/std/iterators/iterator.container/data.pass.cpp17
-rw-r--r--test/std/iterators/iterator.container/empty.array.fail.cpp28
-rw-r--r--test/std/iterators/iterator.container/empty.container.fail.cpp28
-rw-r--r--test/std/iterators/iterator.container/empty.initializer_list.fail.cpp28
-rw-r--r--test/std/iterators/iterator.container/empty.pass.cpp16
-rw-r--r--test/std/iterators/iterator.container/size.pass.cpp19
-rw-r--r--test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp3
-rw-r--r--test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp3
-rw-r--r--test/std/iterators/iterator.primitives/iterator.traits/const_volatile_pointer.pass.cpp28
-rw-r--r--test/std/iterators/iterator.primitives/iterator.traits/empty.pass.cpp8
-rw-r--r--test/std/iterators/iterator.primitives/iterator.traits/volatile_pointer.pass.cpp28
-rw-r--r--test/std/iterators/iterator.range/begin-end.fail.cpp32
-rw-r--r--test/std/iterators/iterator.range/begin-end.pass.cpp2
-rw-r--r--test/std/iterators/iterators.general/gcc_workaround.pass.cpp5
-rw-r--r--test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp3
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp4
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp4
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp2
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp2
-rw-r--r--test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp4
-rw-r--r--test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/equal.pass.cpp3
-rw-r--r--test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/align_val_t.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp1
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp1
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp4
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array_ptr.fail.cpp26
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_ptr.fail.cpp26
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp1
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size.fail.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_nothrow.fail.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp4
-rw-r--r--test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp27
-rw-r--r--test/std/language.support/support.dynamic/ptr.launder/launder.pass.cpp35
-rw-r--r--test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp34
-rw-r--r--test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp4
-rw-r--r--test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp1
-rw-r--r--test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp1
-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.types/byteops/and.assign.pass.cpp28
-rw-r--r--test/std/language.support/support.types/byteops/and.pass.cpp20
-rw-r--r--test/std/language.support/support.types/byteops/lshift.assign.fail.cpp6
-rw-r--r--test/std/language.support/support.types/byteops/lshift.assign.pass.cpp16
-rw-r--r--test/std/language.support/support.types/byteops/lshift.fail.cpp4
-rw-r--r--test/std/language.support/support.types/byteops/lshift.pass.cpp14
-rw-r--r--test/std/language.support/support.types/byteops/not.pass.cpp14
-rw-r--r--test/std/language.support/support.types/byteops/or.assign.pass.cpp28
-rw-r--r--test/std/language.support/support.types/byteops/or.pass.cpp20
-rw-r--r--test/std/language.support/support.types/byteops/rshift.assign.fail.cpp6
-rw-r--r--test/std/language.support/support.types/byteops/rshift.assign.pass.cpp16
-rw-r--r--test/std/language.support/support.types/byteops/rshift.fail.cpp4
-rw-r--r--test/std/language.support/support.types/byteops/rshift.pass.cpp18
-rw-r--r--test/std/language.support/support.types/byteops/to_integer.fail.cpp4
-rw-r--r--test/std/language.support/support.types/byteops/to_integer.pass.cpp16
-rw-r--r--test/std/language.support/support.types/byteops/xor.assign.pass.cpp28
-rw-r--r--test/std/language.support/support.types/byteops/xor.pass.cpp20
-rw-r--r--test/std/language.support/support.types/nullptr_t.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp4
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp28
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp10
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp4
-rw-r--r--test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp4
-rw-r--r--test/std/numerics/c.math/ctgmath.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp1
-rw-r--r--test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp6
-rw-r--r--test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp7
-rw-r--r--test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp7
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp3
-rw-r--r--test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp4
-rw-r--r--test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp16
-rw-r--r--test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp27
-rw-r--r--test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp24
-rw-r--r--test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.device/eval.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp5
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp3
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp3
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp8
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp4
-rw-r--r--test/std/re/re.alg/re.alg.match/exponential.pass.cpp48
-rw-r--r--test/std/re/re.alg/re.alg.search/exponential.pass.cpp48
-rw-r--r--test/std/re/re.alg/re.alg.search/grep.pass.cpp2
-rw-r--r--test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp29
-rw-r--r--test/std/re/re.grammar/excessive_brace_count.pass.cpp41
-rw-r--r--test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp2
-rw-r--r--test/std/re/re.regex/re.regex.const/constants.pass.cpp4
-rw-r--r--test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp1
-rw-r--r--test/std/re/re.results/re.results.size/empty.fail.cpp27
-rw-r--r--test/std/strings/basic.string/string.access/at.pass.cpp4
-rw-r--r--test/std/strings/basic.string/string.capacity/empty.fail.cpp28
-rw-r--r--test/std/strings/basic.string/string.capacity/empty.pass.cpp4
-rw-r--r--test/std/strings/basic.string/string.cons/alloc.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp26
-rw-r--r--test/std/strings/basic.string/string.cons/move_alloc.pass.cpp12
-rw-r--r--test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp6
-rw-r--r--test/std/strings/basic.string/string.cons/string_view.fail.cpp4
-rw-r--r--test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp74
-rw-r--r--test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp34
-rw-r--r--test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp63
-rw-r--r--test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp72
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp52
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp24
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp24
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp46
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp20
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp24
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp38
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp24
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp24
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp239
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp60
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp24
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp24
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp286
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp384
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp4
-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.cpp4
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp4
-rw-r--r--test/std/strings/basic.string/string.starts_with/starts_with.char.pass.cpp34
-rw-r--r--test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp62
-rw-r--r--test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp72
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/lt.pass.cpp20
-rw-r--r--test/std/strings/string.view/string.view.access/at.pass.cpp2
-rw-r--r--test/std/strings/string.view/string.view.capacity/capacity.pass.cpp4
-rw-r--r--test/std/strings/string.view/string.view.capacity/empty.fail.cpp28
-rw-r--r--test/std/strings/string.view/string.view.cons/default.pass.cpp2
-rw-r--r--test/std/strings/string.view/string.view.cons/from_literal.pass.cpp6
-rw-r--r--test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp5
-rw-r--r--test/std/strings/string.view/string.view.cons/from_string.pass.cpp5
-rw-r--r--test/std/strings/string.view/string.view.cons/from_string1.fail.cpp2
-rw-r--r--test/std/strings/string.view/string.view.template/ends_with.char.pass.cpp47
-rw-r--r--test/std/strings/string.view/string.view.template/ends_with.ptr.pass.cpp104
-rw-r--r--test/std/strings/string.view/string.view.template/ends_with.string_view.pass.cpp104
-rw-r--r--test/std/strings/string.view/string.view.template/starts_with.char.pass.cpp47
-rw-r--r--test/std/strings/string.view/string.view.template/starts_with.ptr.pass.cpp104
-rw-r--r--test/std/strings/string.view/string.view.template/starts_with.string_view.pass.cpp104
-rw-r--r--test/std/strings/string.view/string_view.literals/literal.pass.cpp6
-rw-r--r--test/std/thread/futures/futures.async/async.fail.cpp38
-rw-r--r--test/std/thread/futures/futures.async/async_race.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.shared_future/wait_until.pass.cpp260
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp30
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp8
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp4
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp4
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp4
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp4
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp8
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp4
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp4
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp4
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/default.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until_deadlock_bug.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp2
-rw-r--r--test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp1
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.fail.cpp29
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.fail.cpp29
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp2
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp8
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp10
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp12
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp8
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp6
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp16
-rw-r--r--test/std/utilities/any/any.nonmembers/make_any.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/comparisons/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp18
-rw-r--r--test/std/utilities/function.objects/func.require/binary_function.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.require/unary_function.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp3
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp2
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp6
-rw-r--r--test/std/utilities/function.objects/logical.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/weak_result.pass.cpp27
-rw-r--r--test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp6
-rw-r--r--test/std/utilities/function.objects/unord.hash/pointer.pass.cpp2
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.fail.cpp51
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp10
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp18
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp8
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp12
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp8
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/incomplete_type_helper.h14
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp7
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp7
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp2
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp28
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp2
-rw-r--r--test/std/utilities/memory/pointer.conversion/to_address.pass.cpp120
-rw-r--r--test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp2
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp34
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.special/io.pass.cpp32
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp7
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp (renamed from test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/nothing_to_do.pass.cpp)17
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp29
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp32
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp3
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.rel/is_callable.pass.cpp160
-rw-r--r--test/std/utilities/meta/meta.rel/is_invocable.pass.cpp166
-rw-r--r--test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp115
-rw-r--r--test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp121
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.fail.cpp (renamed from test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/nothing_to_do.pass.cpp)11
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp52
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp38
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp20
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp10
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp10
-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_constructible.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp10
-rw-r--r--test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp25
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp10
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp12
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp12
-rw-r--r--test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp1
-rw-r--r--test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp2
-rw-r--r--test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp4
-rw-r--r--test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp9
-rw-r--r--test/std/utilities/template.bitset/bitset.members/to_ulong.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.arithmetic/op_++.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.general/ignore.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp1
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp7
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp9
-rw-r--r--test/std/utilities/utility/as_const/as_const.fail.cpp2
-rw-r--r--test/std/utilities/utility/as_const/as_const.pass.cpp12
-rw-r--r--test/std/utilities/utility/forward/forward.fail.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp80
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp2
-rw-r--r--test/std/utilities/utility/synopsis.pass.cpp1
-rw-r--r--test/std/utilities/variant/variant.get/get_index.pass.cpp2
-rw-r--r--test/std/utilities/variant/variant.get/get_type.pass.cpp2
-rw-r--r--test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp2
-rw-r--r--test/std/utilities/variant/variant.visit/visit.pass.cpp2
586 files changed, 7403 insertions, 1928 deletions
diff --git a/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp
index a9ccaf4cd959..b7322542931d 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp
@@ -15,32 +15,49 @@
// void
// generate_n(Iter first, Size n, Generator gen);
+#ifdef _MSC_VER
+#pragma warning(disable: 4244) // conversion from 'const double' to 'int', possible loss of data
+#endif
+
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "user_defined_integral.hpp"
-typedef UserDefinedIntegral<unsigned> UDI;
-
struct gen_test
{
int operator()() const {return 2;}
};
-template <class Iter>
+template <class Iter, class Size>
void
-test()
+test2()
{
const unsigned n = 4;
int ia[n] = {0};
- assert(std::generate_n(Iter(ia), UDI(n), gen_test()) == Iter(ia+n));
+ assert(std::generate_n(Iter(ia), Size(n), gen_test()) == Iter(ia+n));
assert(ia[0] == 2);
assert(ia[1] == 2);
assert(ia[2] == 2);
assert(ia[3] == 2);
}
+template <class Iter>
+void
+test()
+{
+ test2<Iter, int>();
+ test2<Iter, unsigned int>();
+ test2<Iter, long>();
+ test2<Iter, unsigned long>();
+ test2<Iter, UserDefinedIntegral<unsigned> >();
+ test2<Iter, float>();
+ test2<Iter, double>(); // this is PR#35498
+ test2<Iter, long double>();
+}
+
int main()
{
test<forward_iterator<int*> >();
diff --git a/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp
index ec0526c2dc5c..b837a0e514cf 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp
@@ -21,10 +21,10 @@
#include "test_iterators.h"
struct eq {
- eq (int val) : v(val) {}
- bool operator () (int v2) const { return v == v2; }
- int v;
- };
+ eq (int val) : v(val) {}
+ bool operator () (int v2) const { return v == v2; }
+ int v;
+ };
int main()
diff --git a/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp
index 761d71bbf287..fa1faf17e0f4 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp
@@ -21,10 +21,10 @@
#include "test_iterators.h"
struct eq {
- eq (int val) : v(val) {}
- bool operator () (int v2) const { return v == v2; }
- int v;
- };
+ eq (int val) : v(val) {}
+ bool operator () (int v2) const { return v == v2; }
+ int v;
+ };
int main()
{
diff --git a/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp
index 2e52e260336d..1f3c34b2144f 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp
@@ -21,10 +21,10 @@
#include "test_iterators.h"
struct ne {
- ne (int val) : v(val) {}
- bool operator () (int v2) const { return v != v2; }
- int v;
- };
+ ne (int val) : v(val) {}
+ bool operator () (int v2) const { return v != v2; }
+ int v;
+ };
int main()
diff --git a/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp
index f7f8ee092796..4874bcad833e 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp
@@ -66,7 +66,7 @@ test()
assert(std::search_n(Iter(ic), Iter(ic+sc), 4, 0) == Iter(ic+sc));
// Check that we properly convert the size argument to an integral.
- std::search_n(Iter(ic), Iter(ic+sc), UserDefinedIntegral<unsigned>(0), 0);
+ (void)std::search_n(Iter(ic), Iter(ic+sc), UserDefinedIntegral<unsigned>(0), 0);
}
int main()
diff --git a/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp
index 8bc6f4d26bdb..ff459b348932 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp
@@ -142,7 +142,7 @@ test()
count_equal::count = 0;
// Check that we properly convert the size argument to an integral.
- std::search_n(Iter(ic), Iter(ic+sc), UserDefinedIntegral<unsigned>(4), 0, count_equal());
+ TEST_IGNORE_NODISCARD std::search_n(Iter(ic), Iter(ic+sc), UserDefinedIntegral<unsigned>(4), 0, count_equal());
count_equal::count = 0;
}
diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp
index eb37ccac5779..d4bc3fd70a81 100644
--- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp
@@ -26,7 +26,7 @@ int main()
int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
- const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in c++11
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in C++11
typedef input_iterator<const int*> II;
typedef random_access_iterator<const int*> RAI;
diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
index d78809b48524..2a363826261e 100644
--- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
@@ -32,7 +32,7 @@ int main()
int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
- const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in c++11
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in C++11
typedef input_iterator<const int*> II;
typedef random_access_iterator<const int*> RAI;
diff --git a/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp b/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
index 1e18720bfbb3..7d734144ddce 100644
--- a/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
@@ -18,13 +18,13 @@
#include <cassert>
struct Tag {
- Tag() : val(0), tag("Default") {}
- Tag(int a, const char *b) : val(a), tag(b) {}
- ~Tag() {}
+ Tag() : val(0), tag("Default") {}
+ Tag(int a, const char *b) : val(a), tag(b) {}
+ ~Tag() {}
- int val;
- const char *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; }
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 683b07d32089..3743fa535239 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
@@ -23,24 +23,24 @@
#if TEST_STD_VER >= 11
struct S {
- S() : i_(0) {}
- S(int i) : i_(i) {}
+ 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(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; }
+ 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; }
+ 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; }
+ void set(int i) { i_ = i; }
- int i_;
- };
+ int i_;
+ };
#endif
std::mt19937 randomness;
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 3d8902ec2271..992862a4ecf4 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
@@ -33,25 +33,25 @@ struct indirect_less
};
struct S {
- S() : i_(0) {}
- S(int i) : i_(i) {}
+ 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(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; }
+ 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; }
+ 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; }
+ void set(int i) { i_ = i; }
- int i_;
- };
+ int i_;
+ };
#endif // TEST_STD_VER >= 11
@@ -116,6 +116,26 @@ test()
test<Iter>(1000);
}
+struct less_by_first {
+ template <typename Pair>
+ bool operator()(const Pair& lhs, const Pair& rhs) {
+ return std::less<typename Pair::first_type>()(lhs.first, rhs.first);
+ }
+};
+
+void test_PR31166 ()
+{
+ typedef std::pair<int, int> P;
+ typedef std::vector<P> V;
+ P vec[5] = {P(1, 0), P(2, 0), P(2, 1), P(2, 2), P(2, 3)};
+ for ( int i = 0; i < 5; ++i ) {
+ V res(vec, vec + 5);
+ std::inplace_merge(res.begin(), res.begin() + i, res.end(), less_by_first());
+ assert(res.size() == 5);
+ assert(std::equal(res.begin(), res.end(), vec));
+ }
+}
+
int main()
{
test<bidirectional_iterator<int*> >();
@@ -146,4 +166,6 @@ int main()
delete [] ia;
}
#endif // TEST_STD_VER >= 11
+
+ test_PR31166();
}
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 402d57dae69e..da76d2a36c18 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
@@ -87,8 +87,8 @@ struct less { constexpr bool operator ()( const int &x, const int &y) const { re
void constexpr_test()
{
#if TEST_STD_VER >= 14
- constexpr auto p = std::min_element(il, il+8, less());
- static_assert(*p == 1, "");
+ constexpr auto p = std::min_element(il, il+8, less());
+ static_assert(*p == 1, "");
#endif
}
diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_move.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_move.pass.cpp
new file mode 100644
index 000000000000..078060176b73
--- /dev/null
+++ b/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
+// CopyConstructible Compare>
+// requires OutputIterator<OutIter, InIter1::reference>
+// && OutputIterator<OutIter, InIter2::reference>
+// && Predicate<Compare, InIter1::value_type, InIter2::value_type>
+// && Predicate<Compare, InIter2::value_type, InIter1::value_type>
+// OutIter
+// set_union(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2,
+// OutIter result, Compare comp);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <algorithm>
+#include <cassert>
+#include <iterator>
+#include <vector>
+
+#include "MoveOnly.h"
+
+
+int main()
+{
+ std::vector<MoveOnly> lhs, rhs;
+ lhs.push_back(MoveOnly(2));
+ rhs.push_back(MoveOnly(2));
+
+ std::vector<MoveOnly> res;
+ std::set_union(std::make_move_iterator(lhs.begin()),
+ std::make_move_iterator(lhs.end()),
+ std::make_move_iterator(rhs.begin()),
+ std::make_move_iterator(rhs.end()), std::back_inserter(res));
+
+ assert(res.size() == 1);
+ assert(res[0].get() == 2);
+}
diff --git a/test/std/atomics/atomics.types.generic/integral.pass.cpp b/test/std/atomics/atomics.types.generic/integral.pass.cpp
index 63cc02befb7e..74b8c60a3877 100644
--- a/test/std/atomics/atomics.types.generic/integral.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/integral.pass.cpp
@@ -187,14 +187,14 @@ 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<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>();
@@ -213,12 +213,12 @@ int main()
#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>();
+ 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.operations/atomics.types.operations.req/atomic_helpers.h b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
index 482b7319dab2..2ba561fe2d3b 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
@@ -43,14 +43,14 @@ 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>()();
+ TestFunctor< int8_t>()();
+ TestFunctor< uint8_t>()();
+ TestFunctor< int16_t>()();
+ TestFunctor<uint16_t>()();
+ TestFunctor< int32_t>()();
+ TestFunctor<uint32_t>()();
+ TestFunctor< int64_t>()();
+ TestFunctor<uint64_t>()();
}
};
diff --git a/test/std/containers/Emplaceable.h b/test/std/containers/Emplaceable.h
index f9319d410d2b..331a81ff311f 100644
--- a/test/std/containers/Emplaceable.h
+++ b/test/std/containers/Emplaceable.h
@@ -45,8 +45,10 @@ namespace std {
template <>
struct hash<Emplaceable>
- : public std::unary_function<Emplaceable, std::size_t>
{
+ typedef Emplaceable argument_type;
+ typedef std::size_t result_type;
+
std::size_t operator()(const Emplaceable& x) const {return x.get();}
};
diff --git a/test/std/containers/NotConstructible.h b/test/std/containers/NotConstructible.h
index ac8b98ef99f0..55e6480496ee 100644
--- a/test/std/containers/NotConstructible.h
+++ b/test/std/containers/NotConstructible.h
@@ -29,8 +29,10 @@ namespace std
template <>
struct hash<NotConstructible>
- : public std::unary_function<NotConstructible, std::size_t>
{
+ typedef NotConstructible argument_type;
+ typedef std::size_t result_type;
+
std::size_t operator()(const NotConstructible&) const {return 0;}
};
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 6d3e98e9e78b..5822706fbfb3 100644
--- a/test/std/containers/associative/map/map.access/at.pass.cpp
+++ b/test/std/containers/associative/map/map.access/at.pass.cpp
@@ -46,7 +46,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- m.at(6);
+ TEST_IGNORE_NODISCARD m.at(6);
assert(false);
}
catch (std::out_of_range&)
@@ -79,7 +79,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- m.at(6);
+ TEST_IGNORE_NODISCARD m.at(6);
assert(false);
}
catch (std::out_of_range&)
@@ -115,7 +115,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- m.at(6);
+ TEST_IGNORE_NODISCARD m.at(6);
assert(false);
}
catch (std::out_of_range&)
@@ -148,7 +148,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- m.at(6);
+ TEST_IGNORE_NODISCARD m.at(6);
assert(false);
}
catch (std::out_of_range&)
diff --git a/test/std/containers/associative/map/map.access/empty.fail.cpp b/test/std/containers/associative/map/map.access/empty.fail.cpp
new file mode 100644
index 000000000000..14ac13c99688
--- /dev/null
+++ b/test/std/containers/associative/map/map.access/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <map>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::map<int, int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
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 5d8d5e252507..326ce74fc39c 100644
--- a/test/std/containers/associative/map/map.cons/compare.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/compare.pass.cpp
@@ -13,6 +13,8 @@
// explicit map(const key_compare& comp);
+// key_compare key_comp() const;
+
#include <map>
#include <cassert>
@@ -23,7 +25,7 @@ int main()
{
{
typedef test_compare<std::less<int> > C;
- std::map<int, double, C> m(C(3));
+ const std::map<int, double, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
@@ -31,7 +33,7 @@ int main()
#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));
+ const std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
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
index 210c27050a60..a1fde845e9cb 100644
--- 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
@@ -16,14 +16,14 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
- Comp () {}
+ Comp () {}
private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp (const Comp &); // declared but not defined
+ };
int main() {
- std::map<int, int, Comp<int> > m;
+ std::map<int, int, Comp<int> > 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 1fa8c4a70bd9..5649c57f25b9 100644
--- a/test/std/containers/associative/map/map.ops/count0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/count0.pass.cpp
@@ -30,10 +30,10 @@ int main()
{
{
typedef std::map<int, double, transparent_less> M;
- M().count(C2Int{5});
+ assert(M().count(C2Int{5}) == 0);
}
{
typedef std::map<int, double, transparent_less_not_referenceable> M;
- M().count(C2Int{5});
+ assert(M().count(C2Int{5}) == 0);
}
}
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 bd0bf2ec4a04..9fa9f87b8dab 100644
--- a/test/std/containers/associative/map/map.ops/count1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count1.fail.cpp
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;
- M().count(C2Int{5});
+ TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
}
#endif
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 ff4bed8cb60c..c6380635af4e 100644
--- a/test/std/containers/associative/map/map.ops/count2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count2.fail.cpp
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;
- M().count(C2Int{5});
+ TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
}
#endif
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 55a463ed38a6..0fddf61b8d82 100644
--- a/test/std/containers/associative/map/map.ops/count3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count3.fail.cpp
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;
- M().count(C2Int{5});
+ TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
}
#endif
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 c254fb6a7db7..310db6d89374 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
@@ -30,10 +30,16 @@ int main()
{
{
typedef std::map<int, double, transparent_less> M;
- M().equal_range(C2Int{5});
+ typedef std::pair<typename M::iterator, typename M::iterator> P;
+ M example;
+ P result = example.equal_range(C2Int{5});
+ assert(result.first == result.second);
}
{
typedef std::map<int, double, transparent_less_not_referenceable> M;
- M().equal_range(C2Int{5});
+ typedef std::pair<typename M::iterator, typename M::iterator> P;
+ M example;
+ P result = example.equal_range(C2Int{5});
+ assert(result.first == result.second);
}
}
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 a92ad96921c1..b8c8607ee33d 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;
- M().equal_range(C2Int{5});
+ TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
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 23357e26897a..2fb1b2d2e8bb 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;
- M().equal_range(C2Int{5});
+ TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
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 3ffa3f22a619..ad499e1c6cfc 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;
- M().equal_range(C2Int{5});
+ TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
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 76fe9242a476..a11acb103745 100644
--- a/test/std/containers/associative/map/map.ops/find0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/find0.pass.cpp
@@ -30,10 +30,12 @@ int main()
{
{
typedef std::map<int, double, transparent_less> M;
- M().find(C2Int{5});
+ M example;
+ assert(example.find(C2Int{5}) == example.end());
}
{
typedef std::map<int, double, transparent_less_not_referenceable> M;
- M().find(C2Int{5});
+ M example;
+ assert(example.find(C2Int{5}) == example.end());
}
}
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 5346821b42af..6c0f237a2476 100644
--- a/test/std/containers/associative/map/map.ops/find1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find1.fail.cpp
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;
- M().find(C2Int{5});
+ TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
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 1dfb7fa44b06..b915b4396748 100644
--- a/test/std/containers/associative/map/map.ops/find2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find2.fail.cpp
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;
- M().find(C2Int{5});
+ TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
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 f5e92b8264b7..9303a7f07bc1 100644
--- a/test/std/containers/associative/map/map.ops/find3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find3.fail.cpp
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;
- M().find(C2Int{5});
+ TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
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 de7a545b6497..2936da3cb441 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
@@ -30,10 +30,12 @@ int main()
{
{
typedef std::map<int, double, transparent_less> M;
- M().lower_bound(C2Int{5});
+ M example;
+ assert(example.lower_bound(C2Int{5}) == example.end());
}
{
typedef std::map<int, double, transparent_less_not_referenceable> M;
- M().lower_bound(C2Int{5});
+ M example;
+ assert(example.lower_bound(C2Int{5}) == example.end());
}
}
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 6a3ed96a4fc5..beb901cf0775 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;
- M().lower_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
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 87fffe7afcce..2a2258e8f4e1 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;
- M().lower_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
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 fbccd3ab221b..40dc708ad754 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;
- M().lower_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
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 94508d284fd2..fa97a7144862 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
@@ -30,10 +30,12 @@ int main()
{
{
typedef std::map<int, double, transparent_less> M;
- M().upper_bound(C2Int{5});
+ M example;
+ assert(example.upper_bound(C2Int{5}) == example.end());
}
{
typedef std::map<int, double, transparent_less_not_referenceable> M;
- M().upper_bound(C2Int{5});
+ M example;
+ assert(example.upper_bound(C2Int{5}) == example.end());
}
}
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 cb23588e2b97..be40cec7612b 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;
- M().upper_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
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 1fa4cbc70012..c03c249b7364 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;
- M().upper_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
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 0f3cea238295..584833921e9a 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;
- M().upper_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
diff --git a/test/std/containers/associative/multimap/empty.fail.cpp b/test/std/containers/associative/multimap/empty.fail.cpp
new file mode 100644
index 000000000000..12ca05ef192b
--- /dev/null
+++ b/test/std/containers/associative/multimap/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <map>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::multimap<int, int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
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 59a972f45687..02fde1a5388a 100644
--- a/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
@@ -13,6 +13,8 @@
// explicit multimap(const key_compare& comp);
+// key_compare key_comp() const;
+
#include <map>
#include <cassert>
@@ -23,7 +25,7 @@ int main()
{
{
typedef test_compare<std::less<int> > C;
- std::multimap<int, double, C> m(C(3));
+ const std::multimap<int, double, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
@@ -31,7 +33,7 @@ int main()
#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));
+ const std::multimap<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
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
index 3d33f721a56d..ee96ed0a13af 100644
--- 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
@@ -16,14 +16,14 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
- Comp () {}
+ Comp () {}
private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp (const Comp &); // declared but not defined
+ };
int main() {
- std::multimap<int, int, Comp<int> > m;
+ std::multimap<int, int, Comp<int> > 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 289d405739ac..db84dcf7b29e 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
@@ -30,10 +30,10 @@ int main()
{
{
typedef std::multimap<int, double, transparent_less> M;
- M().count(C2Int{5});
+ assert(M().count(C2Int{5}) == 0);
}
{
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
- M().count(C2Int{5});
+ assert(M().count(C2Int{5}) == 0);
}
}
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 70464b12c741..393dd2988086 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
@@ -33,6 +33,6 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;
- M().count(C2Int{5});
+ TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
#endif
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 ad15ff441d74..3fda00765761 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
@@ -33,6 +33,6 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;
- M().count(C2Int{5});
+ TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
#endif
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 5e6c9ab6f967..94453c8f3fae 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
@@ -33,6 +33,6 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
- M().count(C2Int{5});
+ TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
#endif
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 8cdd3c03372f..0c093898d13b 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
@@ -30,10 +30,16 @@ int main()
{
{
typedef std::multimap<int, double, transparent_less> M;
- M().equal_range(C2Int{5});
+ typedef std::pair<typename M::iterator, typename M::iterator> P;
+ M example;
+ P result = example.equal_range(C2Int{5});
+ assert(result.first == result.second);
}
{
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
- M().equal_range(C2Int{5});
+ typedef std::pair<typename M::iterator, typename M::iterator> P;
+ M example;
+ P result = example.equal_range(C2Int{5});
+ assert(result.first == result.second);
}
}
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 a339467f7390..396b49ebc650 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
@@ -33,6 +33,6 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;
- M().equal_range(C2Int{5});
+ TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
#endif
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 633e0615bef0..1741ee24c174 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;
- M().equal_range(C2Int{5});
+ TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
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 34b1b4b77fbe..f555a31f92fd 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
- M().equal_range(C2Int{5});
+ TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
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 a06ec4d702d5..0cff61131a00 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
@@ -30,10 +30,12 @@ int main()
{
{
typedef std::multimap<int, double, transparent_less> M;
- M().find(C2Int{5});
+ M example;
+ assert(example.find(C2Int{5}) == example.end());
}
{
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
- M().find(C2Int{5});
+ M example;
+ assert(example.find(C2Int{5}) == example.end());
}
}
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 bc3593292be2..acea15604319 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;
- M().find(C2Int{5});
+ TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
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 254f524afd5b..38b77684c2d1 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;
- M().find(C2Int{5});
+ TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
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 2805f47598f6..feb6009ed8d0 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
- M().find(C2Int{5});
+ TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
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 1000aa772b31..4a882af4ee09 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
@@ -30,10 +30,12 @@ int main()
{
{
typedef std::multimap<int, double, transparent_less> M;
- M().lower_bound(C2Int{5});
+ M example;
+ assert(example.lower_bound(C2Int{5}) == example.end());
}
{
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
- M().lower_bound(C2Int{5});
+ M example;
+ assert(example.lower_bound(C2Int{5}) == example.end());
}
}
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 4b0db47872af..aec942fa00f4 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;
- M().lower_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
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 300364cffa25..1a856ad84c64 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;
- M().lower_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
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 09963096fdfa..4b02c97f834f 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
- M().lower_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
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 1a572e9c5070..d7618141fe1d 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
@@ -30,10 +30,12 @@ int main()
{
{
typedef std::multimap<int, double, transparent_less> M;
- M().upper_bound(C2Int{5});
+ M example;
+ assert(example.upper_bound(C2Int{5}) == example.end());
}
{
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
- M().upper_bound(C2Int{5});
+ M example;
+ assert(example.upper_bound(C2Int{5}) == example.end());
}
}
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 10e59c5e580e..613194abb632 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;
- M().upper_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
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 81ebbb832c06..100a45e5e61d 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;
- M().upper_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
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 fe41315247ea..b90cd0ac633f 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
@@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
- M().upper_bound(C2Int{5});
+ TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
diff --git a/test/std/containers/associative/multiset/empty.fail.cpp b/test/std/containers/associative/multiset/empty.fail.cpp
new file mode 100644
index 000000000000..2169a07e4bbe
--- /dev/null
+++ b/test/std/containers/associative/multiset/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <set>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::multiset<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/associative/multiset/equal_range.pass.cpp b/test/std/containers/associative/multiset/equal_range.pass.cpp
index 1a3beebcf66b..c9f469ba39be 100644
--- a/test/std/containers/associative/multiset/equal_range.pass.cpp
+++ b/test/std/containers/associative/multiset/equal_range.pass.cpp
@@ -77,7 +77,7 @@ int main()
9,
9
};
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
R r = m.equal_range(4);
assert(r.first == next(m.begin(), 0));
assert(r.second == next(m.begin(), 0));
@@ -156,7 +156,7 @@ int main()
9,
9
};
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
R r = m.equal_range(4);
assert(r.first == next(m.begin(), 0));
assert(r.second == next(m.begin(), 0));
diff --git a/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
index 84038ca1e142..26ca80120fdc 100644
--- a/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
@@ -12,6 +12,10 @@
// class multiset
// explicit multiset(const value_compare& comp);
+// value_compare and key_compare are the same type for set/multiset
+
+// key_compare key_comp() const;
+// value_compare value_comp() const;
#include <set>
#include <cassert>
@@ -21,8 +25,9 @@
int main()
{
typedef test_compare<std::less<int> > C;
- std::multiset<int, C> m(C(3));
+ const std::multiset<int, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
+ assert(m.value_comp() == C(3));
}
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
index 9287a035becb..4f9a6d61be4a 100644
--- 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
@@ -16,14 +16,14 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
- Comp () {}
+ Comp () {}
private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp (const Comp &); // declared but not defined
+ };
int main() {
- std::multiset<int, Comp<int> > m;
+ std::multiset<int, Comp<int> > m;
}
diff --git a/test/std/containers/associative/set/empty.fail.cpp b/test/std/containers/associative/set/empty.fail.cpp
new file mode 100644
index 000000000000..0eea6fb675fe
--- /dev/null
+++ b/test/std/containers/associative/set/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <set>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::set<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/associative/set/set.cons/compare.pass.cpp b/test/std/containers/associative/set/set.cons/compare.pass.cpp
index af94c70671b8..0dac363cab70 100644
--- a/test/std/containers/associative/set/set.cons/compare.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/compare.pass.cpp
@@ -11,7 +11,11 @@
// class set
-// explicit set(const value_compare& comp);
+// explicit set(const value_compare& comp) const;
+// value_compare and key_compare are the same type for set/multiset
+
+// key_compare key_comp() const;
+// value_compare value_comp() const;
#include <set>
#include <cassert>
@@ -21,8 +25,9 @@
int main()
{
typedef test_compare<std::less<int> > C;
- std::set<int, C> m(C(3));
+ const std::set<int, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
+ assert(m.value_comp() == C(3));
}
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
index 858ee4161f03..94ce9cd55247 100644
--- 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
@@ -16,14 +16,14 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
- Comp () {}
+ Comp () {}
private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp (const Comp &); // declared but not defined
+ };
int main() {
- std::set<int, Comp<int> > m;
+ std::set<int, Comp<int> > m;
}
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.fail.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.fail.cpp
new file mode 100644
index 000000000000..c034f22b773a
--- /dev/null
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// class priority_queue
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <queue>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::priority_queue<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/container.adaptors/priority.queue/types.fail.cpp b/test/std/containers/container.adaptors/priority.queue/types.fail.cpp
index 0d3025e1739a..832f09058411 100644
--- a/test/std/containers/container.adaptors/priority.queue/types.fail.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/types.fail.cpp
@@ -31,5 +31,5 @@
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;
+ std::priority_queue<double, std::deque<int>> t;
}
diff --git a/test/std/containers/container.adaptors/queue/queue.defn/empty.fail.cpp b/test/std/containers/container.adaptors/queue/queue.defn/empty.fail.cpp
new file mode 100644
index 000000000000..ce017d2ddd4f
--- /dev/null
+++ b/test/std/containers/container.adaptors/queue/queue.defn/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// class queue
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <queue>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::queue<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
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
index 2b8341fff009..4bd90a88b11f 100644
--- a/test/std/containers/container.adaptors/queue/queue.defn/types.fail.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.defn/types.fail.cpp
@@ -16,5 +16,5 @@
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;
+ std::queue<double, std::deque<int>> t;
}
diff --git a/test/std/containers/container.adaptors/stack/stack.defn/empty.fail.cpp b/test/std/containers/container.adaptors/stack/stack.defn/empty.fail.cpp
new file mode 100644
index 000000000000..001a38fe3d2b
--- /dev/null
+++ b/test/std/containers/container.adaptors/stack/stack.defn/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// class stack
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <stack>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::stack<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
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
index ee4c5441e7c3..1cfa8e4da3ab 100644
--- a/test/std/containers/container.adaptors/stack/stack.defn/types.fail.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.defn/types.fail.cpp
@@ -31,5 +31,5 @@
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;
+ std::stack<double, std::deque<int>> t;
}
diff --git a/test/std/containers/sequences/array/at.pass.cpp b/test/std/containers/sequences/array/at.pass.cpp
index efec4e403001..27b326fa7ce4 100644
--- a/test/std/containers/sequences/array/at.pass.cpp
+++ b/test/std/containers/sequences/array/at.pass.cpp
@@ -27,7 +27,7 @@
constexpr bool check_idx( size_t idx, double val )
{
std::array<double, 3> arr = {1, 2, 3.5};
- return arr.at(idx) == val;
+ return arr.at(idx) == val;
}
#endif
@@ -50,7 +50,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- (void) c.at(3);
+ TEST_IGNORE_NODISCARD c.at(3);
assert(false);
}
catch (const std::out_of_range &) {}
@@ -69,7 +69,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- (void) c.at(3);
+ TEST_IGNORE_NODISCARD c.at(3);
assert(false);
}
catch (const std::out_of_range &) {}
diff --git a/test/std/containers/sequences/array/empty.fail.cpp b/test/std/containers/sequences/array/empty.fail.cpp
new file mode 100644
index 000000000000..85bf5a7c9dab
--- /dev/null
+++ b/test/std/containers/sequences/array/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// class array
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <array>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::array<int, 1> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/sequences/array/empty.pass.cpp b/test/std/containers/sequences/array/empty.pass.cpp
new file mode 100644
index 000000000000..2c01dfc86c19
--- /dev/null
+++ b/test/std/containers/sequences/array/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// class array
+
+// bool empty() const noexcept;
+
+#include <array>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::array<int, 2> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(!c.empty());
+ }
+ {
+ typedef std::array<int, 0> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert( c.empty());
+ }
+}
diff --git a/test/std/containers/sequences/array/front_back.pass.cpp b/test/std/containers/sequences/array/front_back.pass.cpp
index 68fc6cdc4543..0591ca7fac31 100644
--- a/test/std/containers/sequences/array/front_back.pass.cpp
+++ b/test/std/containers/sequences/array/front_back.pass.cpp
@@ -27,13 +27,13 @@
constexpr bool check_front( double val )
{
std::array<double, 3> arr = {1, 2, 3.5};
- return arr.front() == val;
+ return arr.front() == val;
}
constexpr bool check_back( double val )
{
std::array<double, 3> arr = {1, 2, 3.5};
- return arr.back() == val;
+ return arr.back() == val;
}
#endif
diff --git a/test/std/containers/sequences/array/indexing.pass.cpp b/test/std/containers/sequences/array/indexing.pass.cpp
index 3a5b9ee9727d..43c494777a9d 100644
--- a/test/std/containers/sequences/array/indexing.pass.cpp
+++ b/test/std/containers/sequences/array/indexing.pass.cpp
@@ -27,7 +27,7 @@
constexpr bool check_idx( size_t idx, double val )
{
std::array<double, 3> arr = {1, 2, 3.5};
- return arr[idx] == val;
+ return arr[idx] == val;
}
#endif
diff --git a/test/std/containers/sequences/array/max_size.pass.cpp b/test/std/containers/sequences/array/max_size.pass.cpp
new file mode 100644
index 000000000000..9a3fed3950e3
--- /dev/null
+++ b/test/std/containers/sequences/array/max_size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// class array
+
+// bool max_size() const noexcept;
+
+#include <array>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::array<int, 2> C;
+ C c;
+ ASSERT_NOEXCEPT(c.max_size());
+ assert(c.max_size() == 2);
+ }
+ {
+ typedef std::array<int, 0> C;
+ C c;
+ ASSERT_NOEXCEPT(c.max_size());
+ assert(c.max_size() == 0);
+ }
+}
diff --git a/test/std/containers/sequences/deque/deque.capacity/empty.fail.cpp b/test/std/containers/sequences/deque/deque.capacity/empty.fail.cpp
new file mode 100644
index 000000000000..adfd5f2d8167
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.capacity/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// class deque
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <deque>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::deque<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
new file mode 100644
index 000000000000..629a51cab95b
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.capacity/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// class deque
+
+// bool empty() const noexcept;
+
+#include <deque>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::deque<int> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_back(C::value_type(1));
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::deque<int, min_allocator<int>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_back(C::value_type(1));
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp
new file mode 100644
index 000000000000..4974fc74d0b1
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.capacity/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// class deque
+
+// size_type size() const noexcept;
+
+#include <deque>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::deque<int> C;
+ C c;
+ ASSERT_NOEXCEPT(c.size());
+ assert(c.size() == 0);
+ c.push_back(C::value_type(2));
+ assert(c.size() == 1);
+ c.push_back(C::value_type(1));
+ assert(c.size() == 2);
+ c.push_back(C::value_type(3));
+ assert(c.size() == 3);
+ c.erase(c.begin());
+ assert(c.size() == 2);
+ c.erase(c.begin());
+ assert(c.size() == 1);
+ c.erase(c.begin());
+ assert(c.size() == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::deque<int, min_allocator<int>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.size());
+ assert(c.size() == 0);
+ c.push_back(C::value_type(2));
+ assert(c.size() == 1);
+ c.push_back(C::value_type(1));
+ assert(c.size() == 2);
+ c.push_back(C::value_type(3));
+ assert(c.size() == 3);
+ c.erase(c.begin());
+ assert(c.size() == 2);
+ c.erase(c.begin());
+ assert(c.size() == 1);
+ c.erase(c.begin());
+ assert(c.size() == 0);
+ }
+#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 fdf67d23a12d..baae755bc27d 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
@@ -45,9 +45,9 @@ int main()
typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
-#endif // _LIBCPP_VERSION
{
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
+#endif // _LIBCPP_VERSION
}
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 db22086fd4c9..4c1e15f7acb8 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
@@ -80,17 +80,17 @@ int main()
assert(false);
}
catch (...) {
- gCopyConstructorShouldThow = false;
+ gCopyConstructorShouldThow = false;
assert(vec==vec2);
}
- }
+ }
- {
- typedef std::deque<CMyClass, test_allocator<CMyClass> > C;
+ {
+ typedef std::deque<CMyClass, test_allocator<CMyClass> > C;
C vec;
C vec2(vec);
- C::allocator_type::throw_after = 1;
+ C::allocator_type::throw_after = 1;
try {
vec.push_back(instance);
assert(false);
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 7a90c8a75962..0688ed025089 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
@@ -80,17 +80,17 @@ int main()
assert(false);
}
catch (...) {
- gCopyConstructorShouldThow = false;
+ gCopyConstructorShouldThow = false;
assert(vec==vec2);
}
- }
+ }
- {
- typedef std::deque<CMyClass, test_allocator<CMyClass> > C;
+ {
+ typedef std::deque<CMyClass, test_allocator<CMyClass> > C;
C vec;
C vec2(vec);
- C::allocator_type::throw_after = 1;
+ C::allocator_type::throw_after = 1;
try {
vec.push_front(instance);
assert(false);
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 0db30a031282..01a10964b77f 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
@@ -72,7 +72,7 @@ int main()
{
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
#if TEST_STD_VER >= 14
- // In c++14, if POCS is set, swapping the allocator is required not to throw
+ // In C++14, if POCS is set, swapping the allocator is required not to throw
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
diff --git a/test/std/containers/sequences/forwardlist/empty.fail.cpp b/test/std/containers/sequences/forwardlist/empty.fail.cpp
new file mode 100644
index 000000000000..78928b480c9a
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// class forward_list
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <forward_list>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::forward_list<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/sequences/forwardlist/empty.pass.cpp b/test/std/containers/sequences/forwardlist/empty.pass.cpp
new file mode 100644
index 000000000000..1226e68ed3c8
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// class forward_list
+
+// bool empty() const noexcept;
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::forward_list<int> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_front(C::value_type(1));
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::forward_list<int, min_allocator<int>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_front(C::value_type(1));
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#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 3390c331e00e..a4c776abc3e5 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
@@ -45,9 +45,9 @@ int main()
typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
-#endif // _LIBCPP_VERSION
{
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
+#endif // _LIBCPP_VERSION
}
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 d93c079e15ed..ae48d1a4b95c 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
@@ -72,7 +72,7 @@ int main()
{
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
#if TEST_STD_VER >= 14
- // In c++14, if POCS is set, swapping the allocator is required not to throw
+ // In C++14, if POCS is set, swapping the allocator is required not to throw
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
diff --git a/test/std/containers/sequences/list/list.capacity/empty.fail.cpp b/test/std/containers/sequences/list/list.capacity/empty.fail.cpp
new file mode 100644
index 000000000000..fe0387c834d4
--- /dev/null
+++ b/test/std/containers/sequences/list/list.capacity/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// class list
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <list>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::list<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/sequences/list/list.capacity/empty.pass.cpp b/test/std/containers/sequences/list/list.capacity/empty.pass.cpp
new file mode 100644
index 000000000000..b564990f2d0c
--- /dev/null
+++ b/test/std/containers/sequences/list/list.capacity/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// class list
+
+// bool empty() const noexcept;
+
+#include <list>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::list<int> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_back(C::value_type(1));
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::list<int, min_allocator<int>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_back(C::value_type(1));
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/list/list.capacity/size.pass.cpp b/test/std/containers/sequences/list/list.capacity/size.pass.cpp
new file mode 100644
index 000000000000..bddaeb5ac04d
--- /dev/null
+++ b/test/std/containers/sequences/list/list.capacity/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// class list
+
+// size_type size() const noexcept;
+
+#include <list>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::list<int> C;
+ C c;
+ ASSERT_NOEXCEPT(c.size());
+ assert(c.size() == 0);
+ c.push_back(C::value_type(2));
+ assert(c.size() == 1);
+ c.push_back(C::value_type(1));
+ assert(c.size() == 2);
+ c.push_back(C::value_type(3));
+ assert(c.size() == 3);
+ c.erase(c.begin());
+ assert(c.size() == 2);
+ c.erase(c.begin());
+ assert(c.size() == 1);
+ c.erase(c.begin());
+ assert(c.size() == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::list<int, min_allocator<int>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.size());
+ assert(c.size() == 0);
+ c.push_back(C::value_type(2));
+ assert(c.size() == 1);
+ c.push_back(C::value_type(1));
+ assert(c.size() == 2);
+ c.push_back(C::value_type(3));
+ assert(c.size() == 3);
+ c.erase(c.begin());
+ assert(c.size() == 2);
+ c.erase(c.begin());
+ assert(c.size() == 1);
+ c.erase(c.begin());
+ assert(c.size() == 0);
+ }
+#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 cfe1bfd2f411..acb68f3b5beb 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
@@ -72,7 +72,7 @@ int main()
{
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
#if TEST_STD_VER >= 14
- // In c++14, if POCS is set, swapping the allocator is required not to throw
+ // In C++14, if POCS is set, swapping the allocator is required not to throw
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
diff --git a/test/std/containers/sequences/list/types.pass.cpp b/test/std/containers/sequences/list/types.pass.cpp
index 7d5f5b6fa2f0..8c47606fadcc 100644
--- a/test/std/containers/sequences/list/types.pass.cpp
+++ b/test/std/containers/sequences/list/types.pass.cpp
@@ -31,8 +31,8 @@ struct A { std::list<A> v; }; // incomplete type support
int main()
{
- {
- typedef std::list<int> C;
+ {
+ 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), "");
@@ -46,11 +46,11 @@ int main()
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;
+ 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), "");
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 a18ba8fbaab7..0f51c219ee49 100644
--- a/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
@@ -24,9 +24,9 @@ void
test0()
{
#if TEST_STD_VER > 14
- static_assert((noexcept(C{})), "" );
+ static_assert((noexcept(C{})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
+ static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
#endif
C c;
LIBCPP_ASSERT(c.__invariants());
@@ -45,9 +45,9 @@ void
test1(const typename C::allocator_type& a)
{
#if TEST_STD_VER > 14
- static_assert((noexcept(C{typename C::allocator_type{}})), "" );
+ static_assert((noexcept(C{typename C::allocator_type{}})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
+ static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
#endif
C c(a);
LIBCPP_ASSERT(c.__invariants());
diff --git a/test/std/containers/sequences/vector.bool/empty.fail.cpp b/test/std/containers/sequences/vector.bool/empty.fail.cpp
new file mode 100644
index 000000000000..99c245d0c09c
--- /dev/null
+++ b/test/std/containers/sequences/vector.bool/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <vector>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::vector<bool> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/sequences/vector.bool/empty.pass.cpp b/test/std/containers/sequences/vector.bool/empty.pass.cpp
new file mode 100644
index 000000000000..1471c39ebb07
--- /dev/null
+++ b/test/std/containers/sequences/vector.bool/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// bool empty() const noexcept;
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::vector<bool> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_back(false);
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::vector<bool, min_allocator<bool>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_back(false);
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp b/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
index 06351e418ac4..8fe18d4b4f84 100644
--- a/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
@@ -23,17 +23,17 @@ 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];
+ 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);
+ assert(!r1);
+ assert( r2);
+ v.swap(r1, r2);
+ assert( r1);
+ assert(!r2);
}
diff --git a/test/std/containers/sequences/vector.bool/size.pass.cpp b/test/std/containers/sequences/vector.bool/size.pass.cpp
new file mode 100644
index 000000000000..43330c0a5224
--- /dev/null
+++ b/test/std/containers/sequences/vector.bool/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// size_type size() const noexcept;
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::vector<bool> C;
+ C c;
+ ASSERT_NOEXCEPT(c.size());
+ assert(c.size() == 0);
+ c.push_back(false);
+ assert(c.size() == 1);
+ c.push_back(true);
+ assert(c.size() == 2);
+ c.push_back(false);
+ assert(c.size() == 3);
+ c.erase(c.begin());
+ assert(c.size() == 2);
+ c.erase(c.begin());
+ assert(c.size() == 1);
+ c.erase(c.begin());
+ assert(c.size() == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::vector<bool, min_allocator<bool>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.size());
+ assert(c.size() == 0);
+ c.push_back(false);
+ assert(c.size() == 1);
+ c.push_back(true);
+ assert(c.size() == 2);
+ c.push_back(false);
+ assert(c.size() == 3);
+ c.erase(c.begin());
+ assert(c.size() == 2);
+ c.erase(c.begin());
+ assert(c.size() == 1);
+ c.erase(c.begin());
+ assert(c.size() == 0);
+ }
+#endif
+}
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 d888af05f92f..68d04dbb3e9f 100644
--- a/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
@@ -72,7 +72,7 @@ int main()
{
#if TEST_STD_VER >= 14
#if defined(_LIBCPP_VERSION)
- // In c++14, if POCS is set, swapping the allocator is required not to throw
+ // In C++14, if POCS is set, swapping the allocator is required not to throw
typedef std::vector<bool, some_alloc<bool>> C;
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif // _LIBCPP_VERSION
diff --git a/test/std/containers/sequences/vector/vector.capacity/empty.fail.cpp b/test/std/containers/sequences/vector/vector.capacity/empty.fail.cpp
new file mode 100644
index 000000000000..abfdfbfb9c42
--- /dev/null
+++ b/test/std/containers/sequences/vector/vector.capacity/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <vector>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::vector<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp
new file mode 100644
index 000000000000..d81683133f5c
--- /dev/null
+++ b/test/std/containers/sequences/vector/vector.capacity/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// bool empty() const noexcept;
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::vector<int> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_back(C::value_type(1));
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::vector<int, min_allocator<int>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_back(C::value_type(1));
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp
new file mode 100644
index 000000000000..71f531c48888
--- /dev/null
+++ b/test/std/containers/sequences/vector/vector.capacity/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// class vector
+
+// size_type size() const noexcept;
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::vector<int> C;
+ C c;
+ ASSERT_NOEXCEPT(c.size());
+ assert(c.size() == 0);
+ c.push_back(C::value_type(2));
+ assert(c.size() == 1);
+ c.push_back(C::value_type(1));
+ assert(c.size() == 2);
+ c.push_back(C::value_type(3));
+ assert(c.size() == 3);
+ c.erase(c.begin());
+ assert(c.size() == 2);
+ c.erase(c.begin());
+ assert(c.size() == 1);
+ c.erase(c.begin());
+ assert(c.size() == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::vector<int, min_allocator<int>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.size());
+ assert(c.size() == 0);
+ c.push_back(C::value_type(2));
+ assert(c.size() == 1);
+ c.push_back(C::value_type(1));
+ assert(c.size() == 2);
+ c.push_back(C::value_type(3));
+ assert(c.size() == 3);
+ c.erase(c.begin());
+ assert(c.size() == 2);
+ c.erase(c.begin());
+ assert(c.size() == 1);
+ c.erase(c.begin());
+ assert(c.size() == 0);
+ }
+#endif
+}
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 edeae04d7bd7..a71f5b32c039 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
@@ -27,9 +27,9 @@ void
test0()
{
#if TEST_STD_VER > 14
- static_assert((noexcept(C{})), "" );
+ static_assert((noexcept(C{})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
+ static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
#endif
C c;
LIBCPP_ASSERT(c.__invariants());
@@ -50,9 +50,9 @@ void
test1(const typename C::allocator_type& a)
{
#if TEST_STD_VER > 14
- static_assert((noexcept(C{typename C::allocator_type{}})), "" );
+ static_assert((noexcept(C{typename C::allocator_type{}})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
+ static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
#endif
C c(a);
LIBCPP_ASSERT(c.__invariants());
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 b7ea3a286f32..0fc335f15ac9 100644
--- a/test/std/containers/sequences/vector/vector.data/data.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.data/data.pass.cpp
@@ -18,13 +18,13 @@
#include "asan_testing.h"
struct Nasty {
- Nasty() : i_(0) {}
- Nasty(int i) : i_(i) {}
- ~Nasty() {}
+ Nasty() : i_(0) {}
+ Nasty(int i) : i_(i) {}
+ ~Nasty() {}
- Nasty * operator&() const { assert(false); return nullptr; }
- int i_;
- };
+ Nasty * operator&() const { assert(false); return nullptr; }
+ int i_;
+ };
int main()
{
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 3c013c1ae8af..fa8b6a8afdf2 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
@@ -18,13 +18,13 @@
#include "asan_testing.h"
struct Nasty {
- Nasty() : i_(0) {}
- Nasty(int i) : i_(i) {}
- ~Nasty() {}
+ Nasty() : i_(0) {}
+ Nasty(int i) : i_(i) {}
+ ~Nasty() {}
- Nasty * operator&() const { assert(false); return nullptr; }
- int i_;
- };
+ Nasty * operator&() const { assert(false); return nullptr; }
+ int i_;
+ };
int main()
{
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 f92ab8a5c300..062ee22c3fd9 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
@@ -73,7 +73,7 @@ int main()
{
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
#if TEST_STD_VER >= 14
- // In c++14, if POCS is set, swapping the allocator is required not to throw
+ // In C++14, if POCS is set, swapping the allocator is required not to throw
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
diff --git a/test/std/containers/test_compare.h b/test/std/containers/test_compare.h
index 9c54799172e0..35f4640f1cad 100644
--- a/test/std/containers/test_compare.h
+++ b/test/std/containers/test_compare.h
@@ -33,4 +33,13 @@ public:
{return data_ == c.data_;}
};
+
+template <class C>
+class non_const_compare
+{
+// operator() deliberately not marked as 'const'
+ bool operator()(const C& x,const C&y) { return x < y; }
+};
+
+
#endif // TEST_COMPARE_H
diff --git a/test/std/containers/unord/unord.map/empty.fail.cpp b/test/std/containers/unord/unord.map/empty.fail.cpp
new file mode 100644
index 000000000000..1c67169bb518
--- /dev/null
+++ b/test/std/containers/unord/unord.map/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// class unordered_map
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <unordered_map>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::unordered_map<int, int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/unord/unord.map/empty.pass.cpp b/test/std/containers/unord/unord.map/empty.pass.cpp
new file mode 100644
index 000000000000..4488b20b30bb
--- /dev/null
+++ b/test/std/containers/unord/unord.map/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// class unordered_map
+
+// bool empty() const noexcept;
+
+#include <unordered_map>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_map<int, double> M;
+ M m;
+ ASSERT_NOEXCEPT(m.empty());
+ assert(m.empty());
+ m.insert(M::value_type(1, 1.5));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_map<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ ASSERT_NOEXCEPT(m.empty());
+ assert(m.empty());
+ m.insert(M::value_type(1, 1.5));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.map/rehash.pass.cpp b/test/std/containers/unord/unord.map/rehash.pass.cpp
index 58222b7f924d..41015726ef6c 100644
--- a/test/std/containers/unord/unord.map/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.map/rehash.pass.cpp
@@ -25,7 +25,7 @@
template <class C>
void rehash_postcondition(const C& c, size_t n)
{
- assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
}
template <class C>
diff --git a/test/std/containers/unord/unord.map/size.pass.cpp b/test/std/containers/unord/unord.map/size.pass.cpp
new file mode 100644
index 000000000000..5bf75648ff76
--- /dev/null
+++ b/test/std/containers/unord/unord.map/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// class unordered_map
+
+// size_type size() const noexcept;
+
+#include <unordered_map>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_map<int, double> M;
+ M m;
+ ASSERT_NOEXCEPT(m.size());
+ assert(m.size() == 0);
+ m.insert(M::value_type(2, 1.5));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1, 1.5));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3, 1.5));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_map<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ ASSERT_NOEXCEPT(m.size());
+ assert(m.size() == 0);
+ m.insert(M::value_type(2, 1.5));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1, 1.5));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3, 1.5));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
+}
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
index 7f62a4fedf83..8f6f16c62a62 100644
--- 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
@@ -19,14 +19,14 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
- Comp () {}
+ Comp () {}
private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp (const Comp &); // declared but not defined
+ };
int main() {
- std::unordered_map<int, int, std::hash<int>, Comp<int> > m;
+ std::unordered_map<int, int, std::hash<int>, Comp<int> > m;
}
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
index 2525c4444ffb..aca2a5aa3655 100644
--- 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
@@ -19,14 +19,14 @@
template <class T>
struct Hash {
- std::size_t operator () (const T& lhs) const { return 0; }
+ std::size_t operator () (const T& lhs) const { return 0; }
- Hash () {}
+ Hash () {}
private:
- Hash (const Hash &); // declared but not defined
+ Hash (const Hash &); // declared but not defined
};
int main() {
- std::unordered_map<int, int, Hash<int> > m;
+ std::unordered_map<int, int, Hash<int> > m;
}
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 8fbded4cd5fb..e526b654a197 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
@@ -72,7 +72,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- c.at(11);
+ TEST_IGNORE_NODISCARD c.at(11);
assert(false);
}
catch (std::out_of_range&)
@@ -130,7 +130,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- c.at(11);
+ TEST_IGNORE_NODISCARD c.at(11);
assert(false);
}
catch (std::out_of_range&)
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp
index a4d8abc7d317..e84301e9e71f 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp
@@ -189,4 +189,4 @@ int main()
assert(r->second.get() == 5); // value
}
-} \ No newline at end of file
+}
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 75807fa78889..9497b15233cb 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
@@ -122,7 +122,7 @@ struct some_alloc3
int main()
{
- typedef std::pair<const MoveOnly, MoveOnly> MapType;
+ typedef std::pair<const MoveOnly, MoveOnly> MapType;
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
diff --git a/test/std/containers/unord/unord.multimap/empty.fail.cpp b/test/std/containers/unord/unord.multimap/empty.fail.cpp
new file mode 100644
index 000000000000..7e3a6f4b95d1
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// class unordered_multimap
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <unordered_map>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::unordered_multimap<int, int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/unord/unord.multimap/empty.pass.cpp b/test/std/containers/unord/unord.multimap/empty.pass.cpp
new file mode 100644
index 000000000000..68405f229628
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// class unordered_multimap
+
+// bool empty() const noexcept;
+
+#include <unordered_map>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_multimap<int, double> M;
+ M m;
+ ASSERT_NOEXCEPT(m.empty());
+ assert(m.empty());
+ m.insert(M::value_type(1, 1.5));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_multimap<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ ASSERT_NOEXCEPT(m.empty());
+ assert(m.empty());
+ m.insert(M::value_type(1, 1.5));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.multimap/rehash.pass.cpp b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
index 3d3832a2fe3c..22202ccb612a 100644
--- a/test/std/containers/unord/unord.multimap/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
@@ -28,7 +28,7 @@
template <class C>
void rehash_postcondition(const C& c, size_t n)
{
- assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
}
template <class C>
diff --git a/test/std/containers/unord/unord.multimap/size.pass.cpp b/test/std/containers/unord/unord.multimap/size.pass.cpp
new file mode 100644
index 000000000000..b1296624057f
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// class unordered_multimap
+
+// size_type size() const noexcept;
+
+#include <unordered_map>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_multimap<int, double> M;
+ M m;
+ ASSERT_NOEXCEPT(m.size());
+ assert(m.size() == 0);
+ m.insert(M::value_type(2, 1.5));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1, 1.5));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3, 1.5));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_multimap<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ ASSERT_NOEXCEPT(m.size());
+ assert(m.size() == 0);
+ m.insert(M::value_type(2, 1.5));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1, 1.5));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3, 1.5));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
+}
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
index 1c46e7adeafa..cb0ce522d3f9 100644
--- 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
@@ -19,14 +19,14 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
- Comp () {}
+ Comp () {}
private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp (const Comp &); // declared but not defined
+ };
int main() {
- std::unordered_multimap<int, int, std::hash<int>, Comp<int> > m;
+ std::unordered_multimap<int, int, std::hash<int>, Comp<int> > m;
}
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
index 71e1c9f6d4be..f5f42e5d26a7 100644
--- 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
@@ -19,14 +19,14 @@
template <class T>
struct Hash {
- std::size_t operator () (const T& lhs) const { return 0; }
+ std::size_t operator () (const T& lhs) const { return 0; }
- Hash () {}
+ Hash () {}
private:
- Hash (const Hash &); // declared but not defined
- };
+ Hash (const Hash &); // declared but not defined
+ };
int main() {
- std::unordered_multimap<int, int, Hash<int> > m;
+ std::unordered_multimap<int, int, Hash<int> > m;
}
diff --git a/test/std/containers/unord/unord.multiset/empty.fail.cpp b/test/std/containers/unord/unord.multiset/empty.fail.cpp
new file mode 100644
index 000000000000..8e068a4e1ece
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// class unordered_multiset
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <unordered_set>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::unordered_multiset<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/unord/unord.multiset/empty.pass.cpp b/test/std/containers/unord/unord.multiset/empty.pass.cpp
new file mode 100644
index 000000000000..8c65bc23ba68
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// class unordered_multiset
+
+// bool empty() const noexcept;
+
+#include <unordered_set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_multiset<int> M;
+ M m;
+ ASSERT_NOEXCEPT(m.empty());
+ assert(m.empty());
+ m.insert(M::value_type(1));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> M;
+ M m;
+ ASSERT_NOEXCEPT(m.empty());
+ assert(m.empty());
+ m.insert(M::value_type(1));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.multiset/rehash.pass.cpp b/test/std/containers/unord/unord.multiset/rehash.pass.cpp
index 2c5d509951a8..83fb58d8a480 100644
--- a/test/std/containers/unord/unord.multiset/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/rehash.pass.cpp
@@ -24,7 +24,7 @@
template <class C>
void rehash_postcondition(const C& c, size_t n)
{
- assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
}
template <class C>
diff --git a/test/std/containers/unord/unord.multiset/size.pass.cpp b/test/std/containers/unord/unord.multiset/size.pass.cpp
new file mode 100644
index 000000000000..2c23202ce8fc
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// class unordered_multiset
+
+// size_type size() const noexcept;
+
+#include <unordered_set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_multiset<int> M;
+ M m;
+ ASSERT_NOEXCEPT(m.size());
+ assert(m.size() == 0);
+ m.insert(M::value_type(2));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> M;
+ M m;
+ ASSERT_NOEXCEPT(m.size());
+ assert(m.size() == 0);
+ m.insert(M::value_type(2));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
+}
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
index 1cda95be6eba..1b81905b6738 100644
--- 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
@@ -16,14 +16,14 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
- Comp () {}
+ Comp () {}
private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp (const Comp &); // declared but not defined
+ };
int main() {
- std::unordered_multiset<int, std::hash<int>, Comp<int> > m;
+ std::unordered_multiset<int, std::hash<int>, Comp<int> > m;
}
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
index 6fa52a794907..cae8ab9733e1 100644
--- 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
@@ -16,14 +16,14 @@
template <class T>
struct Hash {
- std::size_t operator () (const T& lhs) const { return 0; }
+ std::size_t operator () (const T& lhs) const { return 0; }
- Hash () {}
+ Hash () {}
private:
- Hash (const Hash &); // declared but not defined
- };
+ Hash (const Hash &); // declared but not defined
+ };
int main() {
- std::unordered_multiset<int, Hash<int> > m;
+ std::unordered_multiset<int, Hash<int> > m;
}
diff --git a/test/std/containers/unord/unord.set/empty.fail.cpp b/test/std/containers/unord/unord.set/empty.fail.cpp
new file mode 100644
index 000000000000..23603c2619b9
--- /dev/null
+++ b/test/std/containers/unord/unord.set/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// class unordered_set
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <unordered_set>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::unordered_set<int> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/containers/unord/unord.set/empty.pass.cpp b/test/std/containers/unord/unord.set/empty.pass.cpp
new file mode 100644
index 000000000000..de28cb256944
--- /dev/null
+++ b/test/std/containers/unord/unord.set/empty.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// class unordered_set
+
+// bool empty() const noexcept;
+
+#include <unordered_set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<int> M;
+ M m;
+ ASSERT_NOEXCEPT(m.empty());
+ assert(m.empty());
+ m.insert(M::value_type(1));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> M;
+ M m;
+ ASSERT_NOEXCEPT(m.empty());
+ assert(m.empty());
+ m.insert(M::value_type(1));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/rehash.pass.cpp b/test/std/containers/unord/unord.set/rehash.pass.cpp
index fd689bfd9dfa..dc3adccc6e73 100644
--- a/test/std/containers/unord/unord.set/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.set/rehash.pass.cpp
@@ -24,7 +24,7 @@
template <class C>
void rehash_postcondition(const C& c, size_t n)
{
- assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
}
template <class C>
diff --git a/test/std/containers/unord/unord.set/size.pass.cpp b/test/std/containers/unord/unord.set/size.pass.cpp
new file mode 100644
index 000000000000..c127ddf263db
--- /dev/null
+++ b/test/std/containers/unord/unord.set/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// class unordered_set
+
+// size_type size() const noexcept;
+
+#include <unordered_set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<int> M;
+ M m;
+ ASSERT_NOEXCEPT(m.size());
+ assert(m.size() == 0);
+ m.insert(M::value_type(2));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> M;
+ M m;
+ ASSERT_NOEXCEPT(m.size());
+ assert(m.size() == 0);
+ m.insert(M::value_type(2));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
+}
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
index 79782550d0fe..411731479cbd 100644
--- 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
@@ -16,14 +16,14 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
- Comp () {}
+ Comp () {}
private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp (const Comp &); // declared but not defined
+ };
int main() {
- std::unordered_set<int, std::hash<int>, Comp<int> > m;
+ std::unordered_set<int, std::hash<int>, Comp<int> > m;
}
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 81ad16b7244b..caa4bef0278e 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
@@ -82,7 +82,7 @@ int main()
assert(c.max_load_factor() == 1);
}
{
- A a;
+ A a;
C c(a);
LIBCPP_ASSERT(c.bucket_count() == 0);
assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
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
index 9e135e2c141e..da368a154230 100644
--- 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
@@ -16,14 +16,14 @@
template <class T>
struct Hash {
- std::size_t operator () (const T& lhs) const { return 0; }
+ std::size_t operator () (const T& lhs) const { return 0; }
- Hash () {}
+ Hash () {}
private:
- Hash (const Hash &); // declared but not defined
- };
+ Hash (const Hash &); // declared but not defined
+ };
int main() {
- std::unordered_set<int, Hash<int> > m;
+ std::unordered_set<int, Hash<int> > m;
}
diff --git a/test/std/depr/depr.c.headers/complex.h.pass.cpp b/test/std/depr/depr.c.headers/complex.h.pass.cpp
index 0e3fd3e990b1..4effd9653e50 100644
--- a/test/std/depr/depr.c.headers/complex.h.pass.cpp
+++ b/test/std/depr/depr.c.headers/complex.h.pass.cpp
@@ -14,4 +14,5 @@
int main()
{
std::complex<double> d;
+ (void)d;
}
diff --git a/test/std/depr/depr.c.headers/tgmath_h.pass.cpp b/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
index 965a8de3c56e..91727b6cc728 100644
--- a/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
@@ -14,6 +14,7 @@
int main()
{
std::complex<double> cd;
+ (void)cd;
double x = sin(1.0);
(void)x; // to placate scan-build
}
diff --git a/test/std/depr/depr.c.headers/uchar_h.pass.cpp b/test/std/depr/depr.c.headers/uchar_h.pass.cpp
index f5f69f8e553b..f12169845599 100644
--- a/test/std/depr/depr.c.headers/uchar_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/uchar_h.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: suse-linux-enterprise-server-11
// XFAIL: apple-darwin
// XFAIL: newlib
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp
index 1c56aa9f5dc5..c77ecf92ff14 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp
@@ -12,7 +12,7 @@
// template<cReturnable S, ClassType T>
// const_mem_fun_t<S,T>
// mem_fun(S (T::*f)() const);
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp
index c727e955b1d5..24b86f542c0c 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp
@@ -12,7 +12,7 @@
// template<Returnable S, ClassType T, CopyConstructible A>
// const_mem_fun1_t<S,T,A>
// mem_fun(S (T::*f)(A) const);
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp
index 39b3112da94c..b89aeb8cceb1 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp
@@ -10,7 +10,7 @@
// <functional>
// const_mem_fun1_ref_t
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp
index f07a3b798e72..bb583aa37a91 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp
@@ -10,7 +10,7 @@
// <functional>
// const_mem_fun1_t
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp
index fea1441b31f1..db4606adb556 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp
@@ -12,7 +12,7 @@
// template<Returnable S, ClassType T>
// const_mem_fun_ref_t<S,T>
// mem_fun_ref(S (T::*f)() const);
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp
index f993b7ce1949..cce5c44270b0 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp
@@ -12,7 +12,7 @@
// template<Returnable S, ClassType T, CopyConstructible A>
// const_mem_fun1_ref_t<S,T,A>
// mem_fun_ref(S (T::*f)(A) const);
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp
index e195213f9c02..85ee737d8260 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp
@@ -10,7 +10,7 @@
// <functional>
// const_mem_fun_ref_t
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp
index 228eb3da60a6..5bce7099cdbd 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp
@@ -10,7 +10,7 @@
// <functional>
// const_mem_fun_t
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp
index 8f59a1ae2f82..523a2a612b41 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp
@@ -12,7 +12,7 @@
// template<Returnable S, ClassType T>
// mem_fun_t<S,T>
// mem_fun(S (T::*f)());
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp
index 6191de3fbe63..9b7101f58e43 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp
@@ -12,7 +12,7 @@
// template<Returnable S, ClassType T, CopyConstructible A>
// mem_fun1_t<S,T,A>
// mem_fun(S (T::*f)(A));
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp
index 0effd33f3784..2713b2f8dc5f 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp
@@ -10,7 +10,7 @@
// <functional>
// mem_fun1_ref_t
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp
index aa8e25abe438..22e7fd6b9143 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp
@@ -10,7 +10,7 @@
// <functional>
// mem_fun1_t
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp
index ff7f28af8e30..6f85dae41110 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp
@@ -12,7 +12,7 @@
// template<Returnable S, ClassType T>
// mem_fun_ref_t<S,T>
// mem_fun_ref(S (T::*f)());
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp
index 82d47fefd3d4..b881cb71f2a8 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp
@@ -12,7 +12,7 @@
// template<Returnable S, ClassType T, CopyConstructible A>
// mem_fun1_ref_t<S,T,A>
// mem_fun_ref(S (T::*f)(A));
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp
index f1cf01c5c424..62e8daed1edf 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp
@@ -10,7 +10,7 @@
// <functional>
// mem_fun_ref_t
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp
index e6a1ed330762..b2d6db84c6ea 100644
--- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp
+++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp
@@ -10,7 +10,7 @@
// <functional>
// mem_fun_t
-// Removed in c++1z
+// Removed in c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <functional>
diff --git a/test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp b/test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp
index ddca8fdd63a4..0ae3b00d2bc4 100644
--- a/test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp
+++ b/test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES: c++98 || c++03 || c++11 || c++14
+// binary_function was removed in C++17
// template <class Arg1, class Arg2, class Result>
// struct binary_function
diff --git a/test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp b/test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp
index 87cfe09a33cd..ededc5376e9b 100644
--- a/test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp
+++ b/test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES: c++98 || c++03 || c++11 || c++14
+// unary_function was removed in C++17
// template <class Arg, class Result>
// struct unary_function
diff --git a/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp b/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
index bd843621def8..a74bd2f6bdff 100644
--- a/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
+++ b/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
@@ -28,8 +28,8 @@ test()
}
class A {
- A();
- operator std::error_code () const { return std::error_code(); }
+ A();
+ operator std::error_code () const { return std::error_code(); }
};
// Specialize the template for my class
diff --git a/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp b/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
index b2efd9e07750..1321dcc6b952 100644
--- a/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
+++ b/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
@@ -28,8 +28,8 @@ test()
}
class A {
- A();
- operator std::error_condition () const { return std::error_condition(); }
+ A();
+ operator std::error_condition () const { return std::error_condition(); }
};
// Specialize the template for my class
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 0783de85c5ff..cd76a9f5e734 100644
--- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: suse-linux-enterprise-server-11
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
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 8cccb025538d..c9c6d52e2ebf 100644
--- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -13,6 +13,7 @@
// const error_category& system_category();
+// XFAIL: suse-linux-enterprise-server-11
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/types.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/types.pass.cpp
new file mode 100644
index 000000000000..6c76a25526f6
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+// class error_code
+
+// Make sure that the error_code bits of <system_error> are self-contained.
+
+#include <system_error>
+#include "test_macros.h"
+
+int main()
+{
+ std::error_code x;
+ TEST_IGNORE_NODISCARD x.category(); // returns a std::error_category &
+ TEST_IGNORE_NODISCARD x.default_error_condition(); // std::error_condition
+ TEST_IGNORE_NODISCARD x.message(); // returns a std::string
+}
diff --git a/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/types.pass.cpp
index 86da5054a708..62539ab3ee69 100644
--- a/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/types.pass.cpp
@@ -7,19 +7,17 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-// <optional>
+// <system_error>
+// class error_condition
-// struct nullopt_t{see below};
+// Make sure that the error_condition bits of <system_error> are self-contained.
-#include <optional>
-
-using std::optional;
-using std::nullopt_t;
+#include <system_error>
+#include "test_macros.h"
int main()
{
- // I roughly interpret LWG2736 as "it shall not be possible to copy-list-initialize nullopt_t with an
- // empty braced-init-list."
- nullopt_t foo = {};
+ std::error_condition x = std::errc(0);
+ TEST_IGNORE_NODISCARD x.category(); // returns a std::error_condition &
+ TEST_IGNORE_NODISCARD x.message(); // returns a std::string
}
diff --git a/test/std/experimental/algorithms/alg.search/search.pass.cpp b/test/std/experimental/algorithms/alg.search/search.pass.cpp
index 81d220ba1aed..126f7c8a8e59 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).first
+// returns searcher.operator(first, last).first
//
#include <experimental/algorithm>
diff --git a/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp b/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp
index ce0d44f32d98..7d2d33d63cfc 100644
--- a/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp
+++ b/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp
@@ -32,7 +32,7 @@ int main()
using namespace std::experimental;
non_copyable nc;
any a;
- a = static_cast<non_copyable &&>(nc); // expected-error@experimental/any:* 2 {{static_assert failed "_ValueType must be CopyConstructible."}}
+ a = static_cast<non_copyable &&>(nc); // expected-error-re@experimental/any:* 2 {{static_assert failed{{.*}} "_ValueType must be CopyConstructible."}}
// expected-error@experimental/any:* {{calling a private constructor of class 'non_copyable'}}
}
diff --git a/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp b/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp
index 643b9621ca2f..c4f7568ec853 100644
--- a/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp
+++ b/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp
@@ -31,6 +31,6 @@ int main()
using namespace std::experimental;
non_copyable nc;
any a(static_cast<non_copyable &&>(nc));
- // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType must be CopyConstructible."}}
+ // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType must be CopyConstructible."}}
// expected-error@experimental/any:* 1 {{calling a private constructor of class 'non_copyable'}}
}
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp b/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp
index 6c6ccc68787a..edef3d0a42be 100644
--- a/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp
+++ b/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp
@@ -25,13 +25,13 @@ using std::experimental::any_cast;
int main()
{
any a(1);
- any_cast<int &>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
- any_cast<int &&>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
- any_cast<int const &>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
- any_cast<int const&&>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int &>(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
+ any_cast<int &&>(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
+ any_cast<int const &>(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
+ any_cast<int const&&>(&a); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any const& a2 = a;
- any_cast<int &>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
- any_cast<int &&>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
- any_cast<int const &>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
- any_cast<int const &&>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int &>(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
+ any_cast<int &&>(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
+ any_cast<int const &>(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
+ any_cast<int const &&>(&a2); // expected-error-re@experimental/any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
}
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
index 830e8123150a..4fd60887b54c 100644
--- 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
@@ -15,8 +15,8 @@
// 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;
+// directory_iterator(const path& p, error_code& ec);
+// directory_iterator(const path& p, directory_options options, error_code& ec);
#include <experimental/filesystem>
#include <type_traits>
@@ -40,15 +40,22 @@ TEST_CASE(test_constructor_signatures)
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&, error_code&)
+ static_assert(std::is_constructible<D, path,
+ std::error_code&>::value, "");
+ 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, "");
+ // directory_iterator(path const&, directory_options, error_code&)
+ static_assert(std::is_constructible<D, path, directory_options,
+ std::error_code&>::value, "");
+ static_assert(!std::is_nothrow_constructible<D, path, directory_options,
+ std::error_code&>::value, "");
+
}
TEST_CASE(test_construction_from_bad_path)
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
index 589b4eca7efa..8d888717b101 100644
--- 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
@@ -14,7 +14,7 @@
// class directory_iterator
// directory_iterator& operator++();
-// directory_iterator& increment(error_code& ec) noexcept;
+// directory_iterator& increment(error_code& ec);
#include <experimental/filesystem>
#include <type_traits>
@@ -40,7 +40,7 @@ TEST_CASE(test_increment_signatures)
ASSERT_NOT_NOEXCEPT(++d);
ASSERT_SAME_TYPE(decltype(d.increment(ec)), directory_iterator&);
- ASSERT_NOEXCEPT(d.increment(ec));
+ ASSERT_NOT_NOEXCEPT(d.increment(ec));
}
TEST_CASE(test_prefix_increment)
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp
new file mode 100644
index 000000000000..7e1fea7d34d2
--- /dev/null
+++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/filesystem>
+
+// class path
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <experimental/filesystem>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::experimental::filesystem::path c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp
index 078e006663e9..267d4932c316 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp
@@ -177,6 +177,7 @@ void decompFilenameTest()
for (auto const & TC : FilenameTestCases) {
path p(TC.raw);
assert(p == TC.raw);
+ ASSERT_NOEXCEPT(p.empty());
assert(p.filename() == TC.filename);
assert(p.has_filename() != TC.filename.empty());
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
index 8f6009d399c1..1469dae049eb 100644
--- 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
@@ -16,8 +16,8 @@
//
// 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;
+// recursive_directory_iterator(const path& p, error_code& ec);
+// recursive_directory_iterator(const path& p, directory_options options, error_code& ec);
#include <experimental/filesystem>
@@ -44,15 +44,19 @@ TEST_CASE(test_constructor_signatures)
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&, error_code&)
+ static_assert(std::is_constructible<D, path,
+ std::error_code&>::value, "");
+ 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, "");
+ // directory_iterator(path const&, directory_options, error_code&)
+ static_assert(std::is_constructible<D, path, directory_options, std::error_code&>::value, "");
+ static_assert(!std::is_nothrow_constructible<D, path, directory_options, std::error_code&>::value, "");
}
TEST_CASE(test_construction_from_bad_path)
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
index 26fc3ca28d8e..ea81ee25313d 100644
--- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
@@ -40,7 +40,7 @@ TEST_CASE(test_increment_signatures)
ASSERT_NOT_NOEXCEPT(++d);
ASSERT_SAME_TYPE(decltype(d.increment(ec)), recursive_directory_iterator&);
- ASSERT_NOEXCEPT(d.increment(ec));
+ ASSERT_NOT_NOEXCEPT(d.increment(ec));
}
TEST_CASE(test_prefix_increment)
@@ -237,4 +237,250 @@ TEST_CASE(access_denied_on_recursion_test_case)
}
}
+// See llvm.org/PR35078
+TEST_CASE(test_PR35078)
+{
+ using namespace std::experimental::filesystem;
+ scoped_test_env env;
+ const path testFiles[] = {
+ env.create_dir("dir1"),
+ env.create_dir("dir1/dir2"),
+ env.create_dir("dir1/dir2/dir3"),
+ env.create_file("dir1/file1"),
+ env.create_file("dir1/dir2/dir3/file2")
+ };
+ const path startDir = testFiles[0];
+ const path permDeniedDir = testFiles[1];
+ const path nestedDir = testFiles[2];
+ const path nestedFile = testFiles[3];
+
+ // Change the permissions so we can no longer iterate
+ permissions(permDeniedDir,
+ perms::remove_perms|perms::group_exec
+ |perms::owner_exec|perms::others_exec);
+
+ const std::error_code eacess_ec =
+ std::make_error_code(std::errc::permission_denied);
+ std::error_code ec = GetTestEC();
+
+ const recursive_directory_iterator endIt;
+
+ auto SetupState = [&](bool AllowEAccess, bool& SeenFile3) {
+ SeenFile3 = false;
+ auto Opts = AllowEAccess ? directory_options::skip_permission_denied
+ : directory_options::none;
+ recursive_directory_iterator it(startDir, Opts, ec);
+ while (!ec && it != endIt && *it != nestedDir) {
+ if (*it == nestedFile)
+ SeenFile3 = true;
+ it.increment(ec);
+ }
+ return it;
+ };
+
+ {
+ bool SeenNestedFile = false;
+ recursive_directory_iterator it = SetupState(false, SeenNestedFile);
+ TEST_REQUIRE(it != endIt);
+ TEST_REQUIRE(*it == nestedDir);
+ ec = GetTestEC();
+ it.increment(ec);
+ TEST_CHECK(ec);
+ TEST_CHECK(ec == eacess_ec);
+ TEST_CHECK(it == endIt);
+ }
+ {
+ bool SeenNestedFile = false;
+ recursive_directory_iterator it = SetupState(true, SeenNestedFile);
+ TEST_REQUIRE(it != endIt);
+ TEST_REQUIRE(*it == nestedDir);
+ ec = GetTestEC();
+ it.increment(ec);
+ TEST_CHECK(!ec);
+ if (SeenNestedFile) {
+ TEST_CHECK(it == endIt);
+ } else {
+ TEST_REQUIRE(it != endIt);
+ TEST_CHECK(*it == nestedFile);
+ }
+ }
+}
+
+
+// See llvm.org/PR35078
+TEST_CASE(test_PR35078_with_symlink)
+{
+ using namespace std::experimental::filesystem;
+ scoped_test_env env;
+ const path testFiles[] = {
+ env.create_dir("dir1"),
+ env.create_file("dir1/file1"),
+ env.create_dir("sym_dir"),
+ env.create_dir("sym_dir/nested_sym_dir"),
+ env.create_symlink("sym_dir/nested_sym_dir", "dir1/dir2"),
+ env.create_dir("sym_dir/dir1"),
+ env.create_dir("sym_dir/dir1/dir2"),
+
+ };
+ // const unsigned TestFilesSize = sizeof(testFiles) / sizeof(testFiles[0]);
+ const path startDir = testFiles[0];
+ const path nestedFile = testFiles[1];
+ const path permDeniedDir = testFiles[2];
+ const path symDir = testFiles[4];
+
+ // Change the permissions so we can no longer iterate
+ permissions(permDeniedDir,
+ perms::remove_perms|perms::group_exec
+ |perms::owner_exec|perms::others_exec);
+
+ const std::error_code eacess_ec =
+ std::make_error_code(std::errc::permission_denied);
+ std::error_code ec = GetTestEC();
+
+ const recursive_directory_iterator endIt;
+
+ auto SetupState = [&](bool AllowEAccess, bool FollowSym, bool& SeenFile3) {
+ SeenFile3 = false;
+ auto Opts = AllowEAccess ? directory_options::skip_permission_denied
+ : directory_options::none;
+ if (FollowSym)
+ Opts |= directory_options::follow_directory_symlink;
+ recursive_directory_iterator it(startDir, Opts, ec);
+ while (!ec && it != endIt && *it != symDir) {
+ std::cout << *it << std::endl;
+ if (*it == nestedFile)
+ SeenFile3 = true;
+ it.increment(ec);
+ }
+ return it;
+ };
+
+ struct {
+ bool SkipPermDenied;
+ bool FollowSymlinks;
+ bool ExpectSuccess;
+ } TestCases[] = {
+ // Passing cases
+ {false, false, true}, {true, true, true}, {true, false, true},
+ // Failing cases
+ {false, true, false}
+ };
+ for (auto TC : TestCases) {
+ bool SeenNestedFile = false;
+ recursive_directory_iterator it = SetupState(TC.SkipPermDenied,
+ TC.FollowSymlinks,
+ SeenNestedFile);
+ TEST_REQUIRE(!ec);
+ TEST_REQUIRE(it != endIt);
+ TEST_REQUIRE(*it == symDir);
+ ec = GetTestEC();
+ it.increment(ec);
+ if (TC.ExpectSuccess) {
+ TEST_CHECK(!ec);
+ if (SeenNestedFile) {
+ TEST_CHECK(it == endIt);
+ } else {
+ TEST_REQUIRE(it != endIt);
+ TEST_CHECK(*it == nestedFile);
+ }
+ } else {
+ TEST_CHECK(ec);
+ TEST_CHECK(ec == eacess_ec);
+ TEST_CHECK(it == endIt);
+ }
+ }
+}
+
+
+// See llvm.org/PR35078
+TEST_CASE(test_PR35078_with_symlink_file)
+{
+ 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/file2"),
+ env.create_dir("sym_dir"),
+ env.create_dir("sym_dir/sdir1"),
+ env.create_file("sym_dir/sdir1/sfile1"),
+ env.create_symlink("sym_dir/sdir1/sfile1", "dir1/dir2/file1")
+ };
+ const unsigned TestFilesSize = sizeof(testFiles) / sizeof(testFiles[0]);
+ const path startDir = testFiles[0];
+ const path nestedDir = testFiles[1];
+ const path nestedFile = testFiles[2];
+ const path permDeniedDir = testFiles[3];
+ const path symFile = testFiles[TestFilesSize - 1];
+
+ // Change the permissions so we can no longer iterate
+ permissions(permDeniedDir,
+ perms::remove_perms|perms::group_exec
+ |perms::owner_exec|perms::others_exec);
+
+ const std::error_code eacess_ec =
+ std::make_error_code(std::errc::permission_denied);
+ std::error_code ec = GetTestEC();
+
+ const recursive_directory_iterator EndIt;
+
+ auto SetupState = [&](bool AllowEAccess, bool FollowSym, bool& SeenNestedFile) {
+ SeenNestedFile = false;
+ auto Opts = AllowEAccess ? directory_options::skip_permission_denied
+ : directory_options::none;
+ if (FollowSym)
+ Opts |= directory_options::follow_directory_symlink;
+ recursive_directory_iterator it(startDir, Opts, ec);
+ while (!ec && it != EndIt && *it != nestedDir) {
+ if (*it == nestedFile)
+ SeenNestedFile = true;
+ it.increment(ec);
+ }
+ return it;
+ };
+
+ struct {
+ bool SkipPermDenied;
+ bool FollowSymlinks;
+ bool ExpectSuccess;
+ } TestCases[] = {
+ // Passing cases
+ {false, false, true}, {true, true, true}, {true, false, true},
+ // Failing cases
+ {false, true, false}
+ };
+ for (auto TC : TestCases){
+ bool SeenNestedFile = false;
+ recursive_directory_iterator it = SetupState(TC.SkipPermDenied,
+ TC.FollowSymlinks,
+ SeenNestedFile);
+ TEST_REQUIRE(!ec);
+ TEST_REQUIRE(it != EndIt);
+ TEST_REQUIRE(*it == nestedDir);
+ ec = GetTestEC();
+ it.increment(ec);
+ TEST_REQUIRE(it != EndIt);
+ TEST_CHECK(!ec);
+ TEST_CHECK(*it == symFile);
+ ec = GetTestEC();
+ it.increment(ec);
+ if (TC.ExpectSuccess) {
+ if (!SeenNestedFile) {
+ TEST_CHECK(!ec);
+ TEST_REQUIRE(it != EndIt);
+ TEST_CHECK(*it == nestedFile);
+ ec = GetTestEC();
+ it.increment(ec);
+ }
+ TEST_CHECK(!ec);
+ TEST_CHECK(it == EndIt);
+ } else {
+ TEST_CHECK(ec);
+ TEST_CHECK(ec == eacess_ec);
+ TEST_CHECK(it == EndIt);
+ }
+ }
+}
+
+
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
index c9b42b3596ad..8f44e0d5a23b 100644
--- 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
@@ -12,10 +12,10 @@
// <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, error_code& ec);
// 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;
+// error_code& ec);
#include <experimental/filesystem>
#include <type_traits>
@@ -39,9 +39,9 @@ TEST_CASE(signature_test)
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(fs::copy(p, p, ec));
ASSERT_NOT_NOEXCEPT(copy(p, p, opts));
- ASSERT_NOEXCEPT(copy(p, p, opts, ec));
+ ASSERT_NOT_NOEXCEPT(copy(p, p, opts, ec));
}
// There are 4 cases is the proposal for absolute path.
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
index bc62086c2cff..2da163c33471 100644
--- 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
@@ -12,7 +12,7 @@
// <experimental/filesystem>
// bool is_empty(path const& p);
-// bool is_empty(path const& p, std::error_code& ec) noexcept;
+// bool is_empty(path const& p, std::error_code& ec);
#include <experimental/filesystem>
#include <type_traits>
@@ -30,7 +30,7 @@ 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, ec));
ASSERT_NOT_NOEXCEPT(is_empty(p));
}
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
index ed25649531b9..cdd177399aa7 100644
--- 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
@@ -88,6 +88,16 @@ bool TestSupportsNegativeTimes() {
return !ec && new_write_time <= -5;
}
+// In some configurations, the comparison is tautological and the test is valid.
+// We disable the warning so that we can actually test it regardless. Also, that
+// diagnostic is pretty new, so also don't fail if old clang does not support it
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-warning-option"
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wtautological-constant-compare"
+#endif
+
bool TestSupportsMaxTime() {
using namespace std::chrono;
using Lim = std::numeric_limits<std::time_t>;
@@ -106,11 +116,25 @@ bool TestSupportsMaxTime() {
return !ec && new_write_time > max_sec - 1;
}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
static const bool SupportsNegativeTimes = TestSupportsNegativeTimes();
static const bool SupportsMaxTime = TestSupportsMaxTime();
} // end namespace
+// In some configurations, the comparison is tautological and the test is valid.
+// We disable the warning so that we can actually test it regardless. Also, that
+// diagnostic is pretty new, so also don't fail if old clang does not support it
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-warning-option"
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wtautological-constant-compare"
+#endif
+
// Check if a time point is representable on a given filesystem. Check that:
// (A) 'tp' is representable as a time_t
// (B) 'tp' is non-negative or the filesystem supports negative times.
@@ -127,6 +151,10 @@ inline bool TimeIsRepresentableByFilesystem(file_time_type tp) {
return true;
}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
TEST_SUITE(exists_test_suite)
TEST_CASE(signature_test)
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 467e09d5d2b6..68c786bc7b10 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
@@ -39,7 +39,7 @@
#include "test_iterators.h"
template <typename T> struct MyHash {
- size_t operator () (T t) const { return static_cast<size_t>(t); }
+ size_t operator () (T t) const { return static_cast<size_t>(t); }
};
template <typename Iter1, typename Iter2>
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 b0e5e877dfe1..fe03fa081bce 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
@@ -39,7 +39,7 @@
#include "test_iterators.h"
template <typename T> struct MyHash {
- size_t operator () (T t) const { return static_cast<size_t>(t); }
+ size_t operator () (T t) const { return static_cast<size_t>(t); }
};
struct count_equal
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 abfab17d02ce..e2d34df8235a 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
@@ -38,7 +38,7 @@
#include "test_iterators.h"
template <typename T> struct MyHash {
- size_t operator () (T t) const { return static_cast<size_t>(t); }
+ size_t operator () (T t) const { return static_cast<size_t>(t); }
};
template <typename Iter1, typename Iter2>
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 28f3324966ea..eaa5233d627c 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
@@ -38,7 +38,7 @@
#include "test_iterators.h"
template <typename T> struct MyHash {
- size_t operator () (T t) const { return static_cast<size_t>(t); }
+ size_t operator () (T t) const { return static_cast<size_t>(t); }
};
struct count_equal
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
index 5c84d210e53e..0bae57e1b182 100644
--- 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
@@ -26,33 +26,33 @@
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); }
-
- }
+ 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.ops/ostream_joiner.op.assign.pass.cpp b/test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.assign.pass.cpp
index b2c294fd034b..87ab1e271dc8 100644
--- 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
@@ -27,10 +27,10 @@
#include "test_iterators.h"
struct mutating_delimiter {
- mutating_delimiter(char c = ' ') : c_(c) {}
- char get () const { return c_++; }
- mutable char c_;
- };
+ mutating_delimiter(char c = ' ') : c_(c) {}
+ char get () const { return c_++; }
+ mutable char c_;
+ };
template<class _CharT, class _Traits>
std::basic_ostream<_CharT, _Traits>&
@@ -39,10 +39,10 @@ operator<<(std::basic_ostream<_CharT, _Traits>& os, const mutating_delimiter &d)
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_;
- };
+ mutating_delimiter2(char c = ' ') : c_(c) {}
+ char get () { return c_++; }
+ char c_;
+ };
template<class _CharT, class _Traits>
std::basic_ostream<_CharT, _Traits>&
@@ -54,67 +54,67 @@ 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;
+ 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), "" );
+ 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);
- }
+ 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");
- }
+ 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/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp
index 20bcf60fbf00..83c9da66de44 100644
--- a/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp
+++ b/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp
@@ -33,7 +33,7 @@ struct Noisy {
Noisy(Noisy const&) = delete;
#else
// FIXME: This test depends on copy elision taking place in C++14
- // (pre-c++17 guaranteed copy elision)
+ // (pre-C++17 guaranteed copy elision)
Noisy(Noisy const&);
#endif
};
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
index eddfede29630..8cce9d293f9b 100644
--- 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
@@ -24,4 +24,4 @@ int main() {
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/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
index fd463e88e63f..211363aeac68 100644
--- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
@@ -132,8 +132,8 @@ int main()
// LWG#2792
{
auto res1 = std::experimental::lcm((int64_t)1234, (int32_t)-2147483648);
- (void) std::experimental::lcm<int, unsigned long>(INT_MIN, 2); // this used to trigger UBSAN
+ (void) std::experimental::lcm<int, unsigned long>(INT_MIN, 2); // this used to trigger UBSAN
static_assert( std::is_same<decltype(res1), std::common_type<int64_t, int32_t>::type>::value, "");
- assert(res1 == 1324997410816LL);
+ assert(res1 == 1324997410816LL);
}
}
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 8cf11b553e74..b8fba47f7e78 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
@@ -19,4 +19,5 @@ int main()
using std::experimental::optional;
std::initializer_list<int> list;
+ (void)list;
}
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 b2ffa61c29d9..72e9dad83c84 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
@@ -29,4 +29,4 @@ int main () {
assert ( sv1.size() == s.size());
assert ( sv1.data() == s.data());
}
-} \ No newline at end of file
+}
diff --git a/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp b/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp
index d37557a7b172..5cfb15e3df29 100644
--- a/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp
+++ b/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp
@@ -16,4 +16,5 @@
int main()
{
std::tuple<int> x(1);
+ (void)x;
}
diff --git a/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp b/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
index a00cf139be93..342e33724cc7 100644
--- a/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
+++ b/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = str_.size();
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
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 d12b91cc0cba..dae74f0401f8 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
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
index 29ed68e9770c..6b6737a765da 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
@@ -41,18 +41,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = str_.size();
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
index e7327293bf82..0a48393e01d2 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
@@ -38,18 +38,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
index 292cf7c3b11d..c6368b44afb1 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
@@ -39,18 +39,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
index 465824a659f2..7ee2c295636b 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
@@ -7,6 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: with_system_cxx_lib=macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.10
+// XFAIL: with_system_cxx_lib=macosx10.9
+// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
+
// <istream>
// basic_istream<charT,traits>& getline(char_type* s, streamsize n);
@@ -14,6 +22,8 @@
#include <istream>
#include <cassert>
+#include "test_macros.h"
+
template <class CharT>
struct testbuf
: public std::basic_streambuf<CharT>
@@ -59,7 +69,33 @@ int main()
assert(!is.fail());
assert(std::string(s) == " ");
assert(is.gcount() == 1);
+ // Check that even in error case the buffer is properly 0-terminated.
+ is.getline(s, 5);
+ assert( is.eof());
+ assert( is.fail());
+ assert(std::string(s) == "");
+ assert(is.gcount() == 0);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ char s[5] = "test";
+ is.exceptions(std::istream::eofbit | std::istream::badbit);
+ try
+ {
+ is.getline(s, 5);
+ assert(false);
+ }
+ catch (std::ios_base::failure&)
+ {
+ }
+ assert( is.eof());
+ assert( is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 1);
}
+#endif
{
testbuf<wchar_t> sb(L" \n \n ");
std::wistream is(&sb);
@@ -79,5 +115,31 @@ int main()
assert(!is.fail());
assert(std::wstring(s) == L" ");
assert(is.gcount() == 1);
+ // Check that even in error case the buffer is properly 0-terminated.
+ is.getline(s, 5);
+ assert( is.eof());
+ assert( is.fail());
+ assert(std::wstring(s) == L"");
+ assert(is.gcount() == 0);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ testbuf<wchar_t> sb(L" ");
+ std::wistream is(&sb);
+ wchar_t s[5] = L"test";
+ is.exceptions(std::wistream::eofbit | std::wistream::badbit);
+ try
+ {
+ is.getline(s, 5);
+ assert(false);
+ }
+ catch (std::ios_base::failure&)
+ {
+ }
+ assert( is.eof());
+ assert( is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 1);
}
+#endif
}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
index 7362959966a6..1bce3fa5d4a5 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
@@ -7,6 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: with_system_cxx_lib=macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.10
+// XFAIL: with_system_cxx_lib=macosx10.9
+// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
+
// <istream>
// basic_istream<charT,traits>& getline(char_type* s, streamsize n, char_type delim);
@@ -14,6 +22,8 @@
#include <istream>
#include <cassert>
+#include "test_macros.h"
+
template <class CharT>
struct testbuf
: public std::basic_streambuf<CharT>
@@ -59,7 +69,33 @@ int main()
assert(!is.fail());
assert(std::string(s) == " ");
assert(is.gcount() == 1);
+ // Check that even in error case the buffer is properly 0-terminated.
+ is.getline(s, 5, '*');
+ assert( is.eof());
+ assert( is.fail());
+ assert(std::string(s) == "");
+ assert(is.gcount() == 0);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ testbuf<char> sb(" ");
+ std::istream is(&sb);
+ char s[5] = "test";
+ is.exceptions(std::istream::eofbit | std::istream::badbit);
+ try
+ {
+ is.getline(s, 5, '*');
+ assert(false);
+ }
+ catch (std::ios_base::failure&)
+ {
+ }
+ assert( is.eof());
+ assert( is.fail());
+ assert(std::string(s) == " ");
+ assert(is.gcount() == 1);
}
+#endif
{
testbuf<wchar_t> sb(L" * * ");
std::wistream is(&sb);
@@ -79,5 +115,31 @@ int main()
assert(!is.fail());
assert(std::wstring(s) == L" ");
assert(is.gcount() == 1);
+ // Check that even in error case the buffer is properly 0-terminated.
+ is.getline(s, 5, L'*');
+ assert( is.eof());
+ assert( is.fail());
+ assert(std::wstring(s) == L"");
+ assert(is.gcount() == 0);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ testbuf<wchar_t> sb(L" ");
+ std::wistream is(&sb);
+ wchar_t s[5] = L"test";
+ is.exceptions(std::wistream::eofbit | std::wistream::badbit);
+ try
+ {
+ is.getline(s, 5, L'*');
+ assert(false);
+ }
+ catch (std::ios_base::failure&)
+ {
+ }
+ assert( is.eof());
+ assert( is.fail());
+ assert(std::wstring(s) == L" ");
+ assert(is.gcount() == 1);
}
+#endif
}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
index fe038a7cc1a9..00332f7739b9 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
index 197e4602ff3a..1ee2c565a915 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
index d31da5a18be6..db64b6603dc7 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
index 1b33280e6693..5e601a90cb2a 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
index 7cf46096d029..125c0800a140 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
index dba3f8a68151..4b235f405eec 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
index 1174a0934ed6..44b189d506f8 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
index f6589397ed88..a8bdaba86ff1 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
index 3b8182c1b621..06b6e5c627f8 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
index 61057f7b3063..e6070ef917fe 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
index 4558993e8e1f..7f8cf4608f8f 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
index 1727b3657ce0..59be66fb6ae0 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
index a42cd5628856..6508f2dab2b0 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp
index b778da2240a0..26bfd89dcbb7 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(ch);
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp
index 29153c1d4241..1f05684b50b7 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(ch);
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
index 91ee08cd0563..0fe2c352eeae 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
index 1eb48d378e4c..f5e8ad40d36c 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp
index a50e376643c3..09784c034c8d 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(ch);
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp
index 5c900e6ae533..2e40cf406599 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(ch);
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
index d57d0e7075b5..8ed0bfbdb436 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
index e51e8815730f..e3ff0470a8f7 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
index 9956f3b0162b..32c044d72728 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
index d87e733c09dd..199c5dfd9383 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
index ef7e292e901a..9d45af0fd1a8 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
index 933e01c66e8d..21260d3649c4 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
index 5c0604b73d4d..d4516d2f8975 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
index a26450ae5bf2..e510825b64ac 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
@@ -41,18 +41,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
index 72df6085571f..9e8a5c8f0180 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
@@ -37,18 +37,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
virtual int
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
index dcded343431a..f372701509b1 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
@@ -35,18 +35,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
index 83210c08767a..f04d468ad3c9 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
@@ -39,18 +39,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
index 0958f8330236..87a94ed428bb 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
index 0d6eb3f226f9..71f9ad66b6d6 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
@@ -34,18 +34,18 @@ public:
protected:
virtual typename base::int_type
- overflow(typename base::int_type __c = base::traits_type::eof())
+ overflow(typename base::int_type ch = base::traits_type::eof())
{
- if (__c != base::traits_type::eof())
+ if (ch != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(static_cast<CharT>(__c));
+ str_.push_back(static_cast<CharT>(ch));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
base::pbump(n+1);
}
- return __c;
+ return ch;
}
};
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 6b550b5dabe4..5a8369c2c88e 100644
--- a/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp
+++ b/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp
@@ -18,7 +18,7 @@
#include "test_macros.h"
-// Test that mismatches between strings and wide streams are diagnosed
+// Test that mismatches between strings and wide streams are diagnosed
#if TEST_STD_VER > 11
diff --git a/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp b/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp
index 109674d1660d..9c0d3366c341 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
@@ -20,7 +20,7 @@
#if TEST_STD_VER > 11
-// Test that mismatches in the traits between the quoted object and the dest string are diagnosed.
+// Test that mismatches in the traits between the quoted object and the dest string are diagnosed.
template <class charT>
struct test_traits
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
new file mode 100644
index 000000000000..e7bdd897c745
--- /dev/null
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void pbump(int n);
+//
+// REQUIRES: long_tests
+
+#include <sstream>
+#include <cassert>
+#include "test_macros.h"
+
+struct SB : std::stringbuf
+{
+ SB() : std::stringbuf(std::ios::ate|std::ios::out) { }
+ const char* pubpbase() const { return pbase(); }
+ const char* pubpptr() const { return pptr(); }
+};
+
+int main()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+#endif
+ std::string str(2147483648, 'a');
+ SB sb;
+ sb.str(str);
+ assert(sb.pubpbase() <= sb.pubpptr());
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ }
+ catch (const std::bad_alloc &) {}
+#endif
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
index 28007c8edf45..af2cccc96373 100644
--- a/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
@@ -17,6 +17,21 @@
#include <sstream>
#include <cassert>
+template<typename CharT>
+struct testbuf
+ : std::basic_stringbuf<CharT>
+{
+ void check()
+ {
+ assert(this->eback() == NULL);
+ assert(this->gptr() == NULL);
+ assert(this->egptr() == NULL);
+ assert(this->pbase() == NULL);
+ assert(this->pptr() == NULL);
+ assert(this->epptr() == NULL);
+ }
+};
+
int main()
{
{
@@ -27,4 +42,12 @@ int main()
std::wstringbuf buf;
assert(buf.str() == L"");
}
+ {
+ testbuf<char> buf;
+ buf.check();
+ }
+ {
+ testbuf<wchar_t> buf;
+ buf.check();
+ }
}
diff --git a/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
index f808bcd14dea..b87f7eb92e5a 100644
--- a/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
+++ b/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
@@ -57,12 +57,12 @@ int main()
assert(ss.str() == L"456 1236 ");
}
{ // This is https://bugs.llvm.org/show_bug.cgi?id=33727
- typedef std::basic_string <char, std::char_traits<char>, NoDefaultAllocator<char> > S;
- typedef std::basic_stringbuf<char, std::char_traits<char>, NoDefaultAllocator<char> > SB;
+ typedef std::basic_string <char, std::char_traits<char>, NoDefaultAllocator<char> > S;
+ typedef std::basic_stringbuf<char, std::char_traits<char>, NoDefaultAllocator<char> > SB;
- S s(NoDefaultAllocator<char>(1));
- SB sb(s);
- // This test is not required by the standard, but *where else* could it get the allocator?
- assert(sb.str().get_allocator() == s.get_allocator());
+ S s(NoDefaultAllocator<char>(1));
+ SB sb(s);
+ // This test is not required by the standard, but *where else* could it get the allocator?
+ assert(sb.str().get_allocator() == s.get_allocator());
}
}
diff --git a/test/std/iterators/iterator.container/data.pass.cpp b/test/std/iterators/iterator.container/data.pass.cpp
index a7a17480235a..09b7c0134962 100644
--- a/test/std/iterators/iterator.container/data.pass.cpp
+++ b/test/std/iterators/iterator.container/data.pass.cpp
@@ -7,51 +7,54 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
// <iterator>
// template <class C> constexpr auto data(C& c) -> decltype(c.data()); // C++17
// template <class C> constexpr auto data(const C& c) -> decltype(c.data()); // C++17
// 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
-#include "test_macros.h"
-
-#if TEST_STD_VER <= 14
-int main () {}
-#else
-
#include <iterator>
#include <cassert>
#include <vector>
#include <array>
#include <initializer_list>
+#include "test_macros.h"
+
template<typename C>
void test_const_container( const C& c )
{
+// Can't say noexcept here because the container might not be
assert ( std::data(c) == c.data());
}
template<typename T>
void test_const_container( const std::initializer_list<T>& c )
{
+ ASSERT_NOEXCEPT(std::data(c));
assert ( std::data(c) == c.begin());
}
template<typename C>
void test_container( C& c )
{
+// Can't say noexcept here because the container might not be
assert ( std::data(c) == c.data());
}
template<typename T>
void test_container( std::initializer_list<T>& c)
{
+ ASSERT_NOEXCEPT(std::data(c));
assert ( std::data(c) == c.begin());
}
template<typename T, size_t Sz>
void test_const_array( const T (&array)[Sz] )
{
+ ASSERT_NOEXCEPT(std::data(array));
assert ( std::data(array) == &array[0]);
}
@@ -72,5 +75,3 @@ int main()
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
}
-
-#endif
diff --git a/test/std/iterators/iterator.container/empty.array.fail.cpp b/test/std/iterators/iterator.container/empty.array.fail.cpp
new file mode 100644
index 000000000000..a5925dee79af
--- /dev/null
+++ b/test/std/iterators/iterator.container/empty.array.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// <iterator>
+// template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <vector>
+#include <iterator>
+
+#include "test_macros.h"
+
+int main ()
+{
+ int c[5];
+ std::empty(c); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/iterators/iterator.container/empty.container.fail.cpp b/test/std/iterators/iterator.container/empty.container.fail.cpp
new file mode 100644
index 000000000000..1773b53e7b19
--- /dev/null
+++ b/test/std/iterators/iterator.container/empty.container.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// <iterator>
+// template <class C> constexpr auto empty(const C& c) -> decltype(c.empty());
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <vector>
+#include <iterator>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::vector<int> c;
+ std::empty(c); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/iterators/iterator.container/empty.initializer_list.fail.cpp b/test/std/iterators/iterator.container/empty.initializer_list.fail.cpp
new file mode 100644
index 000000000000..f6657526800e
--- /dev/null
+++ b/test/std/iterators/iterator.container/empty.initializer_list.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// <iterator>
+// template <class E> constexpr bool empty(initializer_list<E> il) noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <initializer_list>
+#include <iterator>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::initializer_list<int> c = { 4 };
+ std::empty(c); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/iterators/iterator.container/empty.pass.cpp b/test/std/iterators/iterator.container/empty.pass.cpp
index f9b8b94a89f9..cd000cc2fe76 100644
--- a/test/std/iterators/iterator.container/empty.pass.cpp
+++ b/test/std/iterators/iterator.container/empty.pass.cpp
@@ -7,17 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
// <iterator>
// template <class C> constexpr auto empty(const C& c) -> decltype(c.empty()); // C++17
// 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
-#include "test_macros.h"
-
-#if TEST_STD_VER <= 14
-int main () {}
-#else
-
#include <iterator>
#include <cassert>
#include <vector>
@@ -25,9 +21,12 @@ int main () {}
#include <list>
#include <initializer_list>
+#include "test_macros.h"
+
template<typename C>
void test_const_container( const C& c )
{
+// Can't say noexcept here because the container might not be
assert ( std::empty(c) == c.empty());
}
@@ -40,18 +39,21 @@ void test_const_container( const std::initializer_list<T>& c )
template<typename C>
void test_container( C& c )
{
+// Can't say noexcept here because the container might not be
assert ( std::empty(c) == c.empty());
}
template<typename T>
void test_container( std::initializer_list<T>& c )
{
+ ASSERT_NOEXCEPT(std::empty(c));
assert ( std::empty(c) == (c.size() == 0));
}
template<typename T, size_t Sz>
void test_const_array( const T (&array)[Sz] )
{
+ ASSERT_NOEXCEPT(std::empty(array));
assert (!std::empty(array));
}
@@ -75,5 +77,3 @@ int main()
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
}
-
-#endif
diff --git a/test/std/iterators/iterator.container/size.pass.cpp b/test/std/iterators/iterator.container/size.pass.cpp
index 87b0ef897072..7d443e6e123c 100644
--- a/test/std/iterators/iterator.container/size.pass.cpp
+++ b/test/std/iterators/iterator.container/size.pass.cpp
@@ -7,16 +7,12 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
// <iterator>
// 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
-#include "test_macros.h"
-
-#if TEST_STD_VER <= 14
-int main () {}
-#else
-
#include <iterator>
#include <cassert>
#include <vector>
@@ -24,33 +20,42 @@ int main () {}
#include <list>
#include <initializer_list>
+#include "test_macros.h"
+
template<typename C>
void test_const_container( const C& c )
{
+// Can't say noexcept here because the container might not be
assert ( std::size(c) == c.size());
}
template<typename T>
void test_const_container( const std::initializer_list<T>& c)
{
+// ASSERT_NOEXCEPT(std::size(c));
+// For some reason, there isn't a std::size() for initializer lists
assert ( std::size(c) == c.size());
}
template<typename C>
void test_container( C& c)
{
+// Can't say noexcept here because the container might not be
assert ( std::size(c) == c.size());
}
template<typename T>
void test_container( std::initializer_list<T>& c )
{
+// ASSERT_NOEXCEPT(std::size(c));
+// For some reason, there isn't a std::size() for initializer lists
assert ( std::size(c) == c.size());
}
template<typename T, size_t Sz>
void test_const_array( const T (&array)[Sz] )
{
+ ASSERT_NOEXCEPT(std::size(array));
assert ( std::size(array) == Sz );
}
@@ -74,5 +79,3 @@ int main()
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
}
-
-#endif
diff --git a/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
index e257b3eaaf31..1743349a5f72 100644
--- a/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
+++ b/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
@@ -24,6 +24,9 @@ void
test(It i, typename std::iterator_traits<It>::difference_type n, It x)
{
assert(std::next(i, n) == x);
+
+ It (*next)(It, typename std::iterator_traits<It>::difference_type) = std::next;
+ assert(next(i, n) == x);
}
template <class It>
diff --git a/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
index 1eb91881fe11..554445c188d0 100644
--- a/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
+++ b/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
@@ -22,6 +22,9 @@ void
test(It i, typename std::iterator_traits<It>::difference_type n, It x)
{
assert(std::prev(i, n) == x);
+
+ It (*prev)(It, typename std::iterator_traits<It>::difference_type) = std::prev;
+ assert(prev(i, n) == x);
}
template <class It>
diff --git a/test/std/iterators/iterator.primitives/iterator.traits/const_volatile_pointer.pass.cpp b/test/std/iterators/iterator.primitives/iterator.traits/const_volatile_pointer.pass.cpp
new file mode 100644
index 000000000000..a08f35fe9614
--- /dev/null
+++ b/test/std/iterators/iterator.primitives/iterator.traits/const_volatile_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template<class T>
+// struct iterator_traits<const T*>
+
+#include <iterator>
+#include <type_traits>
+
+struct A {};
+
+int main()
+{
+ typedef std::iterator_traits<const volatile A*> It;
+ static_assert((std::is_same<It::difference_type, std::ptrdiff_t>::value), "");
+ static_assert((std::is_same<It::value_type, A>::value), "");
+ static_assert((std::is_same<It::pointer, const volatile A*>::value), "");
+ static_assert((std::is_same<It::reference, const volatile A&>::value), "");
+ static_assert((std::is_same<It::iterator_category, std::random_access_iterator_tag>::value), "");
+}
diff --git a/test/std/iterators/iterator.primitives/iterator.traits/empty.pass.cpp b/test/std/iterators/iterator.primitives/iterator.traits/empty.pass.cpp
index e48e44b3777f..179e5e762a90 100644
--- a/test/std/iterators/iterator.primitives/iterator.traits/empty.pass.cpp
+++ b/test/std/iterators/iterator.primitives/iterator.traits/empty.pass.cpp
@@ -20,15 +20,15 @@ struct not_an_iterator
{
};
-template <class _Tp>
+template <class T>
struct has_value_type
{
private:
struct two {char lx; char lxx;};
- template <class _Up> static two test(...);
- template <class _Up> static char test(typename _Up::value_type* = 0);
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::value_type* = 0);
public:
- static const bool value = sizeof(test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(0)) == 1;
};
int main()
diff --git a/test/std/iterators/iterator.primitives/iterator.traits/volatile_pointer.pass.cpp b/test/std/iterators/iterator.primitives/iterator.traits/volatile_pointer.pass.cpp
new file mode 100644
index 000000000000..1630feb25eed
--- /dev/null
+++ b/test/std/iterators/iterator.primitives/iterator.traits/volatile_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template<class T>
+// struct iterator_traits<const T*>
+
+#include <iterator>
+#include <type_traits>
+
+struct A {};
+
+int main()
+{
+ typedef std::iterator_traits<volatile A*> It;
+ static_assert((std::is_same<It::difference_type, std::ptrdiff_t>::value), "");
+ static_assert((std::is_same<It::value_type, A>::value), "");
+ static_assert((std::is_same<It::pointer, volatile A*>::value), "");
+ static_assert((std::is_same<It::reference, volatile A&>::value), "");
+ static_assert((std::is_same<It::iterator_category, std::random_access_iterator_tag>::value), "");
+}
diff --git a/test/std/iterators/iterator.range/begin-end.fail.cpp b/test/std/iterators/iterator.range/begin-end.fail.cpp
index 94a3d8c2004d..18c5943a46ba 100644
--- a/test/std/iterators/iterator.range/begin-end.fail.cpp
+++ b/test/std/iterators/iterator.range/begin-end.fail.cpp
@@ -26,26 +26,26 @@
#include <cassert>
namespace Foo {
- struct FakeContainer {};
- typedef int FakeIter;
-
- FakeIter begin(const FakeContainer &) { return 1; }
- FakeIter end (const FakeContainer &) { return 2; }
- FakeIter rbegin(const FakeContainer &) { return 3; }
- FakeIter rend (const FakeContainer &) { return 4; }
-
- FakeIter cbegin(const FakeContainer &) { return 11; }
- FakeIter cend (const FakeContainer &) { return 12; }
- FakeIter crbegin(const FakeContainer &) { return 13; }
- FakeIter crend (const FakeContainer &) { return 14; }
+ struct FakeContainer {};
+ typedef int FakeIter;
+
+ FakeIter begin(const FakeContainer &) { return 1; }
+ FakeIter end (const FakeContainer &) { return 2; }
+ FakeIter rbegin(const FakeContainer &) { return 3; }
+ FakeIter rend (const FakeContainer &) { return 4; }
+
+ FakeIter cbegin(const FakeContainer &) { return 11; }
+ FakeIter cend (const FakeContainer &) { return 12; }
+ FakeIter crbegin(const FakeContainer &) { return 13; }
+ FakeIter crend (const FakeContainer &) { return 14; }
}
int main(){
// Bug #28927 - shouldn't find these via ADL
- (void) std::cbegin (Foo::FakeContainer());
- (void) std::cend (Foo::FakeContainer());
- (void) std::crbegin(Foo::FakeContainer());
- (void) std::crend (Foo::FakeContainer());
+ TEST_IGNORE_NODISCARD std::cbegin (Foo::FakeContainer());
+ TEST_IGNORE_NODISCARD std::cend (Foo::FakeContainer());
+ TEST_IGNORE_NODISCARD std::crbegin(Foo::FakeContainer());
+ TEST_IGNORE_NODISCARD std::crend (Foo::FakeContainer());
}
#endif
diff --git a/test/std/iterators/iterator.range/begin-end.pass.cpp b/test/std/iterators/iterator.range/begin-end.pass.cpp
index 2b5377f486f4..201dd066b86b 100644
--- a/test/std/iterators/iterator.range/begin-end.pass.cpp
+++ b/test/std/iterators/iterator.range/begin-end.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: c++03, c++98
+// XFAIL: c++98, c++03
// <iterator>
// template <class C> constexpr auto begin(C& c) -> decltype(c.begin());
diff --git a/test/std/iterators/iterators.general/gcc_workaround.pass.cpp b/test/std/iterators/iterators.general/gcc_workaround.pass.cpp
index 6522bd3c7bcb..7578e718231d 100644
--- a/test/std/iterators/iterators.general/gcc_workaround.pass.cpp
+++ b/test/std/iterators/iterators.general/gcc_workaround.pass.cpp
@@ -10,11 +10,12 @@
// Tests workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816.
#include <string>
+#include "test_macros.h"
-void f(const std::string &s) { s.begin(); }
+void f(const std::string &s) { TEST_IGNORE_NODISCARD s.begin(); }
#include <vector>
-void AppendTo(const std::vector<char> &v) { v.begin(); }
+void AppendTo(const std::vector<char> &v) { TEST_IGNORE_NODISCARD v.begin(); }
int main() {}
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 5b61a3895132..e379b30575fc 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
@@ -29,6 +29,7 @@
#include <iterator>
#include <type_traits>
#include <vector>
+#include "test_macros.h"
template <class C>
struct find_members
@@ -38,7 +39,7 @@ struct find_members
void test()
{
this->container = 0;
- (void)(this->iter == this->iter);
+ TEST_IGNORE_NODISCARD (this->iter == this->iter);
}
};
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
index d2ad79af66fd..99ff9641acdc 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
@@ -43,8 +43,8 @@ int main()
}
{
int a[] = {1,2,3,4};
- std::make_move_iterator(a+4);
- std::make_move_iterator(a); // test for LWG issue 2061
+ TEST_IGNORE_NODISCARD std::make_move_iterator(a+4);
+ TEST_IGNORE_NODISCARD std::make_move_iterator(a); // test for LWG issue 2061
}
#if TEST_STD_VER > 14
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
index ba1406ada288..404e02cd7b1d 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
@@ -25,6 +25,7 @@ void
test()
{
std::move_iterator<It> r;
+ (void)r;
}
int main()
@@ -38,6 +39,7 @@ int main()
#if TEST_STD_VER > 14
{
constexpr std::move_iterator<const char *> it;
+ (void)it;
}
#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
index 855dbd7ba316..88fd0def5a89 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
@@ -13,7 +13,7 @@
// constexpr reverse_iterator();
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
@@ -25,6 +25,7 @@ void
test()
{
std::reverse_iterator<It> r;
+ (void)r;
}
int main()
@@ -37,6 +38,7 @@ int main()
#if TEST_STD_VER > 14
{
constexpr std::reverse_iterator<const char *> it;
+ (void)it;
}
#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp
index 9bded7c5a429..4bf816d28f80 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp
@@ -13,7 +13,7 @@
// explicit constexpr reverse_iterator(Iter x);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp
index 2c15743db506..798f9a805a1f 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp
@@ -15,7 +15,7 @@
// requires HasConstructor<Iter, const U&>
// constexpr reverse_iterator(const reverse_iterator<U> &u);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
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 cd155988b11b..4cf82179c7d3 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
@@ -16,7 +16,7 @@
// constexpr reverse_iterator<Iterator>
// make_reverse_iterator(Iterator i);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp
index f5162a7c5dc3..9c53bbbfedc3 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp
@@ -16,7 +16,7 @@
// constexpr bool
// operator!=(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp
index 6a2ab2797cab..7d9edd5b00a5 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp
@@ -13,7 +13,7 @@
// constexpr reverse_iterator operator++(int);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp
index 510242244444..7e75344ab049 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp
@@ -13,7 +13,7 @@
// constexpr reverse_iterator& operator++();
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp
index 0c9682f45c1c..c485b0483743 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp
@@ -14,7 +14,7 @@
// requires RandomAccessIterator<Iter>
// constexpr reverse_iterator operator+(difference_type n) const;
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp
index 9148cc117ca0..5c34417c332d 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp
@@ -14,7 +14,7 @@
// requires RandomAccessIterator<Iter>
// constexpr reverse_iterator operator-(difference_type n) const;
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp
index 4e727564ab72..62ca76495f91 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp
@@ -13,7 +13,7 @@
// constexpr reference operator*() const;
//
-// constexpr in c++17
+// constexpr in C++17
// Be sure to respect LWG 198:
// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp
index 78f6fc4cb26a..59f721838784 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp
@@ -16,7 +16,7 @@
// constexpr reverse_iterator&
// operator=(const reverse_iterator<U>& u);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp
index 70c9e198519c..1d4d09158556 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp
@@ -16,7 +16,7 @@
// constexpr bool
// operator==(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp
index 73e49027b0f5..9ef8c30b4002 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp
@@ -16,7 +16,7 @@
// constexpr auto operator-(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y)
// -> decltype(y.base() - x.base());
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cstddef>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp
index b6adcf40ede4..e0e0059ac917 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp
@@ -16,7 +16,7 @@
// constexpr bool
// operator>(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp
index dc917b29f907..f0ff828b5ddf 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp
@@ -16,7 +16,7 @@
// constexpr bool
// operator>=(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp
index 668f7d839754..4ff57518d6e9 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp
@@ -16,7 +16,7 @@
// constexpr bool
// operator<(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp
index 5201bc43db2c..9fb6310b9739 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp
@@ -16,7 +16,7 @@
// constexpr bool
// operator<=(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
//
-// constexpr in c++17
+// constexpr in C++17
#include <iterator>
#include <cassert>
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 22f2967f3281..937bb8d3a05d 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
@@ -9,7 +9,7 @@
// Usage of is_trivially_constructible is broken with these compilers.
// See https://bugs.llvm.org/show_bug.cgi?id=31016
-// XFAIL: clang-3.7, apple-clang-7 && c++1z
+// XFAIL: clang-3.7, apple-clang-7 && c++17
// <iterator>
@@ -32,6 +32,7 @@ template <typename T, bool isTrivial = std::is_trivially_default_constructible_v
struct test_trivial {
void operator ()() const {
constexpr std::istream_iterator<T> it;
+ (void)it;
}
};
@@ -50,6 +51,7 @@ int main()
assert(it == T());
#if TEST_STD_VER >= 11
constexpr T it2;
+ (void)it2;
#endif
}
diff --git a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/equal.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/equal.pass.cpp
index 0bee916d50c9..d1824bae6f87 100644
--- a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/equal.pass.cpp
+++ b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/equal.pass.cpp
@@ -49,4 +49,7 @@ int main()
assert(i4 == i4);
assert(i4 == i5);
+
+ assert(std::operator==(i1, i2));
+ assert(std::operator!=(i1, i3));
}
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 74aa6f2ab517..c71ee409969a 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
@@ -30,6 +30,7 @@ int main()
assert(it == T());
#if TEST_STD_VER >= 11
constexpr T it2;
+ (void)it2;
#endif
}
{
@@ -38,6 +39,7 @@ int main()
assert(it == T());
#if TEST_STD_VER >= 11
constexpr T it2;
+ (void)it2;
#endif
}
}
diff --git a/test/std/language.support/support.dynamic/align_val_t.pass.cpp b/test/std/language.support/support.dynamic/align_val_t.pass.cpp
index 0a19de919f7f..ffb54ab4d2bf 100644
--- a/test/std/language.support/support.dynamic/align_val_t.pass.cpp
+++ b/test/std/language.support/support.dynamic/align_val_t.pass.cpp
@@ -31,4 +31,4 @@ int main() {
static_assert(b == std::align_val_t(32), "");
static_assert(static_cast<std::size_t>(c) == (std::size_t)-1, "");
}
-} \ No newline at end of file
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
index 36f815a819be..828feabd2127 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
@@ -36,7 +36,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
int unsized_delete_called = 0;
int unsized_delete_nothrow_called = 0;
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
index 69f5ac8c9774..942f5e778b66 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
@@ -38,7 +38,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
int new_handler_called = 0;
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
index 36453283caf6..f55ad5bcc84e 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
@@ -37,7 +37,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
int new_handler_called = 0;
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
index 228d176a27e0..e1ebf86ee176 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
@@ -34,7 +34,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
int A_constructed = 0;
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp
index 15bebcbcbcb8..82dc77efe89e 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp
@@ -24,7 +24,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
int A_constructed = 0;
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 53e26c99f92e..ba3f930c5f14 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
@@ -10,6 +10,7 @@
// test operator new [] nothrow by replacing only operator new
// UNSUPPORTED: sanitizer-new-delete
+// XFAIL: libcpp-no-vcruntime
#include <new>
#include <cstddef>
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 b0820b14f410..3f8122745cc4 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
@@ -10,6 +10,7 @@
// test operator new[] replacement by replacing only operator new
// UNSUPPORTED: sanitizer-new-delete
+// XFAIL: libcpp-no-vcruntime
#include <new>
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp
new file mode 100644
index 000000000000..0dfef2e56fca
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new[](std::size_t);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ ::operator new[](4); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp
new file mode 100644
index 000000000000..ea041aea16ee
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new[](std::size_t, std::align_val_t);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ ::operator new[](4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp
new file mode 100644
index 000000000000..99e4f76b312f
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new[](std::size_t, std::align_val_t, std::nothrow_t &);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ ::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp
new file mode 100644
index 000000000000..8aae54e83fbe
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new[](std::size_t, std::nothrow_t &);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ ::operator new[](4, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
index 3e41b24d292f..862318d0be7b 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
@@ -12,7 +12,7 @@
// Note that sized delete operator definitions below are simply ignored
// when sized deallocation is not supported, e.g., prior to C++14.
-// UNSUPPORTED: c++14, c++1z
+// UNSUPPORTED: c++14, c++17
// UNSUPPORTED: sanitizer-new-delete
#include <new>
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
index fb715805083f..d0b7405453cd 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
@@ -11,12 +11,12 @@
// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11
-// NOTE: Clang does not enable sized-deallocation in c++14 and beyond by
+// NOTE: Clang does not enable sized-deallocation in C++14 and beyond by
// default. It is only enabled when -fsized-deallocation is given.
// (except clang-3.6 which temporarily enabled sized-deallocation)
// UNSUPPORTED: clang, apple-clang
-// NOTE: GCC 4.9.1 does not support sized-deallocation in c++14. However
+// NOTE: GCC 4.9.1 does not support sized-deallocation in C++14. However
// GCC 5.1 does.
// XFAIL: gcc-4.7, gcc-4.8, gcc-4.9
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array_ptr.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array_ptr.fail.cpp
new file mode 100644
index 000000000000..83d5e80e87e4
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array_ptr.fail.cpp
@@ -0,0 +1,26 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new[](std::size_t, void *);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ char buffer[100];
+ ::operator new[](4, buffer); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_ptr.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_ptr.fail.cpp
new file mode 100644
index 000000000000..9d3892cb0a81
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_ptr.fail.cpp
@@ -0,0 +1,26 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new(std::size_t, void *);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ char buffer[100];
+ ::operator new(4, buffer); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
index b0e932c96cb0..d64a633007e7 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
@@ -35,7 +35,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
int unsized_delete_called = 0;
int unsized_delete_nothrow_called = 0;
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
index 22ea5e2fff89..fae5d3676df6 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
@@ -37,7 +37,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
int new_handler_called = 0;
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
index 2c5c0f80b839..f22c48994355 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
@@ -37,7 +37,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
int new_handler_called = 0;
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
index b50f49dc6ca7..565ba9b851bb 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
@@ -35,7 +35,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
bool A_constructed = false;
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
index 66bb613adfd0..bace5c036e0c 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
@@ -24,7 +24,7 @@
#include "test_macros.h"
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
bool A_constructed = false;
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 dbc64bace332..31e1901511fa 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
@@ -10,6 +10,7 @@
// test operator new nothrow by replacing only operator new
// UNSUPPORTED: sanitizer-new-delete
+// XFAIL: libcpp-no-vcruntime
#include <new>
#include <cstddef>
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size.fail.cpp
new file mode 100644
index 000000000000..865cb1ee8375
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size.fail.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new(std::size_t);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ ::operator new(4); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp
new file mode 100644
index 000000000000..c3cabbdb79d5
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new(std::size_t, std::align_val_t);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ ::operator new(4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp
new file mode 100644
index 000000000000..e987a53478b0
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new(std::size_t, std::align_val_t, std::nothrow_t &);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ ::operator new(4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_nothrow.fail.cpp
new file mode 100644
index 000000000000..39392691e9bc
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_nothrow.fail.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new(std::size_t, std::nothrow_t &);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+
+#include "test_macros.h"
+
+int main ()
+{
+ ::operator new(4, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
index 57fb1eb88b6e..945bf779a893 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
@@ -12,7 +12,7 @@
// Note that sized delete operator definitions below are simply ignored
// when sized deallocation is not supported, e.g., prior to C++14.
-// UNSUPPORTED: c++14, c++1z
+// UNSUPPORTED: c++14, c++17
// UNSUPPORTED: sanitizer-new-delete
#include <new>
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
index b85b670fa2d4..7a76725a9751 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
@@ -11,12 +11,12 @@
// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11
-// NOTE: Clang does not enable sized-deallocation in c++14 and beyond by
+// NOTE: Clang does not enable sized-deallocation in C++14 and beyond by
// default. It is only enabled when -fsized-deallocation is given.
// (except clang-3.6 which temporarily enabled sized-deallocation)
// UNSUPPORTED: clang, apple-clang
-// NOTE: GCC 4.9.1 does not support sized-deallocation in c++14. However
+// NOTE: GCC 4.9.1 does not support sized-deallocation in C++14. However
// GCC 5.1 does.
// XFAIL: gcc-4.7, gcc-4.8, gcc-4.9
diff --git a/test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp b/test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp
new file mode 100644
index 000000000000..1c75e561d7c7
--- /dev/null
+++ b/test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp
@@ -0,0 +1,27 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// template <class T> constexpr T* launder(T* p) noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <new>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main ()
+{
+ int *p = nullptr;
+ std::launder(p); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/ptr.launder/launder.pass.cpp b/test/std/language.support/support.dynamic/ptr.launder/launder.pass.cpp
new file mode 100644
index 000000000000..1aa462957c8b
--- /dev/null
+++ b/test/std/language.support/support.dynamic/ptr.launder/launder.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// template <class T> constexpr T* launder(T* p) noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+#include <new>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr int gi = 5;
+constexpr float gf = 8.f;
+
+int main() {
+ static_assert(std::launder(&gi) == &gi, "" );
+ static_assert(std::launder(&gf) == &gf, "" );
+
+ const int *i = &gi;
+ const float *f = &gf;
+ static_assert(std::is_same<decltype(i), decltype(std::launder(i))>::value, "");
+ static_assert(std::is_same<decltype(f), decltype(std::launder(f))>::value, "");
+
+ assert(std::launder(i) == i);
+ assert(std::launder(f) == f);
+}
diff --git a/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp b/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
new file mode 100644
index 000000000000..71f5e4588b82
--- /dev/null
+++ b/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
@@ -0,0 +1,34 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// template <class T> constexpr T* launder(T* p) noexcept;
+// The program is ill-formed if T is a function type or cv void.
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+#include <new>
+#include <cassert>
+
+#include "test_macros.h"
+
+void foo() {}
+
+int main ()
+{
+ void *p = nullptr;
+ (void) std::launder(( void *) nullptr);
+ (void) std::launder((const void *) nullptr);
+ (void) std::launder(( volatile void *) nullptr);
+ (void) std::launder((const volatile void *) nullptr); // expected-error-re@new:* 4 {{static_assert failed{{.*}} "can't launder cv-void"}}
+
+ (void) std::launder(foo); // expected-error-re@new:* 1 {{static_assert failed{{.*}} "can't launder functions"}}
+}
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 88e2253d08c7..43a11bab3fde 100644
--- a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
@@ -46,8 +46,8 @@ public:
class C
{
public:
- virtual ~C() {}
- C * operator&() const { assert(false); return nullptr; } // should not be called
+ virtual ~C() {}
+ C * operator&() const { assert(false); return nullptr; } // should not be called
};
class D : private std::nested_exception {};
diff --git a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp
index f6fd5564f55f..cadae24cb77f 100644
--- a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp
+++ b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp
@@ -57,5 +57,6 @@ int main()
A test1 = {3, 2, 1};
#if TEST_STD_VER > 11
constexpr B test2 = {3, 2, 1};
+ (void)test2;
#endif // TEST_STD_VER > 11
}
diff --git a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp
index 102ed64fef9b..abb07dc99772 100644
--- a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp
+++ b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp
@@ -55,5 +55,6 @@ int main()
A test1 = {3, 2, 1};
#if TEST_STD_VER > 11
constexpr B test2 = {3, 2, 1};
+ (void)test2;
#endif // TEST_STD_VER > 11
}
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 50cfc4674251..6a46c370e750 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
@@ -37,8 +37,8 @@
round_style
*/
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
#define TEST_NUMERIC_LIMITS(type) \
test(std::numeric_limits<type>::is_specialized); \
diff --git a/test/std/language.support/support.types/byteops/and.assign.pass.cpp b/test/std/language.support/support.types/byteops/and.assign.pass.cpp
index ec1c3805a6cb..4aea7909dfaa 100644
--- a/test/std/language.support/support.types/byteops/and.assign.pass.cpp
+++ b/test/std/language.support/support.types/byteops/and.assign.pass.cpp
@@ -16,24 +16,24 @@
constexpr std::byte test(std::byte b1, std::byte b2) {
- std::byte bret = b1;
- return bret &= b2;
- }
+ std::byte bret = b1;
+ return bret &= b2;
+ }
int main () {
- std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b8{static_cast<std::byte>(8)};
- constexpr std::byte b9{static_cast<std::byte>(9)};
+ std::byte b; // not constexpr, just used in noexcept check
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b9{static_cast<std::byte>(9)};
- static_assert(noexcept(b &= b), "" );
+ static_assert(noexcept(b &= b), "" );
- static_assert(std::to_integer<int>(test(b1, b8)) == 0, "");
- static_assert(std::to_integer<int>(test(b1, b9)) == 1, "");
- static_assert(std::to_integer<int>(test(b8, b9)) == 8, "");
+ static_assert(std::to_integer<int>(test(b1, b8)) == 0, "");
+ static_assert(std::to_integer<int>(test(b1, b9)) == 1, "");
+ static_assert(std::to_integer<int>(test(b8, b9)) == 8, "");
- static_assert(std::to_integer<int>(test(b8, b1)) == 0, "");
- static_assert(std::to_integer<int>(test(b9, b1)) == 1, "");
- static_assert(std::to_integer<int>(test(b9, b8)) == 8, "");
+ static_assert(std::to_integer<int>(test(b8, b1)) == 0, "");
+ static_assert(std::to_integer<int>(test(b9, b1)) == 1, "");
+ static_assert(std::to_integer<int>(test(b9, b8)) == 8, "");
}
diff --git a/test/std/language.support/support.types/byteops/and.pass.cpp b/test/std/language.support/support.types/byteops/and.pass.cpp
index 6c5419cfc2a2..32c0bdaee842 100644
--- a/test/std/language.support/support.types/byteops/and.pass.cpp
+++ b/test/std/language.support/support.types/byteops/and.pass.cpp
@@ -15,17 +15,17 @@
// constexpr byte operator&(byte l, byte r) noexcept;
int main () {
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b8{static_cast<std::byte>(8)};
- constexpr std::byte b9{static_cast<std::byte>(9)};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b9{static_cast<std::byte>(9)};
- static_assert(noexcept(b1 & b8), "" );
+ static_assert(noexcept(b1 & b8), "" );
- static_assert(std::to_integer<int>(b1 & b8) == 0, "");
- static_assert(std::to_integer<int>(b1 & b9) == 1, "");
- static_assert(std::to_integer<int>(b8 & b9) == 8, "");
+ static_assert(std::to_integer<int>(b1 & b8) == 0, "");
+ static_assert(std::to_integer<int>(b1 & b9) == 1, "");
+ static_assert(std::to_integer<int>(b8 & b9) == 8, "");
- static_assert(std::to_integer<int>(b8 & b1) == 0, "");
- static_assert(std::to_integer<int>(b9 & b1) == 1, "");
- static_assert(std::to_integer<int>(b9 & b8) == 8, "");
+ static_assert(std::to_integer<int>(b8 & b1) == 0, "");
+ static_assert(std::to_integer<int>(b9 & b1) == 1, "");
+ static_assert(std::to_integer<int>(b9 & b8) == 8, "");
}
diff --git a/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp b/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp
index 8f6822932ac2..66946b4647bd 100644
--- a/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp
+++ b/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp
@@ -22,10 +22,10 @@
constexpr std::byte test(std::byte b) {
- return b <<= 2.0;
- }
+ return b <<= 2.0;
+ }
int main () {
- constexpr std::byte b1 = test(std::byte{1});
+ constexpr std::byte b1 = test(std::byte{1});
}
diff --git a/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp b/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
index abfeebf2b024..6883dccfb993 100644
--- a/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
+++ b/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
@@ -19,18 +19,18 @@
constexpr std::byte test(std::byte b) {
- return b <<= 2;
- }
+ return b <<= 2;
+ }
int main () {
- std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b2{static_cast<std::byte>(2)};
- constexpr std::byte b3{static_cast<std::byte>(3)};
+ std::byte b; // not constexpr, just used in noexcept check
+ constexpr std::byte b2{static_cast<std::byte>(2)};
+ constexpr std::byte b3{static_cast<std::byte>(3)};
- static_assert(noexcept(b <<= 2), "" );
+ static_assert(noexcept(b <<= 2), "" );
- static_assert(std::to_integer<int>(test(b2)) == 8, "" );
- static_assert(std::to_integer<int>(test(b3)) == 12, "" );
+ static_assert(std::to_integer<int>(test(b2)) == 8, "" );
+ static_assert(std::to_integer<int>(test(b3)) == 12, "" );
}
diff --git a/test/std/language.support/support.types/byteops/lshift.fail.cpp b/test/std/language.support/support.types/byteops/lshift.fail.cpp
index 707258c6df30..c213935912c2 100644
--- a/test/std/language.support/support.types/byteops/lshift.fail.cpp
+++ b/test/std/language.support/support.types/byteops/lshift.fail.cpp
@@ -18,6 +18,6 @@
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b2 = b1 << 2.0f;
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b2 = b1 << 2.0f;
}
diff --git a/test/std/language.support/support.types/byteops/lshift.pass.cpp b/test/std/language.support/support.types/byteops/lshift.pass.cpp
index 15ad796cbe9e..a1731b9904cc 100644
--- a/test/std/language.support/support.types/byteops/lshift.pass.cpp
+++ b/test/std/language.support/support.types/byteops/lshift.pass.cpp
@@ -18,13 +18,13 @@
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b3{static_cast<std::byte>(3)};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b3{static_cast<std::byte>(3)};
- static_assert(noexcept(b3 << 2), "" );
+ static_assert(noexcept(b3 << 2), "" );
- static_assert(std::to_integer<int>(b1 << 1) == 2, "");
- static_assert(std::to_integer<int>(b1 << 2) == 4, "");
- static_assert(std::to_integer<int>(b3 << 4) == 48, "");
- static_assert(std::to_integer<int>(b3 << 6) == 192, "");
+ static_assert(std::to_integer<int>(b1 << 1) == 2, "");
+ static_assert(std::to_integer<int>(b1 << 2) == 4, "");
+ static_assert(std::to_integer<int>(b3 << 4) == 48, "");
+ static_assert(std::to_integer<int>(b3 << 6) == 192, "");
}
diff --git a/test/std/language.support/support.types/byteops/not.pass.cpp b/test/std/language.support/support.types/byteops/not.pass.cpp
index 53f1d91faf23..2629001e96a2 100644
--- a/test/std/language.support/support.types/byteops/not.pass.cpp
+++ b/test/std/language.support/support.types/byteops/not.pass.cpp
@@ -15,13 +15,13 @@
// constexpr byte operator~(byte b) noexcept;
int main () {
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b2{static_cast<std::byte>(2)};
- constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b2{static_cast<std::byte>(2)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
- static_assert(noexcept(~b1), "" );
+ static_assert(noexcept(~b1), "" );
- static_assert(std::to_integer<int>(~b1) == 254, "");
- static_assert(std::to_integer<int>(~b2) == 253, "");
- static_assert(std::to_integer<int>(~b8) == 247, "");
+ static_assert(std::to_integer<int>(~b1) == 254, "");
+ static_assert(std::to_integer<int>(~b2) == 253, "");
+ static_assert(std::to_integer<int>(~b8) == 247, "");
}
diff --git a/test/std/language.support/support.types/byteops/or.assign.pass.cpp b/test/std/language.support/support.types/byteops/or.assign.pass.cpp
index bb4a84ec6c76..0cceeaaece15 100644
--- a/test/std/language.support/support.types/byteops/or.assign.pass.cpp
+++ b/test/std/language.support/support.types/byteops/or.assign.pass.cpp
@@ -16,25 +16,25 @@
constexpr std::byte test(std::byte b1, std::byte b2) {
- std::byte bret = b1;
- return bret |= b2;
- }
+ std::byte bret = b1;
+ return bret |= b2;
+ }
int main () {
- std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b2{static_cast<std::byte>(2)};
- constexpr std::byte b8{static_cast<std::byte>(8)};
+ std::byte b; // not constexpr, just used in noexcept check
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b2{static_cast<std::byte>(2)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
- static_assert(noexcept(b |= b), "" );
+ static_assert(noexcept(b |= b), "" );
- static_assert(std::to_integer<int>(test(b1, b2)) == 3, "");
- static_assert(std::to_integer<int>(test(b1, b8)) == 9, "");
- static_assert(std::to_integer<int>(test(b2, b8)) == 10, "");
+ static_assert(std::to_integer<int>(test(b1, b2)) == 3, "");
+ static_assert(std::to_integer<int>(test(b1, b8)) == 9, "");
+ static_assert(std::to_integer<int>(test(b2, b8)) == 10, "");
- static_assert(std::to_integer<int>(test(b2, b1)) == 3, "");
- static_assert(std::to_integer<int>(test(b8, b1)) == 9, "");
- static_assert(std::to_integer<int>(test(b8, b2)) == 10, "");
+ static_assert(std::to_integer<int>(test(b2, b1)) == 3, "");
+ static_assert(std::to_integer<int>(test(b8, b1)) == 9, "");
+ static_assert(std::to_integer<int>(test(b8, b2)) == 10, "");
}
diff --git a/test/std/language.support/support.types/byteops/or.pass.cpp b/test/std/language.support/support.types/byteops/or.pass.cpp
index e2b734982c09..62260f27bd24 100644
--- a/test/std/language.support/support.types/byteops/or.pass.cpp
+++ b/test/std/language.support/support.types/byteops/or.pass.cpp
@@ -15,17 +15,17 @@
// constexpr byte operator|(byte l, byte r) noexcept;
int main () {
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b2{static_cast<std::byte>(2)};
- constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b2{static_cast<std::byte>(2)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
- static_assert(noexcept(b1 | b2), "" );
+ static_assert(noexcept(b1 | b2), "" );
- static_assert(std::to_integer<int>(b1 | b2) == 3, "");
- static_assert(std::to_integer<int>(b1 | b8) == 9, "");
- static_assert(std::to_integer<int>(b2 | b8) == 10, "");
+ static_assert(std::to_integer<int>(b1 | b2) == 3, "");
+ static_assert(std::to_integer<int>(b1 | b8) == 9, "");
+ static_assert(std::to_integer<int>(b2 | b8) == 10, "");
- static_assert(std::to_integer<int>(b2 | b1) == 3, "");
- static_assert(std::to_integer<int>(b8 | b1) == 9, "");
- static_assert(std::to_integer<int>(b8 | b2) == 10, "");
+ static_assert(std::to_integer<int>(b2 | b1) == 3, "");
+ static_assert(std::to_integer<int>(b8 | b1) == 9, "");
+ static_assert(std::to_integer<int>(b8 | b2) == 10, "");
}
diff --git a/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp b/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp
index 44992fa98c33..80f0bd7bcf59 100644
--- a/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp
+++ b/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp
@@ -22,10 +22,10 @@
constexpr std::byte test(std::byte b) {
- return b >>= 2.0;
- }
+ return b >>= 2.0;
+ }
int main () {
- constexpr std::byte b1 = test(std::byte{1});
+ constexpr std::byte b1 = test(std::byte{1});
}
diff --git a/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp b/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp
index 82c611cfdfcb..6763995f6d42 100644
--- a/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp
+++ b/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp
@@ -19,17 +19,17 @@
constexpr std::byte test(std::byte b) {
- return b >>= 2;
- }
+ return b >>= 2;
+ }
int main () {
- std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b16{static_cast<std::byte>(16)};
- constexpr std::byte b192{static_cast<std::byte>(192)};
+ std::byte b; // not constexpr, just used in noexcept check
+ constexpr std::byte b16{static_cast<std::byte>(16)};
+ constexpr std::byte b192{static_cast<std::byte>(192)};
- static_assert(noexcept(b >>= 2), "" );
+ static_assert(noexcept(b >>= 2), "" );
- static_assert(std::to_integer<int>(test(b16)) == 4, "" );
- static_assert(std::to_integer<int>(test(b192)) == 48, "" );
+ static_assert(std::to_integer<int>(test(b16)) == 4, "" );
+ static_assert(std::to_integer<int>(test(b192)) == 48, "" );
}
diff --git a/test/std/language.support/support.types/byteops/rshift.fail.cpp b/test/std/language.support/support.types/byteops/rshift.fail.cpp
index 8e142dd90a5c..b78af2eb260f 100644
--- a/test/std/language.support/support.types/byteops/rshift.fail.cpp
+++ b/test/std/language.support/support.types/byteops/rshift.fail.cpp
@@ -18,6 +18,6 @@
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b2 = b1 >> 2.0f;
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b2 = b1 >> 2.0f;
}
diff --git a/test/std/language.support/support.types/byteops/rshift.pass.cpp b/test/std/language.support/support.types/byteops/rshift.pass.cpp
index 22d399130bbc..eec3ad6839b4 100644
--- a/test/std/language.support/support.types/byteops/rshift.pass.cpp
+++ b/test/std/language.support/support.types/byteops/rshift.pass.cpp
@@ -19,19 +19,19 @@
constexpr std::byte test(std::byte b) {
- return b <<= 2;
- }
+ return b <<= 2;
+ }
int main () {
- constexpr std::byte b100{static_cast<std::byte>(100)};
- constexpr std::byte b115{static_cast<std::byte>(115)};
+ constexpr std::byte b100{static_cast<std::byte>(100)};
+ constexpr std::byte b115{static_cast<std::byte>(115)};
- static_assert(noexcept(b100 << 2), "" );
+ static_assert(noexcept(b100 << 2), "" );
- static_assert(std::to_integer<int>(b100 >> 1) == 50, "");
- static_assert(std::to_integer<int>(b100 >> 2) == 25, "");
- static_assert(std::to_integer<int>(b115 >> 3) == 14, "");
- static_assert(std::to_integer<int>(b115 >> 6) == 1, "");
+ static_assert(std::to_integer<int>(b100 >> 1) == 50, "");
+ static_assert(std::to_integer<int>(b100 >> 2) == 25, "");
+ static_assert(std::to_integer<int>(b115 >> 3) == 14, "");
+ static_assert(std::to_integer<int>(b115 >> 6) == 1, "");
}
diff --git a/test/std/language.support/support.types/byteops/to_integer.fail.cpp b/test/std/language.support/support.types/byteops/to_integer.fail.cpp
index fb4928956f55..86f2ad95bf17 100644
--- a/test/std/language.support/support.types/byteops/to_integer.fail.cpp
+++ b/test/std/language.support/support.types/byteops/to_integer.fail.cpp
@@ -18,6 +18,6 @@
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{static_cast<std::byte>(1)};
- auto f = std::to_integer<float>(b1);
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ auto f = std::to_integer<float>(b1);
}
diff --git a/test/std/language.support/support.types/byteops/to_integer.pass.cpp b/test/std/language.support/support.types/byteops/to_integer.pass.cpp
index 4f34363447f6..065e6d1278ad 100644
--- a/test/std/language.support/support.types/byteops/to_integer.pass.cpp
+++ b/test/std/language.support/support.types/byteops/to_integer.pass.cpp
@@ -18,14 +18,14 @@
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b3{static_cast<std::byte>(3)};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b3{static_cast<std::byte>(3)};
- static_assert(noexcept(std::to_integer<int>(b1)), "" );
- static_assert(std::is_same<int, decltype(std::to_integer<int>(b1))>::value, "" );
- static_assert(std::is_same<long, decltype(std::to_integer<long>(b1))>::value, "" );
- static_assert(std::is_same<unsigned short, decltype(std::to_integer<unsigned short>(b1))>::value, "" );
+ static_assert(noexcept(std::to_integer<int>(b1)), "" );
+ static_assert(std::is_same<int, decltype(std::to_integer<int>(b1))>::value, "" );
+ static_assert(std::is_same<long, decltype(std::to_integer<long>(b1))>::value, "" );
+ static_assert(std::is_same<unsigned short, decltype(std::to_integer<unsigned short>(b1))>::value, "" );
- static_assert(std::to_integer<int>(b1) == 1, "");
- static_assert(std::to_integer<int>(b3) == 3, "");
+ static_assert(std::to_integer<int>(b1) == 1, "");
+ static_assert(std::to_integer<int>(b3) == 3, "");
}
diff --git a/test/std/language.support/support.types/byteops/xor.assign.pass.cpp b/test/std/language.support/support.types/byteops/xor.assign.pass.cpp
index 6a526da3d714..07727ec9eb1c 100644
--- a/test/std/language.support/support.types/byteops/xor.assign.pass.cpp
+++ b/test/std/language.support/support.types/byteops/xor.assign.pass.cpp
@@ -16,24 +16,24 @@
constexpr std::byte test(std::byte b1, std::byte b2) {
- std::byte bret = b1;
- return bret ^= b2;
- }
+ std::byte bret = b1;
+ return bret ^= b2;
+ }
int main () {
- std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b8{static_cast<std::byte>(8)};
- constexpr std::byte b9{static_cast<std::byte>(9)};
+ std::byte b; // not constexpr, just used in noexcept check
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b9{static_cast<std::byte>(9)};
- static_assert(noexcept(b ^= b), "" );
+ static_assert(noexcept(b ^= b), "" );
- static_assert(std::to_integer<int>(test(b1, b8)) == 9, "");
- static_assert(std::to_integer<int>(test(b1, b9)) == 8, "");
- static_assert(std::to_integer<int>(test(b8, b9)) == 1, "");
+ static_assert(std::to_integer<int>(test(b1, b8)) == 9, "");
+ static_assert(std::to_integer<int>(test(b1, b9)) == 8, "");
+ static_assert(std::to_integer<int>(test(b8, b9)) == 1, "");
- static_assert(std::to_integer<int>(test(b8, b1)) == 9, "");
- static_assert(std::to_integer<int>(test(b9, b1)) == 8, "");
- static_assert(std::to_integer<int>(test(b9, b8)) == 1, "");
+ static_assert(std::to_integer<int>(test(b8, b1)) == 9, "");
+ static_assert(std::to_integer<int>(test(b9, b1)) == 8, "");
+ static_assert(std::to_integer<int>(test(b9, b8)) == 1, "");
}
diff --git a/test/std/language.support/support.types/byteops/xor.pass.cpp b/test/std/language.support/support.types/byteops/xor.pass.cpp
index e8c3b9875785..d7e18c91b044 100644
--- a/test/std/language.support/support.types/byteops/xor.pass.cpp
+++ b/test/std/language.support/support.types/byteops/xor.pass.cpp
@@ -15,17 +15,17 @@
// constexpr byte operator^(byte l, byte r) noexcept;
int main () {
- constexpr std::byte b1{static_cast<std::byte>(1)};
- constexpr std::byte b8{static_cast<std::byte>(8)};
- constexpr std::byte b9{static_cast<std::byte>(9)};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b9{static_cast<std::byte>(9)};
- static_assert(noexcept(b1 ^ b8), "" );
+ static_assert(noexcept(b1 ^ b8), "" );
- static_assert(std::to_integer<int>(b1 ^ b8) == 9, "");
- static_assert(std::to_integer<int>(b1 ^ b9) == 8, "");
- static_assert(std::to_integer<int>(b8 ^ b9) == 1, "");
+ static_assert(std::to_integer<int>(b1 ^ b8) == 9, "");
+ static_assert(std::to_integer<int>(b1 ^ b9) == 8, "");
+ static_assert(std::to_integer<int>(b8 ^ b9) == 1, "");
- static_assert(std::to_integer<int>(b8 ^ b1) == 9, "");
- static_assert(std::to_integer<int>(b9 ^ b1) == 8, "");
- static_assert(std::to_integer<int>(b9 ^ b8) == 1, "");
+ static_assert(std::to_integer<int>(b8 ^ b1) == 9, "");
+ static_assert(std::to_integer<int>(b9 ^ b1) == 8, "");
+ static_assert(std::to_integer<int>(b9 ^ b8) == 1, "");
}
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 2d0ed7410590..ffa0c90d4d86 100644
--- a/test/std/language.support/support.types/nullptr_t.pass.cpp
+++ b/test/std/language.support/support.types/nullptr_t.pass.cpp
@@ -91,7 +91,7 @@ int main()
{
#ifdef _LIBCPP_HAS_NO_NULLPTR
static_assert(!has_less<std::nullptr_t>::value, "");
- // FIXME: our c++03 nullptr emulation still allows for comparisons
+ // FIXME: our C++03 nullptr emulation still allows for comparisons
// with other pointer types by way of the conversion operator.
//static_assert(!has_less<void*>::value, "");
#else
diff --git a/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp b/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp
index 06c171f56da6..c260e34e3aca 100644
--- a/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp
@@ -36,8 +36,8 @@
#include <locale>
#include <cassert>
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
int main()
{
diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
index d7ce1033a8da..5656f73ee9d2 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
@@ -117,7 +117,7 @@ int main()
assert(ex == -123456789);
}
{ // zero, showbase
- std::string v = "0,00 \u20ac"; // €
+ std::string v = "0,00 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const char*> I;
long double ex;
@@ -129,7 +129,7 @@ int main()
assert(ex == 0);
}
{ // zero, showbase
- std::string v = "0,00 \u20ac"; // €
+ std::string v = "0,00 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const char*> I;
long double ex;
@@ -141,7 +141,7 @@ int main()
assert(ex == 0);
}
{ // negative one, showbase
- std::string v = "-0,01 \u20ac";
+ std::string v = "-0,01 \u20ac"; // EURO SIGN
typedef input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -152,7 +152,7 @@ int main()
assert(ex == -1);
}
{ // negative one, showbase
- std::string v = "-0,01 \u20ac";
+ std::string v = "-0,01 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const char*> I;
long double ex;
@@ -164,7 +164,7 @@ int main()
assert(ex == -1);
}
{ // positive, showbase
- std::string v = "1 234 567,89 \u20ac";
+ std::string v = "1 234 567,89 \u20ac"; // EURO SIGN
typedef input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -175,7 +175,7 @@ int main()
assert(ex == 123456789);
}
{ // positive, showbase
- std::string v = "1 234 567,89 \u20ac";
+ std::string v = "1 234 567,89 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const char*> I;
long double ex;
@@ -188,7 +188,7 @@ int main()
noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-1 234 567,89 \u20ac";
+ std::string v = "-1 234 567,89 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const char*> I;
long double ex;
@@ -450,7 +450,7 @@ int main()
assert(ex == -123456789);
}
{ // zero, showbase
- std::wstring v = L"0,00 \u20ac";
+ std::wstring v = L"0,00 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const wchar_t*> I;
long double ex;
@@ -462,7 +462,7 @@ int main()
assert(ex == 0);
}
{ // zero, showbase
- std::wstring v = L"0,00 \u20ac";
+ std::wstring v = L"0,00 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const wchar_t*> I;
long double ex;
@@ -474,7 +474,7 @@ int main()
assert(ex == 0);
}
{ // negative one, showbase
- std::wstring v = L"-0,01 \u20ac";
+ std::wstring v = L"-0,01 \u20ac"; // EURO SIGN
typedef input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -485,7 +485,7 @@ int main()
assert(ex == -1);
}
{ // negative one, showbase
- std::wstring v = L"-0,01 \u20ac";
+ std::wstring v = L"-0,01 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const wchar_t*> I;
long double ex;
@@ -497,7 +497,7 @@ int main()
assert(ex == -1);
}
{ // positive, showbase
- std::wstring v = L"1 234 567,89 \u20ac";
+ std::wstring v = L"1 234 567,89 \u20ac"; // EURO SIGN
typedef input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -508,7 +508,7 @@ int main()
assert(ex == 123456789);
}
{ // positive, showbase
- std::wstring v = L"1 234 567,89 \u20ac";
+ std::wstring v = L"1 234 567,89 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const wchar_t*> I;
long double ex;
@@ -521,7 +521,7 @@ int main()
noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-1 234 567,89 \u20ac";
+ std::wstring v = L"-1 234 567,89 \u20ac"; // EURO SIGN
showbase(ios);
typedef input_iterator<const wchar_t*> I;
long double ex;
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
index 8490b708b6cf..3a9adc4bbc1e 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
@@ -117,7 +117,13 @@ int main()
// GLIBC <= 2.23 uses currency_symbol="<U0440><U0443><U0431>"
// GLIBC >= 2.24 uses currency_symbol="<U20BD>"
// See also: http://www.fileformat.info/info/unicode/char/20bd/index.htm
-#if defined(TEST_GLIBC_PREREQ) && TEST_GLIBC_PREREQ(2, 24)
+#if defined(TEST_GLIBC_PREREQ)
+ #if TEST_GLIBC_PREREQ(2, 24)
+ #define TEST_GLIBC_2_24_CURRENCY_SYMBOL
+ #endif
+#endif
+
+#if defined(TEST_GLIBC_2_24_CURRENCY_SYMBOL)
assert(f.curr_symbol() == " \u20BD");
#else
assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1");
@@ -129,7 +135,7 @@ int main()
}
{
Fwf f(LOCALE_ru_RU_UTF_8, 1);
-#if defined(TEST_GLIBC_PREREQ) && TEST_GLIBC_PREREQ(2, 24)
+#if defined(TEST_GLIBC_2_24_CURRENCY_SYMBOL)
assert(f.curr_symbol() == L" \u20BD");
#else
assert(f.curr_symbol() == L" \x440\x443\x431");
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp
index 323d856a3923..8998bf004652 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp
@@ -27,8 +27,8 @@
#include <locale>
#include <type_traits>
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
int main()
{
diff --git a/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp b/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp
index 8fc311a5bd80..dbab8212a736 100644
--- a/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp
+++ b/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp
@@ -20,8 +20,8 @@
#include <type_traits>
#include <cassert>
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
int main()
diff --git a/test/std/numerics/c.math/ctgmath.pass.cpp b/test/std/numerics/c.math/ctgmath.pass.cpp
index 9e10690e3cac..24908ff03dc7 100644
--- a/test/std/numerics/c.math/ctgmath.pass.cpp
+++ b/test/std/numerics/c.math/ctgmath.pass.cpp
@@ -14,6 +14,7 @@
int main()
{
std::complex<double> cd;
+ (void)cd;
double x = std::sin(0);
((void)x); // Prevent unused warning
}
diff --git a/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp b/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp
index 4b89414686ba..3e215c8bf3c9 100644
--- a/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp
+++ b/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp
@@ -14,4 +14,5 @@
int main()
{
std::complex<double> d;
+ (void)d;
}
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 1b0cca0d5f69..837734fcde9f 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
diff --git a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp
index f1aece20e6cf..deb056d67dec 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
diff --git a/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp
index 2b213094df25..8d7462141d79 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
diff --git a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp
index 011f9d6b4f2e..3da56c32f198 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
diff --git a/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp
index 6dc6034ca3c6..37e00c3925a6 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
diff --git a/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
index 03ed727cab8c..be9d505b9e27 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
index a2c55390f2a8..dad5bd190aa8 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
index 7ae59980b09d..0ab8ac275630 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
index 491f3fac5738..e310f26dc9b4 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
index 8fa419c2179d..1028836f98da 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- typedef std::complex<double> C;
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
index af5b1f0d3717..5c422300e343 100644
--- a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
+++ b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
@@ -13,7 +13,7 @@
// template<class InputIterator, class OutputIterator, class T>
// OutputIterator inclusive_scan(InputIterator first, InputIterator last,
// OutputIterator result, T init);
-//
+//
#include <numeric>
#include <vector>
@@ -26,7 +26,7 @@ void
test(Iter1 first, Iter1 last, Iter2 rFirst, Iter2 rLast)
{
std::vector<typename std::iterator_traits<Iter1>::value_type> v;
-
+
// Not in place
std::inclusive_scan(first, last, std::back_inserter(v));
assert(std::equal(v.begin(), v.end(), rFirst, rLast));
@@ -35,7 +35,7 @@ test(Iter1 first, Iter1 last, Iter2 rFirst, Iter2 rLast)
v.clear();
v.assign(first, last);
std::inclusive_scan(v.begin(), v.end(), v.begin());
- assert(std::equal(v.begin(), v.end(), rFirst, rLast));
+ assert(std::equal(v.begin(), v.end(), rFirst, rLast));
}
diff --git a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
index 95db56bf67d2..2c6eacc1682f 100644
--- a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
+++ b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
@@ -13,7 +13,7 @@
// template<class InputIterator, class OutputIterator, class T, class BinaryOperation>
// OutputIterator
// inclusive_scan(InputIterator first, InputIterator last,
-// OutputIterator result,
+// OutputIterator result,
// BinaryOperation binary_op); // C++17
#include <numeric>
@@ -37,7 +37,7 @@ test(Iter1 first, Iter1 last, Op op, Iter2 rFirst, Iter2 rLast)
v.clear();
v.assign(first, last);
std::inclusive_scan(v.begin(), v.end(), v.begin(), op);
- assert(std::equal(v.begin(), v.end(), rFirst, rLast));
+ assert(std::equal(v.begin(), v.end(), rFirst, rLast));
}
@@ -99,7 +99,7 @@ int main()
{
basic_tests();
-
+
// All the iterator categories
// test<input_iterator <const int*> >();
// test<forward_iterator <const int*> >();
@@ -109,4 +109,3 @@ int main()
// test< int*>();
}
- \ No newline at end of file
diff --git a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
index 04913f904885..653578055c69 100644
--- a/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
+++ b/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
@@ -13,7 +13,7 @@
// template<class InputIterator, class OutputIterator, class T, class BinaryOperation>
// OutputIterator
// inclusive_scan(InputIterator first, InputIterator last,
-// OutputIterator result,
+// OutputIterator result,
// BinaryOperation binary_op, T init); // C++17
#include <numeric>
@@ -36,7 +36,7 @@ test(Iter1 first, Iter1 last, Op op, T init, Iter2 rFirst, Iter2 rLast)
v.clear();
v.assign(first, last);
std::inclusive_scan(v.begin(), v.end(), v.begin(), op, init);
- assert(std::equal(v.begin(), v.end(), rFirst, rLast));
+ assert(std::equal(v.begin(), v.end(), rFirst, rLast));
}
@@ -115,7 +115,7 @@ int main()
{
basic_tests();
-
+
// All the iterator categories
test<input_iterator <const int*> >();
test<forward_iterator <const int*> >();
@@ -125,4 +125,3 @@ int main()
test< int*>();
}
- \ No newline at end of file
diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
index 6bd8a4f1e610..d96ca3225aa3 100644
--- a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
+++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
@@ -19,6 +19,7 @@
#include <cstdint>
#include <cstdlib>
#include <type_traits>
+#include "test_macros.h"
constexpr struct {
int x;
@@ -137,7 +138,7 @@ int main()
// LWG#2837
{
auto res1 = std::lcm(static_cast<std::int64_t>(1234), INT32_MIN);
- (void)std::lcm(INT_MIN, 2UL); // this used to trigger UBSAN
+ TEST_IGNORE_NODISCARD std::lcm(INT_MIN, 2UL); // this used to trigger UBSAN
static_assert(std::is_same_v<decltype(res1), std::int64_t>, "");
assert(res1 == 1324997410816LL);
}
diff --git a/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp b/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp
index e3e2ffe7be0c..cff1b8c0ab4e 100644
--- a/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp
+++ b/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp
@@ -65,10 +65,10 @@ int main()
test<random_access_iterator<const int*> >();
test<const int*>();
-// Make sure the math is done using the correct type
+// Make sure the math is done using the correct type
{
auto v = {1, 2, 3, 4, 5, 6, 7, 8};
unsigned res = std::reduce(v.begin(), v.end(), 1U, std::multiplies<>());
- assert(res == 40320); // 8! will not fit into a char
+ assert(res == 40320); // 8! will not fit into a char
}
}
diff --git a/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp b/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
index d96d4d6ec439..4964e8e884bd 100644
--- a/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
+++ b/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
@@ -25,20 +25,20 @@
#include "test_iterators.h"
-template <class _Tp = void>
-struct identity : std::unary_function<_Tp, _Tp>
+template <class T = void>
+struct identity : std::unary_function<T, T>
{
- constexpr const _Tp& operator()(const _Tp& __x) const { return __x;}
+ constexpr const T& operator()(const T& x) const { return x;}
};
template <>
struct identity<void>
{
- template <class _Tp>
- constexpr auto operator()(_Tp&& __x) const
- _NOEXCEPT_(noexcept(_VSTD::forward<_Tp>(__x)))
- -> decltype (_VSTD::forward<_Tp>(__x))
- { return _VSTD::forward<_Tp>(__x); }
+ template <class T>
+ constexpr auto operator()(T&& x) const
+ _NOEXCEPT_(noexcept(_VSTD::forward<T>(x)))
+ -> decltype (_VSTD::forward<T>(x))
+ { return _VSTD::forward<T>(x); }
};
template <class Iter1, class BOp, class UOp, class T, class Iter2>
diff --git a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
index b96218d7da4f..d15defc2cabc 100644
--- a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
+++ b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
@@ -1,3 +1,4 @@
+
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -10,7 +11,7 @@
// <numeric>
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// template<class InputIterator, class OutputIterator, class T,
+// template<class InputIterator, class OutputIterator, class T,
// class BinaryOperation, class UnaryOperation>
// OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
// OutputIterator result,
@@ -25,20 +26,20 @@
#include "test_iterators.h"
-template <class _Tp = void>
-struct identity : std::unary_function<_Tp, _Tp>
+template <class T = void>
+struct identity : std::unary_function<T, T>
{
- constexpr const _Tp& operator()(const _Tp& __x) const { return __x;}
+ constexpr const T& operator()(const T& x) const { return x;}
};
template <>
struct identity<void>
{
- template <class _Tp>
- constexpr auto operator()(_Tp&& __x) const
- _NOEXCEPT_(noexcept(_VSTD::forward<_Tp>(__x)))
- -> decltype (_VSTD::forward<_Tp>(__x))
- { return _VSTD::forward<_Tp>(__x); }
+ template <class T>
+ constexpr auto operator()(T&& x) const
+ _NOEXCEPT_(noexcept(_VSTD::forward<T>(x)))
+ -> decltype (_VSTD::forward<T>(x))
+ { return _VSTD::forward<T>(x); }
};
template <class Iter1, class BOp, class UOp, class Iter2>
@@ -64,7 +65,7 @@ test()
{
int ia[] = { 1, 3, 5, 7, 9};
const int pResI0[] = { 1, 4, 9, 16, 25}; // with identity
- const int mResI0[] = { 1, 3, 15, 105, 945};
+ const int mResI0[] = { 1, 3, 15, 105, 945};
const int pResN0[] = { -1, -4, -9, -16, -25}; // with negate
const int mResN0[] = { -1, 3, -15, 105, -945};
const unsigned sa = sizeof(ia) / sizeof(ia[0]);
@@ -90,8 +91,8 @@ void basic_tests()
std::vector<int> v(10);
std::fill(v.begin(), v.end(), 3);
std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), identity<>());
- std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
+ std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
+ std::cout << std::endl;
for (size_t i = 0; i < v.size(); ++i)
assert(v[i] == (int)(i+1) * 3);
}
@@ -122,7 +123,7 @@ void basic_tests()
int main()
{
basic_tests();
-
+
// All the iterator categories
test<input_iterator <const int*> >();
test<forward_iterator <const int*> >();
diff --git a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
index df68946a5e65..b38b9a5afedf 100644
--- a/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
+++ b/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
@@ -10,7 +10,7 @@
// <numeric>
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// template<class InputIterator, class OutputIterator, class T,
+// template<class InputIterator, class OutputIterator, class T,
// class BinaryOperation, class UnaryOperation>
// OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
// OutputIterator result,
@@ -25,20 +25,20 @@
#include "test_iterators.h"
-template <class _Tp = void>
-struct identity : std::unary_function<_Tp, _Tp>
+template <class T = void>
+struct identity : std::unary_function<T, T>
{
- constexpr const _Tp& operator()(const _Tp& __x) const { return __x;}
+ constexpr const T& operator()(const T& x) const { return x;}
};
template <>
struct identity<void>
{
- template <class _Tp>
- constexpr auto operator()(_Tp&& __x) const
- _NOEXCEPT_(noexcept(_VSTD::forward<_Tp>(__x)))
- -> decltype (_VSTD::forward<_Tp>(__x))
- { return _VSTD::forward<_Tp>(__x); }
+ template <class T>
+ constexpr auto operator()(T&& x) const
+ _NOEXCEPT_(noexcept(_VSTD::forward<T>(x)))
+ -> decltype (_VSTD::forward<T>(x))
+ { return _VSTD::forward<T>(x); }
};
template <class Iter1, class BOp, class UOp, class T, class Iter2>
@@ -64,11 +64,11 @@ test()
{
int ia[] = { 1, 3, 5, 7, 9};
const int pResI0[] = { 1, 4, 9, 16, 25}; // with identity
- const int mResI0[] = { 0, 0, 0, 0, 0};
+ const int mResI0[] = { 0, 0, 0, 0, 0};
const int pResN0[] = { -1, -4, -9, -16, -25}; // with negate
const int mResN0[] = { 0, 0, 0, 0, 0};
const int pResI2[] = { 3, 6, 11, 18, 27}; // with identity
- const int mResI2[] = { 2, 6, 30, 210, 1890};
+ const int mResI2[] = { 2, 6, 30, 210, 1890};
const int pResN2[] = { 1, -2, -7, -14, -23}; // with negate
const int mResN2[] = { -2, 6, -30, 210, -1890};
const unsigned sa = sizeof(ia) / sizeof(ia[0]);
@@ -149,7 +149,7 @@ void basic_tests()
int main()
{
basic_tests();
-
+
// All the iterator categories
test<input_iterator <const int*> >();
test<forward_iterator <const int*> >();
diff --git a/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp b/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp
index b05792ddeb55..418c57f7cfca 100644
--- a/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp
+++ b/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp
@@ -21,37 +21,37 @@
#include "test_iterators.h"
-template <class _Tp = void>
-struct identity : std::unary_function<_Tp, _Tp>
+template <class T = void>
+struct identity : std::unary_function<T, T>
{
- constexpr const _Tp& operator()(const _Tp& __x) const { return __x;}
+ constexpr const T& operator()(const T& x) const { return x;}
};
template <>
struct identity<void>
{
- template <class _Tp>
- constexpr auto operator()(_Tp&& __x) const
- _NOEXCEPT_(noexcept(_VSTD::forward<_Tp>(__x)))
- -> decltype (_VSTD::forward<_Tp>(__x))
- { return _VSTD::forward<_Tp>(__x); }
+ template <class T>
+ constexpr auto operator()(T&& x) const
+ _NOEXCEPT_(noexcept(_VSTD::forward<T>(x)))
+ -> decltype (_VSTD::forward<T>(x))
+ { return _VSTD::forward<T>(x); }
};
-template <class _Tp = void>
+template <class T = void>
struct twice
{
- constexpr const _Tp operator()(const _Tp& __x) const noexcept { return 2 * __x; }
+ constexpr const T operator()(const T& x) const noexcept { return 2 * x; }
};
template <>
struct twice<void>
{
- template <class _Tp>
- constexpr auto operator()(const _Tp& __x) const
- _NOEXCEPT_(noexcept(2 * __x))
- -> decltype (2 * __x)
- { return 2 * __x; }
+ template <class T>
+ constexpr auto operator()(const T& x) const
+ _NOEXCEPT_(noexcept(2 * x))
+ -> decltype (2 * x)
+ { return 2 * x; }
};
template <class Iter1, class T, class BOp, class UOp>
@@ -115,10 +115,10 @@ int main()
test<const int*>();
test< int*>();
-// Make sure the math is done using the correct type
+// Make sure the math is done using the correct type
{
auto v = {1, 2, 3, 4, 5, 6};
unsigned res = std::transform_reduce(v.begin(), v.end(), 1U, std::multiplies<>(), twice<>());
- assert(res == 46080); // 6! * 64 will not fit into a char
+ assert(res == 46080); // 6! * 64 will not fit into a char
}
}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp
index 18c8947af6ee..5238915ee89f 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp
@@ -22,7 +22,7 @@ test1()
{
typedef std::ranlux24 E;
E e1(2);
- e1();
+ (void)e1();
E e2(5);
e2 = e1;
assert(e1 == e2);
@@ -38,7 +38,7 @@ test2()
{
typedef std::ranlux48 E;
E e1(3);
- e1();
+ (void)e1();
E e2(5);
e2 = e1;
assert(e1 == e2);
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp
index d6c64fa37dcc..80417e5d6d73 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp
@@ -22,7 +22,7 @@ test1()
{
typedef std::ranlux24 E;
E e1;
- e1();
+ (void)e1();
E e2 = e1;
assert(e1 == e2);
assert(e1() == e2());
@@ -37,7 +37,7 @@ test2()
{
typedef std::ranlux48 E;
E e1;
- e1();
+ (void)e1();
E e2 = e1;
assert(e1 == e2);
assert(e1() == e2());
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp
index 2dada0d6345f..d10b7c5e8a31 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp
@@ -25,9 +25,9 @@ test1()
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
@@ -39,9 +39,9 @@ test2()
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp
index 8cc523e2fc07..5666fdce28d6 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp
@@ -28,8 +28,8 @@
#include "test_macros.h"
-template <class _Tp>
-void where(const _Tp &) {}
+template <class T>
+void where(const T &) {}
void
test1()
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp
index e4cd4f7396be..4484b3db4e4e 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp
@@ -22,7 +22,7 @@ test1()
{
typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;
E e1(2);
- e1();
+ (void)e1();
E e2(5);
e2 = e1;
assert(e1 == e2);
@@ -38,7 +38,7 @@ test2()
{
typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
E e1(3);
- e1();
+ (void)e1();
E e2(5);
e2 = e1;
assert(e1 == e2);
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp
index e3e497ec8c6e..6a01af4bf39c 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp
@@ -22,7 +22,7 @@ test1()
{
typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;
E e1;
- e1();
+ (void)e1();
E e2 = e1;
assert(e1 == e2);
assert(e1() == e2());
@@ -37,7 +37,7 @@ test2()
{
typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
E e1;
- e1();
+ (void)e1();
E e2 = e1;
assert(e1 == e2);
assert(e1() == e2());
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp
index 2a356a1c80db..a1b4dd7d7aee 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp
@@ -25,9 +25,9 @@ test1()
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
@@ -39,9 +39,9 @@ test2()
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp
index dae8c7c919af..652e6487a4e0 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp
@@ -22,7 +22,7 @@ test1()
{
typedef std::knuth_b E;
E e1(2);
- e1();
+ (void)e1();
E e2(5);
e2 = e1;
assert(e1 == e2);
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp
index c9e9893dee4b..de26e2dc7861 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp
@@ -22,7 +22,7 @@ test1()
{
typedef std::knuth_b E;
E e1;
- e1();
+ (void)e1();
E e2 = e1;
assert(e1 == e2);
assert(e1() == e2());
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp
index a20c494f334c..e71aa1d893bd 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp
@@ -24,8 +24,10 @@ int main()
typedef std::knuth_b Adaptor;
Engine e;
Adaptor a(e);
- for (unsigned k = 0; k <= Adaptor::table_size; ++k)
- e();
+ for (unsigned k = 0; k <= Adaptor::table_size; ++k) {
+ (void)e();
+ }
+
assert(a.base() == e);
}
}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp
index 9811787821d9..4a347b5d5b8e 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp
@@ -25,8 +25,10 @@ int main()
Engine e;
Engine e0 = e;
Adaptor a(std::move(e0));
- for (unsigned k = 0; k <= Adaptor::table_size; ++k)
- e();
+ for (unsigned k = 0; k <= Adaptor::table_size; ++k) {
+ (void)e();
+ }
+
assert(a.base() == e);
}
}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp
index 6e04e26c7e55..b442a76adb63 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp
@@ -25,9 +25,9 @@ test1()
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp
index c592b6df2d6e..ac3f1d7112d1 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp
@@ -27,8 +27,8 @@
#include "test_macros.h"
-template <class _Tp>
-void where(const _Tp &) {}
+template <class T>
+void where(const T &) {}
void
test1()
diff --git a/test/std/numerics/rand/rand.device/eval.pass.cpp b/test/std/numerics/rand/rand.device/eval.pass.cpp
index b34e40c75273..56690316c129 100644
--- a/test/std/numerics/rand/rand.device/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.device/eval.pass.cpp
@@ -38,7 +38,7 @@ int main()
try
{
std::random_device r("/dev/null");
- r();
+ (void)r();
LIBCPP_ASSERT(false);
}
catch (const std::system_error&)
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 cfaddb73f0b8..82e8ffc77a40 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
@@ -33,7 +33,6 @@ void
test1()
{
typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(-1./8192, 0.015625);
@@ -78,7 +77,6 @@ void
test2()
{
typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(-1./32, 0.25);
@@ -123,7 +121,6 @@ void
test3()
{
typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(-1./8, 0.5);
@@ -168,7 +165,6 @@ void
test4()
{
typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d;
@@ -213,7 +209,6 @@ void
test5()
{
typedef std::lognormal_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(-0.78125, 1.25);
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 b207eece67d0..6ae2301807d6 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
@@ -33,7 +33,6 @@ int main()
{
{
typedef std::student_t_distribution<> D;
- typedef D::param_type P;
typedef std::minstd_rand G;
G g;
D d(5.5);
@@ -69,7 +68,6 @@ int main()
}
{
typedef std::student_t_distribution<> D;
- typedef D::param_type P;
typedef std::minstd_rand G;
G g;
D d(10);
@@ -105,7 +103,6 @@ int main()
}
{
typedef std::student_t_distribution<> D;
- typedef D::param_type P;
typedef std::minstd_rand G;
G g;
D d(100);
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 3999cbeccbb7..ecc663c6c90c 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
@@ -33,7 +33,6 @@ void
test1()
{
typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(0.5, 2);
@@ -75,7 +74,6 @@ void
test2()
{
typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(1, 2);
@@ -117,7 +115,6 @@ void
test3()
{
typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(1.5, 3);
@@ -159,7 +156,6 @@ void
test4()
{
typedef std::extreme_value_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(3, 4);
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 d0ac16298e42..15d3a289b570 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
@@ -33,7 +33,6 @@ int main()
{
{
typedef std::gamma_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(0.5, 2);
@@ -73,7 +72,6 @@ int main()
}
{
typedef std::gamma_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(1, .5);
@@ -113,7 +111,6 @@ int main()
}
{
typedef std::gamma_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d(2, 3);
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 7da4b9bfb1e5..d97898e5f446 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
@@ -44,7 +44,6 @@ 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};
@@ -97,7 +96,6 @@ 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};
@@ -150,7 +148,6 @@ 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};
@@ -203,7 +200,6 @@ 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};
@@ -257,7 +253,6 @@ void
test5()
{
typedef std::piecewise_linear_distribution<> D;
- typedef D::param_type P;
typedef std::mt19937_64 G;
G g;
double b[] = {10, 14};
@@ -312,7 +307,6 @@ 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};
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp
index 9e3372a8c2b4..0a36fcb71a72 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp
@@ -47,13 +47,13 @@ other()
assert(e1 == e2);
e1.discard(1);
assert(e1 != e2);
- e2();
+ (void)e2();
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
index 2080ac5f41de..72d5854b7655 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
@@ -27,8 +27,8 @@
#include "test_macros.h"
-template <class _Tp>
-void where(const _Tp &) {}
+template <class T>
+void where(const T &) {}
template <class T, T a, T c, T m>
void
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp
index fda5b88de26e..63d7168f5bf4 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp
@@ -24,7 +24,7 @@ test1()
{
typedef std::mt19937 E;
E e1(2);
- e1();
+ (void)e1();
E e2(5);
e2 = e1;
assert(e1 == e2);
@@ -40,7 +40,7 @@ test2()
{
typedef std::mt19937_64 E;
E e1(3);
- e1();
+ (void)e1();
E e2(5);
e2 = e1;
assert(e1 == e2);
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp
index 57c015ccce1d..a006b33243c9 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp
@@ -24,7 +24,7 @@ test1()
{
typedef std::mt19937 E;
E e1;
- e1();
+ (void)e1();
E e2 = e1;
assert(e1 == e2);
assert(e1() == e2());
@@ -39,7 +39,7 @@ test2()
{
typedef std::mt19937_64 E;
E e1;
- e1();
+ (void)e1();
E e2(e1);
assert(e1 == e2);
assert(e1() == e2());
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp
index d20d661d5891..480260d8bf45 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp
@@ -28,9 +28,9 @@ test1()
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
@@ -42,9 +42,9 @@ test2()
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
index f7834afd4454..08d99b3d8acb 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
@@ -42,8 +42,8 @@
#include "test_macros.h"
-template <class _Tp>
-void where(const _Tp &) {}
+template <class T>
+void where(const T &) {}
void
test1()
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp
index 305d43ad4a22..60fec44629ec 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp
@@ -22,7 +22,7 @@ test1()
{
typedef std::ranlux24_base E;
E e1(2);
- e1();
+ (void)e1();
E e2(5);
e2 = e1;
assert(e1 == e2);
@@ -38,7 +38,7 @@ test2()
{
typedef std::ranlux48_base E;
E e1(3);
- e1();
+ (void)e1();
E e2(5);
e2 = e1;
assert(e1 == e2);
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp
index 27f88165bcf5..5944716b6ac4 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp
@@ -22,7 +22,7 @@ test1()
{
typedef std::ranlux24_base E;
E e1;
- e1();
+ (void)e1();
E e2 = e1;
assert(e1 == e2);
assert(e1() == e2());
@@ -37,7 +37,7 @@ test2()
{
typedef std::ranlux48_base E;
E e1;
- e1();
+ (void)e1();
E e2(e1);
assert(e1 == e2);
assert(e1() == e2());
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp
index 4ba93819ee43..ad33fc15118c 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp
@@ -25,9 +25,9 @@ test1()
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
@@ -39,9 +39,9 @@ test2()
assert(e1 == e2);
e1.discard(3);
assert(e1 != e2);
- e2();
- e2();
- e2();
+ (void)e2();
+ (void)e2();
+ (void)e2();
assert(e1 == e2);
}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
index 6b8b4eed97a9..02f8b222d7d3 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
@@ -30,8 +30,8 @@
#include "test_macros.h"
-template <class _Tp>
-void where(const _Tp &) {}
+template <class T>
+void where(const T &) {}
void
test1()
diff --git a/test/std/re/re.alg/re.alg.match/exponential.pass.cpp b/test/std/re/re.alg/re.alg.match/exponential.pass.cpp
new file mode 100644
index 000000000000..f7a6f91efe04
--- /dev/null
+++ b/test/std/re/re.alg/re.alg.match/exponential.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+// UNSUPPORTED: libcpp-no-exceptions
+// UNSUPPORTED: c++98, c++03
+
+// template <class BidirectionalIterator, class Allocator, class charT, class traits>
+// bool
+// regex_match(BidirectionalIterator first, BidirectionalIterator last,
+// match_results<BidirectionalIterator, Allocator>& m,
+// const basic_regex<charT, traits>& e,
+// regex_constants::match_flag_type flags = regex_constants::match_default);
+
+// Throw exception after spent too many cycles with respect to the length of the input string.
+
+#include <regex>
+#include <cassert>
+
+int main() {
+ for (std::regex_constants::syntax_option_type op :
+ {std::regex::ECMAScript, std::regex::extended, std::regex::egrep,
+ std::regex::awk}) {
+ try {
+ std::regex_match(
+ "aaaaaaaaaaaaaaaaaaaa",
+ std::regex(
+ "a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaa",
+ op));
+ assert(false);
+ } catch (const std::regex_error &e) {
+ assert(e.code() == std::regex_constants::error_complexity);
+ }
+ }
+ std::string s(100000, 'a');
+ for (std::regex_constants::syntax_option_type op :
+ {std::regex::ECMAScript, std::regex::extended, std::regex::egrep,
+ std::regex::awk}) {
+ assert(std::regex_match(s, std::regex("a*", op)));
+ }
+ return 0;
+}
diff --git a/test/std/re/re.alg/re.alg.search/exponential.pass.cpp b/test/std/re/re.alg/re.alg.search/exponential.pass.cpp
new file mode 100644
index 000000000000..e22aa358b79b
--- /dev/null
+++ b/test/std/re/re.alg/re.alg.search/exponential.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+// UNSUPPORTED: libcpp-no-exceptions
+// UNSUPPORTED: c++98, c++03
+
+// template <class BidirectionalIterator, class Allocator, class charT, class traits>
+// bool
+// regex_search(BidirectionalIterator first, BidirectionalIterator last,
+// match_results<BidirectionalIterator, Allocator>& m,
+// const basic_regex<charT, traits>& e,
+// regex_constants::match_flag_type flags = regex_constants::match_default);
+
+// Throw exception after spent too many cycles with respect to the length of the input string.
+
+#include <regex>
+#include <cassert>
+
+int main() {
+ for (std::regex_constants::syntax_option_type op :
+ {std::regex::ECMAScript, std::regex::extended, std::regex::egrep,
+ std::regex::awk}) {
+ try {
+ std::regex_search(
+ "aaaaaaaaaaaaaaaaaaaa",
+ std::regex(
+ "a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaa",
+ op));
+ assert(false);
+ } catch (const std::regex_error &e) {
+ assert(e.code() == std::regex_constants::error_complexity);
+ }
+ }
+ std::string s(100000, 'a');
+ for (std::regex_constants::syntax_option_type op :
+ {std::regex::ECMAScript, std::regex::extended, std::regex::egrep,
+ std::regex::awk}) {
+ assert(std::regex_search(s, std::regex("a*", op)));
+ }
+ return 0;
+}
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 fa4e675c78f0..0040f7bfa089 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
@@ -33,7 +33,7 @@ extern "C" void LLVMFuzzerTestOneInput(const char *data)
std::regex::flag_type flag = std::regex_constants::grep;
std::string s((const char *)data, size);
std::regex re(s, flag);
- std::regex_match(s, re);
+ TEST_IGNORE_NODISCARD std::regex_match(s, re);
}
catch (std::regex_error &) {}
}
diff --git a/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp b/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
new file mode 100644
index 000000000000..dd17d3519e3e
--- /dev/null
+++ b/test/std/re/re.alg/re.alg.search/invert_neg_word_search.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class BidirectionalIterator, class Allocator, class charT, class traits>
+// bool
+// regex_search(BidirectionalIterator first, BidirectionalIterator last,
+// match_results<BidirectionalIterator, Allocator>& m,
+// const basic_regex<charT, traits>& e,
+// regex_constants::match_flag_type flags = regex_constants::match_default);
+
+#include <regex>
+#include <cassert>
+#include "test_macros.h"
+
+// PR34310
+int main()
+{
+ assert(std::regex_search("HelloWorld", std::regex("[^\\W]")));
+ assert(std::regex_search("_", std::regex("[^\\W]")));
+ return 0;
+}
diff --git a/test/std/re/re.grammar/excessive_brace_count.pass.cpp b/test/std/re/re.grammar/excessive_brace_count.pass.cpp
new file mode 100644
index 000000000000..597182e7e096
--- /dev/null
+++ b/test/std/re/re.grammar/excessive_brace_count.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+// UNSUPPORTED: libcpp-no-exceptions
+// UNSUPPORTED: c++03
+
+// the "n" in `a{n}` should be within the numeric limits.
+
+#include <regex>
+#include <cassert>
+#include "test_macros.h"
+
+int main() {
+ for (std::regex_constants::syntax_option_type op :
+ {std::regex::basic, std::regex::grep}) {
+ try {
+ TEST_IGNORE_NODISCARD std::regex("a\\{100000000000000000\\}", op);
+ assert(false);
+ } catch (const std::regex_error &e) {
+ assert(e.code() == std::regex_constants::error_badbrace);
+ }
+ }
+ for (std::regex_constants::syntax_option_type op :
+ {std::regex::ECMAScript, std::regex::extended, std::regex::egrep,
+ std::regex::awk}) {
+ try {
+ TEST_IGNORE_NODISCARD std::regex("a{100000000000000000}", op);
+ assert(false);
+ } catch (const std::regex_error &e) {
+ assert(e.code() == std::regex_constants::error_badbrace);
+ }
+ }
+ return 0;
+}
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 5e3ad4d910e7..f92fd880135e 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
@@ -95,7 +95,7 @@ int main()
assert((*i2).position() == 0);
assert((*i2).str() == "555-1234");
}
- { // http://llvm.org/PR33681
+ { // https://bugs.llvm.org/show_bug.cgi?id=33681
std::regex rex(".*");
const char foo[] = "foo";
// The -1 is because we don't want the implicit null from the array.
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 e699de819b0d..42bc526aed04 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
@@ -29,8 +29,8 @@
#include <type_traits>
#include "test_macros.h"
-template <class _Tp>
-void where(const _Tp &) {}
+template <class T>
+void where(const T &) {}
template <class CharT>
void
diff --git a/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp b/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
index e66d3e976db2..8e886cd8d1a7 100644
--- a/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
@@ -34,6 +34,7 @@ int main()
{
assert(error_badbackref_thrown("\\1abc")); // no references
assert(error_badbackref_thrown("ab(c)\\2def")); // only one reference
+ assert(error_badbackref_thrown("\\800000000000000000000000000000")); // overflows
// this should NOT throw, because we only should look at the '1'
// See https://bugs.llvm.org/show_bug.cgi?id=31387
diff --git a/test/std/re/re.results/re.results.size/empty.fail.cpp b/test/std/re/re.results/re.results.size/empty.fail.cpp
new file mode 100644
index 000000000000..6f677f3907ab
--- /dev/null
+++ b/test/std/re/re.results/re.results.size/empty.fail.cpp
@@ -0,0 +1,27 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// class match_results<BidirectionalIterator, Allocator>
+// bool empty() const;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <regex>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::match_results<const char*> c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
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 891648930e3c..16121cbf6bbf 100644
--- a/test/std/strings/basic.string/string.access/at.pass.cpp
+++ b/test/std/strings/basic.string/string.access/at.pass.cpp
@@ -35,7 +35,7 @@ test(S s, typename S::size_type pos)
{
try
{
- s.at(pos);
+ TEST_IGNORE_NODISCARD s.at(pos);
assert(false);
}
catch (std::out_of_range&)
@@ -44,7 +44,7 @@ test(S s, typename S::size_type pos)
}
try
{
- cs.at(pos);
+ TEST_IGNORE_NODISCARD cs.at(pos);
assert(false);
}
catch (std::out_of_range&)
diff --git a/test/std/strings/basic.string/string.capacity/empty.fail.cpp b/test/std/strings/basic.string/string.capacity/empty.fail.cpp
new file mode 100644
index 000000000000..addb02ed3cbc
--- /dev/null
+++ b/test/std/strings/basic.string/string.capacity/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// class deque
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <string>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::string c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
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 fbed5c36c3f4..a61a410a444a 100644
--- a/test/std/strings/basic.string/string.capacity/empty.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/empty.pass.cpp
@@ -9,17 +9,19 @@
// <string>
-// bool empty() const;
+// bool empty() const noexcept;
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
void
test(const S& s)
{
+ ASSERT_NOEXCEPT(s.empty());
assert(s.empty() == (s.size() == 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 81537ba52bb6..9e3fb0722604 100644
--- a/test/std/strings/basic.string/string.cons/alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/alloc.pass.cpp
@@ -24,9 +24,9 @@ test()
{
{
#if TEST_STD_VER > 14
- static_assert((noexcept(S{})), "" );
+ static_assert((noexcept(S{})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(S()) == noexcept(typename S::allocator_type())), "" );
+ static_assert((noexcept(S()) == noexcept(typename S::allocator_type())), "" );
#endif
S s;
LIBCPP_ASSERT(s.__invariants());
@@ -37,9 +37,9 @@ test()
}
{
#if TEST_STD_VER > 14
- static_assert((noexcept(S{typename S::allocator_type{}})), "" );
+ static_assert((noexcept(S{typename S::allocator_type{}})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(S(typename S::allocator_type())) == std::is_nothrow_copy_constructible<typename S::allocator_type>::value), "" );
+ 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));
LIBCPP_ASSERT(s.__invariants());
@@ -58,9 +58,9 @@ test2()
{
{
#if TEST_STD_VER > 14
- static_assert((noexcept(S{})), "" );
+ static_assert((noexcept(S{})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(S()) == noexcept(typename S::allocator_type())), "" );
+ static_assert((noexcept(S()) == noexcept(typename S::allocator_type())), "" );
#endif
S s;
LIBCPP_ASSERT(s.__invariants());
@@ -71,9 +71,9 @@ test2()
}
{
#if TEST_STD_VER > 14
- static_assert((noexcept(S{typename S::allocator_type{}})), "" );
+ static_assert((noexcept(S{typename S::allocator_type{}})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(S(typename S::allocator_type())) == std::is_nothrow_copy_constructible<typename S::allocator_type>::value), "" );
+ 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{});
LIBCPP_ASSERT(s.__invariants());
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 982bb43289d7..edd5c6e32d56 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
@@ -69,9 +69,9 @@ bool operator!=(const poca_alloc<T>& lhs, const poca_alloc<U>& rhs)
template <class S>
void test_assign(S &s1, const S& s2)
{
- try { s1 = s2; }
- catch ( std::bad_alloc &) { return; }
- assert(false);
+ try { s1 = s2; }
+ catch ( std::bad_alloc &) { return; }
+ assert(false);
}
#endif
@@ -110,21 +110,21 @@ int main()
{
typedef poca_alloc<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
- const char * p1 = "This is my first string";
- const char * p2 = "This is my second string";
+ const char * p1 = "This is my first string";
+ const char * p2 = "This is my second string";
alloc_imp<char> imp1;
alloc_imp<char> imp2;
- S s1(p1, A(&imp1));
- S s2(p2, A(&imp2));
+ S s1(p1, A(&imp1));
+ S s2(p2, A(&imp2));
- assert(s1 == p1);
- assert(s2 == p2);
+ assert(s1 == p1);
+ assert(s2 == p2);
- imp2.deactivate();
- test_assign(s1, s2);
- assert(s1 == p1);
- assert(s2 == p2);
+ imp2.deactivate();
+ test_assign(s1, s2);
+ assert(s1 == p1);
+ assert(s2 == p2);
}
#endif
#endif
diff --git a/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
index d4866921af7a..bb7bdcd1434f 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
@@ -41,9 +41,9 @@ int main()
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
#if TEST_STD_VER > 14
- static_assert((noexcept(S{})), "" );
+ static_assert((noexcept(S{})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(S()) == std::is_nothrow_move_constructible<A>::value), "" );
+ static_assert((noexcept(S()) == std::is_nothrow_move_constructible<A>::value), "" );
#endif
test(S(), A(3));
test(S("1"), A(5));
@@ -55,9 +55,9 @@ int main()
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
#if TEST_STD_VER > 14
- static_assert((noexcept(S{})), "" );
+ static_assert((noexcept(S{})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(S()) == std::is_nothrow_move_constructible<A>::value), "" );
+ static_assert((noexcept(S()) == std::is_nothrow_move_constructible<A>::value), "" );
#endif
S s1 ( "Twas brillig, and the slivy toves did gyre and gymbal in the wabe" );
S s2 (std::move(s1), A(1));
@@ -67,9 +67,9 @@ int main()
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
#if TEST_STD_VER > 14
- static_assert((noexcept(S{})), "" );
+ static_assert((noexcept(S{})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(S()) == std::is_nothrow_move_constructible<A>::value), "" );
+ static_assert((noexcept(S()) == std::is_nothrow_move_constructible<A>::value), "" );
#endif
test(S(), A());
test(S("1"), A());
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 136a60fe627b..0720543420a8 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
@@ -16,7 +16,7 @@
// allocator_traits<allocator_type>::propagate_on_container_move_assignment::value ||
// allocator_traits<allocator_type>::is_always_equal::value); // C++17
//
-// before C++17, we use the conforming extension
+// before C++17, we use the conforming extension
// noexcept(
// allocator_type::propagate_on_container_move_assignment::value &&
// is_nothrow_move_assignable<allocator_type>::value);
@@ -81,12 +81,12 @@ int main()
}
#if TEST_STD_VER > 14
{
- // POCMA is false, always equal
+ // POCMA is false, always equal
typedef std::basic_string<char, std::char_traits<char>, some_alloc2<char>> C;
static_assert( std::is_nothrow_move_assignable<C>::value, "");
}
{
- // POCMA is false, not always equal
+ // POCMA is false, not always equal
typedef std::basic_string<char, std::char_traits<char>, some_alloc3<char>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
diff --git a/test/std/strings/basic.string/string.cons/string_view.fail.cpp b/test/std/strings/basic.string/string.cons/string_view.fail.cpp
index 70459b2dcfb4..3d3bf4178fd2 100644
--- a/test/std/strings/basic.string/string.cons/string_view.fail.cpp
+++ b/test/std/strings/basic.string/string.cons/string_view.fail.cpp
@@ -18,6 +18,6 @@ void foo ( const string &s ) {}
int main()
{
- std::string_view sv = "ABCDE";
- foo(sv); // requires implicit conversion from string_view to string
+ std::string_view sv = "ABCDE";
+ foo(sv); // requires implicit conversion from string_view to string
}
diff --git a/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp b/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
new file mode 100644
index 000000000000..1d400b79b1c8
--- /dev/null
+++ b/test/std/strings/basic.string/string.cons/string_view_assignment.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// basic_string<charT,traits,Allocator>& operator=(basic_string_view<charT, traits> sv);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(S s1, SV sv)
+{
+ typedef typename S::traits_type T;
+ s1 = sv;
+ LIBCPP_ASSERT(s1.__invariants());
+ assert(s1.size() == sv.size());
+ assert(T::compare(s1.data(), sv.data(), s1.size()) == 0);
+ assert(s1.capacity() >= s1.size());
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(), SV(""));
+ test(S("1"), SV(""));
+ test(S(), SV("1"));
+ test(S("1"), SV("2"));
+ test(S("1"), SV("2"));
+
+ test(S(),
+ SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ test(S("123456789"),
+ SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ test(S("1234567890123456789012345678901234567890123456789012345678901234567890"),
+ SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
+ "1234567890123456789012345678901234567890123456789012345678901234567890"),
+ SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::string_view SV;
+ test(S(), SV(""));
+ test(S("1"), SV(""));
+ test(S(), SV("1"));
+ test(S("1"), SV("2"));
+ test(S("1"), SV("2"));
+
+ test(S(),
+ SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ test(S("123456789"),
+ SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ test(S("1234567890123456789012345678901234567890123456789012345678901234567890"),
+ SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
+ "1234567890123456789012345678901234567890123456789012345678901234567890"),
+ SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp b/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp
new file mode 100644
index 000000000000..6091e0c066d3
--- /dev/null
+++ b/test/std/strings/basic.string/string.ends_with/ends_with.char.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, c++14, c++17
+
+// <string>
+
+// bool ends_with(charT x) const noexcept;
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ typedef std::string S;
+ S s1 {};
+ S s2 { "abcde", 5 };
+
+ ASSERT_NOEXCEPT(s1.ends_with('e'));
+
+ assert (!s1.ends_with('e'));
+ assert (!s1.ends_with('x'));
+ assert ( s2.ends_with('e'));
+ assert (!s2.ends_with('x'));
+ }
+}
diff --git a/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp b/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp
new file mode 100644
index 000000000000..b1f5fcd50cf3
--- /dev/null
+++ b/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// bool ends_with(const CharT *x) const;
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ typedef std::string S;
+ const char *s = "abcde";
+
+ S s0;
+ S s1 { s + 4, 1 };
+ S s2 { s + 3, 2 };
+// S s3 { s + 2, 3 };
+// S s4 { s + 1, 4 };
+// S s5 { s, 5 };
+ S sNot { "def", 3 };
+
+ LIBCPP_ASSERT_NOEXCEPT(s0.ends_with(""));
+
+ assert ( s0.ends_with(""));
+ assert (!s0.ends_with("e"));
+
+ assert ( s1.ends_with(""));
+ assert ( s1.ends_with("e"));
+ assert (!s1.ends_with("de"));
+ assert (!s1.ends_with("cde"));
+ assert (!s1.ends_with("bcde"));
+ assert (!s1.ends_with("abcde"));
+ assert (!s1.ends_with("def"));
+
+ assert ( s2.ends_with(""));
+ assert ( s2.ends_with("e"));
+ assert ( s2.ends_with("de"));
+ assert (!s2.ends_with("cde"));
+ assert (!s2.ends_with("bcde"));
+ assert (!s2.ends_with("abcde"));
+ assert (!s2.ends_with("def"));
+
+ assert ( sNot.ends_with(""));
+ assert (!sNot.ends_with("e"));
+ assert (!sNot.ends_with("de"));
+ assert (!sNot.ends_with("cde"));
+ assert (!sNot.ends_with("bcde"));
+ assert (!sNot.ends_with("abcde"));
+ assert ( sNot.ends_with("def"));
+ }
+}
diff --git a/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp b/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp
new file mode 100644
index 000000000000..4bbd4bc864b2
--- /dev/null
+++ b/test/std/strings/basic.string/string.ends_with/ends_with.string_view.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, c++11, c++14, c++17
+
+// <string>
+
+// bool ends_with(basic_string_view x) const noexcept;
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ const char *s = "abcde";
+
+ S s0;
+ S s1 { s + 4, 1 };
+ S s2 { s + 3, 2 };
+// S s3 { s + 2, 3 };
+// S s4 { s + 1, 4 };
+// S s5 { s, 5 };
+ S sNot { "def", 3 };
+
+ SV sv0;
+ SV sv1 { s + 4, 1 };
+ SV sv2 { s + 3, 2 };
+ SV sv3 { s + 2, 3 };
+ SV sv4 { s + 1, 4 };
+ SV sv5 { s , 5 };
+ SV svNot {"def", 3 };
+
+ ASSERT_NOEXCEPT(s0.ends_with(sv0));
+
+ assert ( s0.ends_with(sv0));
+ assert (!s0.ends_with(sv1));
+
+ assert ( s1.ends_with(sv0));
+ assert ( s1.ends_with(sv1));
+ assert (!s1.ends_with(sv2));
+ assert (!s1.ends_with(sv3));
+ assert (!s1.ends_with(sv4));
+ assert (!s1.ends_with(sv5));
+ assert (!s1.ends_with(svNot));
+
+ assert ( s2.ends_with(sv0));
+ assert ( s2.ends_with(sv1));
+ assert ( s2.ends_with(sv2));
+ assert (!s2.ends_with(sv3));
+ assert (!s2.ends_with(sv4));
+ assert (!s2.ends_with(sv5));
+ assert (!s2.ends_with(svNot));
+
+ assert ( sNot.ends_with(sv0));
+ assert (!sNot.ends_with(sv1));
+ assert (!sNot.ends_with(sv2));
+ assert (!sNot.ends_with(sv3));
+ assert (!sNot.ends_with(sv4));
+ assert (!sNot.ends_with(sv5));
+ assert ( sNot.ends_with(svNot));
+ }
+}
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 b464291d4c5d..7ed55403927e 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
@@ -32,11 +32,11 @@ template <class S, class It>
void
test_exceptions(S s, It first, It last)
{
- S aCopy = s;
+ S aCopy = s;
try {
- s.append(first, last);
- assert(false);
- }
+ s.append(first, last);
+ assert(false);
+ }
catch (...) {}
LIBCPP_ASSERT(s.__invariants());
assert(s == aCopy);
@@ -164,7 +164,7 @@ int main()
}
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
- { // test iterator operations that throw
+ { // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
typedef input_iterator<TIter> IIter;
@@ -176,33 +176,33 @@ int main()
test_exceptions(S(), TIter(s, s+10, 4, TIter::TAIncrement), TIter());
test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
- }
+ }
#endif
- { // test appending to self
+ { // test appending to self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
-
- s_short.append(s_short.begin(), s_short.end());
- assert(s_short == "123/123/");
- s_short.append(s_short.begin(), s_short.end());
- assert(s_short == "123/123/123/123/");
- s_short.append(s_short.begin(), s_short.end());
- assert(s_short == "123/123/123/123/123/123/123/123/");
-
- s_long.append(s_long.begin(), s_long.end());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
- }
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.append(s_short.begin(), s_short.end());
+ assert(s_short == "123/123/");
+ s_short.append(s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/");
+ s_short.append(s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.append(s_long.begin(), s_long.end());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
- { // test appending a different type
+ { // test appending a different type
typedef std::string S;
- const uint8_t p[] = "ABCD";
+ const uint8_t p[] = "ABCD";
- S s;
- s.append(p, p + 4);
- assert(s == "ABCD");
- }
+ S s;
+ s.append(p, p + 4);
+ assert(s == "ABCD");
+ }
{ // test with a move iterator that returns char&&
typedef forward_iterator<const char*> It;
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 eb552ca83928..823905df4a14 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
@@ -62,19 +62,19 @@ int main()
}
#endif
- { // test appending to self
+ { // test appending to self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.append(s_short.c_str());
- assert(s_short == "123/123/");
- s_short.append(s_short.c_str());
- assert(s_short == "123/123/123/123/");
- s_short.append(s_short.c_str());
- assert(s_short == "123/123/123/123/123/123/123/123/");
+ s_short.append(s_short.c_str());
+ assert(s_short == "123/123/");
+ s_short.append(s_short.c_str());
+ assert(s_short == "123/123/123/123/");
+ s_short.append(s_short.c_str());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
- s_long.append(s_long.c_str());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
- }
+ s_long.append(s_long.c_str());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
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 fc80d7cccce6..f09ec682e9f9 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
@@ -71,19 +71,19 @@ int main()
}
#endif
- { // test appending to self
+ { // test appending to self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.append(s_short.data(), s_short.size());
- assert(s_short == "123/123/");
- s_short.append(s_short.data(), s_short.size());
- assert(s_short == "123/123/123/123/");
- s_short.append(s_short.data(), s_short.size());
- assert(s_short == "123/123/123/123/123/123/123/123/");
+ s_short.append(s_short.data(), s_short.size());
+ assert(s_short == "123/123/");
+ s_short.append(s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/");
+ s_short.append(s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
- s_long.append(s_long.data(), s_long.size());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
- }
+ s_long.append(s_long.data(), s_long.size());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
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 f2fb8782a21d..5ca5aaf8629c 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
@@ -17,6 +17,12 @@
#include "test_macros.h"
#include "min_allocator.h"
+struct veryLarge
+{
+ long long a;
+ char b;
+};
+
template <class S>
void
test(S s, typename S::value_type c, S expected)
@@ -42,4 +48,14 @@ int main()
test(S("12345678901234567890"), 'a', S("12345678901234567890a"));
}
#endif
+#if 0
+ {
+// https://bugs.llvm.org/show_bug.cgi?id=31454
+ std::basic_string<veryLarge> s;
+ veryLarge vl;
+ s.push_back(vl);
+ s.push_back(vl);
+ s.push_back(vl);
+ }
+#endif
}
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 e5312e6db6ce..cb83f25d7117 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
@@ -33,10 +33,10 @@ template <class S, class It>
void
test_exceptions(S s, It first, It last)
{
- S aCopy = s;
+ S aCopy = s;
try {
- s.assign(first, last);
- assert(false);
+ s.assign(first, last);
+ assert(false);
}
catch (...) {}
LIBCPP_ASSERT(s.__invariants());
@@ -165,7 +165,7 @@ int main()
}
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
- { // test iterator operations that throw
+ { // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
typedef input_iterator<TIter> IIter;
@@ -177,32 +177,32 @@ int main()
test_exceptions(S(), TIter(s, s+10, 4, TIter::TAIncrement), TIter());
test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
- }
+ }
#endif
- { // test assigning to self
+ { // test assigning to self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.assign(s_short.begin(), s_short.end());
- assert(s_short == "123/");
- s_short.assign(s_short.begin() + 2, s_short.end());
- assert(s_short == "3/");
+ s_short.assign(s_short.begin(), s_short.end());
+ assert(s_short == "123/");
+ s_short.assign(s_short.begin() + 2, s_short.end());
+ assert(s_short == "3/");
- s_long.assign(s_long.begin(), s_long.end());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
+ s_long.assign(s_long.begin(), s_long.end());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
- s_long.assign(s_long.begin() + 30, s_long.end());
- assert(s_long == "nsectetur/");
- }
+ s_long.assign(s_long.begin() + 30, s_long.end());
+ assert(s_long == "nsectetur/");
+ }
- { // test assigning a different type
+ { // test assigning a different type
typedef std::string S;
- const uint8_t p[] = "ABCD";
+ const uint8_t p[] = "ABCD";
- S s;
- s.assign(p, p + 4);
- assert(s == "ABCD");
- }
+ S s;
+ s.assign(p, p + 4);
+ assert(s == "ABCD");
+ }
}
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 b0876b388d83..b592455a350e 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
@@ -62,17 +62,17 @@ int main()
}
#endif
- { // test assignment to self
+ { // test assignment to self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.assign(s_short.c_str());
- assert(s_short == "123/");
- s_short.assign(s_short.c_str() + 2);
- assert(s_short == "3/");
+ s_short.assign(s_short.c_str());
+ assert(s_short == "123/");
+ s_short.assign(s_short.c_str() + 2);
+ assert(s_short == "3/");
- s_long.assign(s_long.c_str() + 30);
- assert(s_long == "nsectetur/");
- }
+ s_long.assign(s_long.c_str() + 30);
+ assert(s_long == "nsectetur/");
+ }
}
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 97a9990f5180..70b00619a913 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
@@ -70,20 +70,20 @@ int main()
S("12345678901234567890"));
}
#endif
- { // test assign to self
+ { // test assign to self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.assign(s_short.data(), s_short.size());
- assert(s_short == "123/");
- s_short.assign(s_short.data() + 2, s_short.size() - 2);
- assert(s_short == "3/");
+ s_short.assign(s_short.data(), s_short.size());
+ assert(s_short == "123/");
+ s_short.assign(s_short.data() + 2, s_short.size() - 2);
+ assert(s_short == "3/");
- s_long.assign(s_long.data(), s_long.size());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
+ s_long.assign(s_long.data(), s_long.size());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
- s_long.assign(s_long.data() + 2, 8 );
- assert(s_long == "rem ipsu");
- }
+ s_long.assign(s_long.data() + 2, 8 );
+ assert(s_long == "rem ipsu");
+ }
}
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 2c8b6e4a1882..cb4b40f9e8cf 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
@@ -39,7 +39,7 @@ void
test_exceptions(S s, typename S::difference_type pos, It first, It last)
{
typename S::const_iterator p = s.cbegin() + pos;
- S aCopy = s;
+ S aCopy = s;
try {
s.insert(p, first, last);
assert(false);
@@ -145,7 +145,7 @@ int main()
}
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
- { // test iterator operations that throw
+ { // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
typedef input_iterator<TIter> IIter;
@@ -157,7 +157,7 @@ int main()
test_exceptions(S(), 0, TIter(s, s+10, 4, TIter::TAIncrement), TIter());
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
{
@@ -170,30 +170,30 @@ int main()
}
#endif
- { // test inserting into self
+ { // test inserting into self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
-
- s_short.insert(s_short.begin(), s_short.begin(), s_short.end());
- assert(s_short == "123/123/");
- s_short.insert(s_short.begin(), s_short.begin(), s_short.end());
- assert(s_short == "123/123/123/123/");
- s_short.insert(s_short.begin(), s_short.begin(), s_short.end());
- assert(s_short == "123/123/123/123/123/123/123/123/");
-
- s_long.insert(s_long.begin(), s_long.begin(), s_long.end());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
- }
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.insert(s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/");
+ s_short.insert(s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/");
+ s_short.insert(s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.insert(s_long.begin(), s_long.begin(), s_long.end());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
- { // test assigning a different type
+ { // test assigning a different type
typedef std::string S;
const uint8_t p[] = "ABCD";
S s;
s.insert(s.begin(), p, p + 4);
assert(s == "ABCD");
- }
+ }
{ // test with a move iterator that returns char&&
typedef input_iterator<const char*> It;
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 e49f57a7f9ad..b4505a4c1f3e 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
@@ -219,19 +219,19 @@ int main()
}
#endif
- { // test inserting into self
+ { // test inserting into self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.insert(0, s_short.c_str());
- assert(s_short == "123/123/");
- s_short.insert(0, s_short.c_str());
- assert(s_short == "123/123/123/123/");
- s_short.insert(0, s_short.c_str());
- assert(s_short == "123/123/123/123/123/123/123/123/");
+ s_short.insert(0, s_short.c_str());
+ assert(s_short == "123/123/");
+ s_short.insert(0, s_short.c_str());
+ assert(s_short == "123/123/123/123/");
+ s_short.insert(0, s_short.c_str());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
- s_long.insert(0, s_long.c_str());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
- }
+ s_long.insert(0, s_long.c_str());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
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 a42a60ddcdb4..ee5991c15966 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
@@ -700,19 +700,19 @@ int main()
}
#endif
- { // test inserting into self
+ { // test inserting into self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.insert(0, s_short.data(), s_short.size());
- assert(s_short == "123/123/");
- s_short.insert(0, s_short.data(), s_short.size());
- assert(s_short == "123/123/123/123/");
- s_short.insert(0, s_short.data(), s_short.size());
- assert(s_short == "123/123/123/123/123/123/123/123/");
+ s_short.insert(0, s_short.data(), s_short.size());
+ assert(s_short == "123/123/");
+ s_short.insert(0, s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/");
+ s_short.insert(0, s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
- s_long.insert(0, s_long.data(), s_long.size());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
- }
+ s_long.insert(0, s_long.data(), s_long.size());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp
new file mode 100644
index 000000000000..970cbcb1756c
--- /dev/null
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp
@@ -0,0 +1,239 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+// basic_string<charT,traits,Allocator>&
+// insert(size_type pos, string_view sv);
+
+#include <string>
+#include <stdexcept>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(S s, typename S::size_type pos, SV sv, S expected)
+{
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos <= old_size)
+ {
+ s.insert(pos, sv);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.insert(pos, sv);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
+ }
+#endif
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(""), 0, SV(""), S(""));
+ test(S(""), 0, SV("12345"), S("12345"));
+ test(S(""), 0, SV("1234567890"), S("1234567890"));
+ test(S(""), 0, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S(""), 1, SV(""), S("can't happen"));
+ test(S(""), 1, SV("12345"), S("can't happen"));
+ test(S(""), 1, SV("1234567890"), S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), S("can't happen"));
+ test(S("abcde"), 0, SV(""), S("abcde"));
+ test(S("abcde"), 0, SV("12345"), S("12345abcde"));
+ test(S("abcde"), 0, SV("1234567890"), S("1234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), S("12345678901234567890abcde"));
+ test(S("abcde"), 1, SV(""), S("abcde"));
+ test(S("abcde"), 1, SV("12345"), S("a12345bcde"));
+ test(S("abcde"), 1, SV("1234567890"), S("a1234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), S("a12345678901234567890bcde"));
+ test(S("abcde"), 2, SV(""), S("abcde"));
+ test(S("abcde"), 2, SV("12345"), S("ab12345cde"));
+ test(S("abcde"), 2, SV("1234567890"), S("ab1234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), S("ab12345678901234567890cde"));
+ test(S("abcde"), 4, SV(""), S("abcde"));
+ test(S("abcde"), 4, SV("12345"), S("abcd12345e"));
+ test(S("abcde"), 4, SV("1234567890"), S("abcd1234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), S("abcd12345678901234567890e"));
+ test(S("abcde"), 5, SV(""), S("abcde"));
+ test(S("abcde"), 5, SV("12345"), S("abcde12345"));
+ test(S("abcde"), 5, SV("1234567890"), S("abcde1234567890"));
+ test(S("abcde"), 5, SV("12345678901234567890"), S("abcde12345678901234567890"));
+ test(S("abcde"), 6, SV(""), S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), S("can't happen"));
+ test(S("abcdefghij"), 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), S("12345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 1, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), S("a12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 5, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345"), S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), S("abcde12345678901234567890fghij"));
+ test(S("abcdefghij"), 9, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345"), S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), S("abcdefghi12345678901234567890j"));
+ test(S("abcdefghij"), 10, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345"), S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, SV("1234567890"), S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 11, SV(""), S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 20, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 21, SV(""), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), S("can't happen"));
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::string_view SV;
+ test(S(""), 0, SV(""), S(""));
+ test(S(""), 0, SV("12345"), S("12345"));
+ test(S(""), 0, SV("1234567890"), S("1234567890"));
+ test(S(""), 0, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S(""), 1, SV(""), S("can't happen"));
+ test(S(""), 1, SV("12345"), S("can't happen"));
+ test(S(""), 1, SV("1234567890"), S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), S("can't happen"));
+ test(S("abcde"), 0, SV(""), S("abcde"));
+ test(S("abcde"), 0, SV("12345"), S("12345abcde"));
+ test(S("abcde"), 0, SV("1234567890"), S("1234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), S("12345678901234567890abcde"));
+ test(S("abcde"), 1, SV(""), S("abcde"));
+ test(S("abcde"), 1, SV("12345"), S("a12345bcde"));
+ test(S("abcde"), 1, SV("1234567890"), S("a1234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), S("a12345678901234567890bcde"));
+ test(S("abcde"), 2, SV(""), S("abcde"));
+ test(S("abcde"), 2, SV("12345"), S("ab12345cde"));
+ test(S("abcde"), 2, SV("1234567890"), S("ab1234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), S("ab12345678901234567890cde"));
+ test(S("abcde"), 4, SV(""), S("abcde"));
+ test(S("abcde"), 4, SV("12345"), S("abcd12345e"));
+ test(S("abcde"), 4, SV("1234567890"), S("abcd1234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), S("abcd12345678901234567890e"));
+ test(S("abcde"), 5, SV(""), S("abcde"));
+ test(S("abcde"), 5, SV("12345"), S("abcde12345"));
+ test(S("abcde"), 5, SV("1234567890"), S("abcde1234567890"));
+ test(S("abcde"), 5, SV("12345678901234567890"), S("abcde12345678901234567890"));
+ test(S("abcde"), 6, SV(""), S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), S("can't happen"));
+ test(S("abcdefghij"), 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), S("12345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 1, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), S("a12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 5, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345"), S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), S("abcde12345678901234567890fghij"));
+ test(S("abcdefghij"), 9, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345"), S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), S("abcdefghi12345678901234567890j"));
+ test(S("abcdefghij"), 10, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345"), S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, SV("1234567890"), S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 11, SV(""), S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 20, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 21, SV(""), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), S("can't happen"));
+ }
+#endif
+
+ { // test inserting into self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.insert(0, s_short.c_str());
+ assert(s_short == "123/123/");
+ s_short.insert(0, s_short.c_str());
+ assert(s_short == "123/123/123/123/");
+ s_short.insert(0, s_short.c_str());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.insert(0, s_long.c_str());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
+}
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 e456d395220b..f8126bcaf7de 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
@@ -42,12 +42,12 @@ test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f,
{
typename S::const_iterator first = s.begin() + pos1;
typename S::const_iterator last = s.begin() + pos1 + n1;
- S aCopy = s;
- try {
- s.replace(first, last, f, l);
- assert(false);
- }
- catch (...) {}
+ S aCopy = s;
+ try {
+ s.replace(first, last, f, l);
+ assert(false);
+ }
+ catch (...) {}
LIBCPP_ASSERT(s.__invariants());
assert(s == aCopy);
}
@@ -993,7 +993,7 @@ int main()
}
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
- { // test iterator operations that throw
+ { // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
typedef input_iterator<TIter> IIter;
@@ -1005,36 +1005,36 @@ int main()
test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 4, TIter::TAIncrement), TIter());
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
- { // test replacing into self
+ { // test replacing into self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
- assert(s_short == "123/123/");
- s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
- assert(s_short == "123/123/123/123/");
- s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
- assert(s_short == "123/123/123/123/123/123/123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
- s_long.replace(s_long.begin(), s_long.begin(), s_long.begin(), s_long.end());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
- }
+ s_long.replace(s_long.begin(), s_long.begin(), s_long.begin(), s_long.end());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
- { // test assigning a different type
+ { // test assigning a different type
typedef std::string S;
- const uint8_t pc[] = "ABCD";
- uint8_t p[] = "EFGH";
+ const uint8_t pc[] = "ABCD";
+ uint8_t p[] = "EFGH";
- S s;
- s.replace(s.begin(), s.end(), pc, pc + 4);
- assert(s == "ABCD");
+ S s;
+ s.replace(s.begin(), s.end(), pc, pc + 4);
+ assert(s == "ABCD");
- s.clear();
- s.replace(s.begin(), s.end(), p, p + 4);
- assert(s == "EFGH");
- }
+ s.clear();
+ s.replace(s.begin(), s.end(), p, p + 4);
+ assert(s == "EFGH");
+ }
}
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 f642d3a4f921..a7d6a6e3ce3c 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
@@ -283,19 +283,19 @@ int main()
}
#endif
- { // test replacing into self
+ { // test replacing into self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
- assert(s_short == "123/123/");
- s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
- assert(s_short == "123/123/123/123/");
- s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
- assert(s_short == "123/123/123/123/123/123/123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
+ assert(s_short == "123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
+ assert(s_short == "123/123/123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
- s_long.replace(s_long.begin(), s_long.begin(), s_long.c_str());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
- }
+ s_long.replace(s_long.begin(), s_long.begin(), s_long.c_str());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
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 695036807223..6c68b156641f 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
@@ -973,19 +973,19 @@ int main()
}
#endif
- { // test replacing into self
+ { // test replacing into self
typedef std::string S;
- S s_short = "123/";
- S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
- s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
- assert(s_short == "123/123/");
- s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
- assert(s_short == "123/123/123/123/");
- s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
- assert(s_short == "123/123/123/123/123/123/123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
+ assert(s_short == "123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
- s_long.replace(s_long.begin(), s_long.begin(), s_long.data(), s_long.size());
- assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
- }
+ s_long.replace(s_long.begin(), s_long.begin(), s_long.data(), s_long.size());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp
new file mode 100644
index 000000000000..ec81001df663
--- /dev/null
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp
@@ -0,0 +1,286 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+// basic_string<charT,traits,Allocator>&
+// replace(const_iterator i1, const_iterator i2, basic_string_view<charT,traits> sv);
+
+#include <string>
+#include <algorithm>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected)
+{
+ typename S::size_type old_size = s.size();
+ typename S::const_iterator first = s.begin() + pos1;
+ typename S::const_iterator last = s.begin() + pos1 + n1;
+ typename S::size_type xlen = last - first;
+ s.replace(first, last, sv);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type rlen = sv.size();
+ assert(s.size() == old_size - xlen + rlen);
+}
+
+template <class S, class SV>
+void test0()
+{
+ test(S(""), 0, 0, SV(""), S(""));
+ test(S(""), 0, 0, SV("12345"), S("12345"));
+ test(S(""), 0, 0, SV("1234567890"), S("1234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcde"), 0, 0, SV(""), S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), S("12345abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), S("1234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcde"));
+ test(S("abcde"), 0, 1, SV(""), S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), S("12345bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), S("1234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcde"));
+ test(S("abcde"), 0, 2, SV(""), S("cde"));
+ test(S("abcde"), 0, 2, SV("12345"), S("12345cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), S("1234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), S("12345678901234567890cde"));
+ test(S("abcde"), 0, 4, SV(""), S("e"));
+ test(S("abcde"), 0, 4, SV("12345"), S("12345e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), S("1234567890e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), S("12345678901234567890e"));
+ test(S("abcde"), 0, 5, SV(""), S(""));
+ test(S("abcde"), 0, 5, SV("12345"), S("12345"));
+ test(S("abcde"), 0, 5, SV("1234567890"), S("1234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcde"), 1, 0, SV(""), S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345"), S("a12345bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), S("a1234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcde"));
+ test(S("abcde"), 1, 1, SV(""), S("acde"));
+ test(S("abcde"), 1, 1, SV("12345"), S("a12345cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), S("a1234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cde"));
+ test(S("abcde"), 1, 2, SV(""), S("ade"));
+ test(S("abcde"), 1, 2, SV("12345"), S("a12345de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), S("a1234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), S("a12345678901234567890de"));
+ test(S("abcde"), 1, 3, SV(""), S("ae"));
+ test(S("abcde"), 1, 3, SV("12345"), S("a12345e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), S("a1234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), S("a12345678901234567890e"));
+ test(S("abcde"), 1, 4, SV(""), S("a"));
+ test(S("abcde"), 1, 4, SV("12345"), S("a12345"));
+ test(S("abcde"), 1, 4, SV("1234567890"), S("a1234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890"));
+ test(S("abcde"), 2, 0, SV(""), S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345"), S("ab12345cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), S("ab1234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), S("ab12345678901234567890cde"));
+ test(S("abcde"), 2, 1, SV(""), S("abde"));
+ test(S("abcde"), 2, 1, SV("12345"), S("ab12345de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), S("ab1234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), S("ab12345678901234567890de"));
+ test(S("abcde"), 2, 2, SV(""), S("abe"));
+ test(S("abcde"), 2, 2, SV("12345"), S("ab12345e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), S("ab1234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), S("ab12345678901234567890e"));
+ test(S("abcde"), 2, 3, SV(""), S("ab"));
+ test(S("abcde"), 2, 3, SV("12345"), S("ab12345"));
+ test(S("abcde"), 2, 3, SV("1234567890"), S("ab1234567890"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), S("ab12345678901234567890"));
+ test(S("abcde"), 4, 0, SV(""), S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345"), S("abcd12345e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), S("abcd1234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), S("abcd12345678901234567890e"));
+ test(S("abcde"), 4, 1, SV(""), S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345"), S("abcd12345"));
+ test(S("abcde"), 4, 1, SV("1234567890"), S("abcd1234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), S("abcd12345678901234567890"));
+ test(S("abcde"), 5, 0, SV(""), S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345"), S("abcde12345"));
+ test(S("abcde"), 5, 0, SV("1234567890"), S("abcde1234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890"));
+ test(S("abcdefghij"), 0, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV(""), S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), S("12345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), S("1234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 5, SV(""), S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), S("12345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), S("1234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), S("12345678901234567890fghij"));
+ test(S("abcdefghij"), 0, 9, SV(""), S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), S("12345j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), S("1234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), S("12345678901234567890j"));
+ test(S("abcdefghij"), 0, 10, SV(""), S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345"), S("12345"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), S("1234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcdefghij"), 1, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 1, SV(""), S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), S("a12345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), S("a1234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghij"));
+}
+
+template <class S, class SV>
+void test1()
+{
+ test(S("abcdefghij"), 1, 4, SV(""), S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), S("a12345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), S("a1234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890fghij"));
+ test(S("abcdefghij"), 1, 8, SV(""), S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), S("a12345j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), S("a1234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), S("a12345678901234567890j"));
+ test(S("abcdefghij"), 1, 9, SV(""), S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), S("a12345"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), S("a1234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890"));
+ test(S("abcdefghij"), 5, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890fghij"));
+ test(S("abcdefghij"), 5, 1, SV(""), S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), S("abcde12345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), S("abcde1234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890ghij"));
+ test(S("abcdefghij"), 5, 2, SV(""), S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), S("abcde12345hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), S("abcde1234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), S("abcde12345678901234567890hij"));
+ test(S("abcdefghij"), 5, 4, SV(""), S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), S("abcde12345j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), S("abcde1234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), S("abcde12345678901234567890j"));
+ test(S("abcdefghij"), 5, 5, SV(""), S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), S("abcde12345"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), S("abcde12345678901234567890"));
+ test(S("abcdefghij"), 9, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), S("abcdefghi12345678901234567890j"));
+ test(S("abcdefghij"), 9, 1, SV(""), S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
+ test(S("abcdefghij"), 10, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), S("12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), S("1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), S("12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), S("1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), S("12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), S("12345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), S("1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), S("12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), S("a12345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), S("a1234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), S("a12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), S("a1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), S("a12345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), S("a1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), S("a12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), S("a12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), S("abcdefghij12345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), S("abcdefghij1234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), S("abcdefghij12345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), S("abcdefghij1234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), S("abcdefghij12345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), S("abcdefghij1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), S("abcdefghij12345678901234567890t"));
+}
+
+template <class S, class SV>
+void test2()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::string_view SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
new file mode 100644
index 000000000000..60ecd67f1f7d
--- /dev/null
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
@@ -0,0 +1,384 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+// basic_string<charT,traits,Allocator>&
+// replace(size_type pos1, size_type n1, basic_string_view<charT,traits> sv);
+
+#include <string>
+#include <stdexcept>
+#include <algorithm>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected)
+{
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos1 <= old_size)
+ {
+ s.replace(pos1, n1, sv);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type xlen = std::min(n1, old_size - pos1);
+ typename S::size_type rlen = sv.size();
+ assert(s.size() == old_size - xlen + rlen);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.replace(pos1, n1, sv);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size);
+ assert(s == s0);
+ }
+ }
+#endif
+}
+
+template <class S, class SV>
+void test0()
+{
+ test(S(""), 0, 0, SV(""), S(""));
+ test(S(""), 0, 0, SV("12345"), S("12345"));
+ test(S(""), 0, 0, SV("1234567890"), S("1234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S(""), 0, 1, SV(""), S(""));
+ test(S(""), 0, 1, SV("12345"), S("12345"));
+ test(S(""), 0, 1, SV("1234567890"), S("1234567890"));
+ test(S(""), 0, 1, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S(""), 1, 0, SV(""), S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), S("can't happen"));
+ test(S("abcde"), 0, 0, SV(""), S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), S("12345abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), S("1234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcde"));
+ test(S("abcde"), 0, 1, SV(""), S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), S("12345bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), S("1234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcde"));
+ test(S("abcde"), 0, 2, SV(""), S("cde"));
+ test(S("abcde"), 0, 2, SV("12345"), S("12345cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), S("1234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), S("12345678901234567890cde"));
+ test(S("abcde"), 0, 4, SV(""), S("e"));
+ test(S("abcde"), 0, 4, SV("12345"), S("12345e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), S("1234567890e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), S("12345678901234567890e"));
+ test(S("abcde"), 0, 5, SV(""), S(""));
+ test(S("abcde"), 0, 5, SV("12345"), S("12345"));
+ test(S("abcde"), 0, 5, SV("1234567890"), S("1234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcde"), 0, 6, SV(""), S(""));
+ test(S("abcde"), 0, 6, SV("12345"), S("12345"));
+ test(S("abcde"), 0, 6, SV("1234567890"), S("1234567890"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcde"), 1, 0, SV(""), S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345"), S("a12345bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), S("a1234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcde"));
+ test(S("abcde"), 1, 1, SV(""), S("acde"));
+ test(S("abcde"), 1, 1, SV("12345"), S("a12345cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), S("a1234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cde"));
+ test(S("abcde"), 1, 2, SV(""), S("ade"));
+ test(S("abcde"), 1, 2, SV("12345"), S("a12345de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), S("a1234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), S("a12345678901234567890de"));
+ test(S("abcde"), 1, 3, SV(""), S("ae"));
+ test(S("abcde"), 1, 3, SV("12345"), S("a12345e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), S("a1234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), S("a12345678901234567890e"));
+ test(S("abcde"), 1, 4, SV(""), S("a"));
+ test(S("abcde"), 1, 4, SV("12345"), S("a12345"));
+ test(S("abcde"), 1, 4, SV("1234567890"), S("a1234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890"));
+ test(S("abcde"), 1, 5, SV(""), S("a"));
+ test(S("abcde"), 1, 5, SV("12345"), S("a12345"));
+ test(S("abcde"), 1, 5, SV("1234567890"), S("a1234567890"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), S("a12345678901234567890"));
+ test(S("abcde"), 2, 0, SV(""), S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345"), S("ab12345cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), S("ab1234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), S("ab12345678901234567890cde"));
+ test(S("abcde"), 2, 1, SV(""), S("abde"));
+ test(S("abcde"), 2, 1, SV("12345"), S("ab12345de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), S("ab1234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), S("ab12345678901234567890de"));
+ test(S("abcde"), 2, 2, SV(""), S("abe"));
+ test(S("abcde"), 2, 2, SV("12345"), S("ab12345e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), S("ab1234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), S("ab12345678901234567890e"));
+ test(S("abcde"), 2, 3, SV(""), S("ab"));
+ test(S("abcde"), 2, 3, SV("12345"), S("ab12345"));
+ test(S("abcde"), 2, 3, SV("1234567890"), S("ab1234567890"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), S("ab12345678901234567890"));
+ test(S("abcde"), 2, 4, SV(""), S("ab"));
+ test(S("abcde"), 2, 4, SV("12345"), S("ab12345"));
+ test(S("abcde"), 2, 4, SV("1234567890"), S("ab1234567890"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), S("ab12345678901234567890"));
+ test(S("abcde"), 4, 0, SV(""), S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345"), S("abcd12345e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), S("abcd1234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), S("abcd12345678901234567890e"));
+ test(S("abcde"), 4, 1, SV(""), S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345"), S("abcd12345"));
+ test(S("abcde"), 4, 1, SV("1234567890"), S("abcd1234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), S("abcd12345678901234567890"));
+ test(S("abcde"), 4, 2, SV(""), S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345"), S("abcd12345"));
+ test(S("abcde"), 4, 2, SV("1234567890"), S("abcd1234567890"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), S("abcd12345678901234567890"));
+ test(S("abcde"), 5, 0, SV(""), S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345"), S("abcde12345"));
+ test(S("abcde"), 5, 0, SV("1234567890"), S("abcde1234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890"));
+ test(S("abcde"), 5, 1, SV(""), S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345"), S("abcde12345"));
+ test(S("abcde"), 5, 1, SV("1234567890"), S("abcde1234567890"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890"));
+}
+
+template <class S, class SV>
+void test1()
+{
+ test(S("abcde"), 6, 0, SV(""), S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), S("can't happen"));
+ test(S("abcdefghij"), 0, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV(""), S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), S("12345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), S("1234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 5, SV(""), S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), S("12345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), S("1234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), S("12345678901234567890fghij"));
+ test(S("abcdefghij"), 0, 9, SV(""), S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), S("12345j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), S("1234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), S("12345678901234567890j"));
+ test(S("abcdefghij"), 0, 10, SV(""), S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345"), S("12345"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), S("1234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcdefghij"), 0, 11, SV(""), S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345"), S("12345"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), S("1234567890"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcdefghij"), 1, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 1, SV(""), S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), S("a12345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), S("a1234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghij"));
+ test(S("abcdefghij"), 1, 4, SV(""), S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), S("a12345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), S("a1234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890fghij"));
+ test(S("abcdefghij"), 1, 8, SV(""), S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), S("a12345j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), S("a1234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), S("a12345678901234567890j"));
+ test(S("abcdefghij"), 1, 9, SV(""), S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), S("a12345"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), S("a1234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890"));
+ test(S("abcdefghij"), 1, 10, SV(""), S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), S("a12345"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), S("a1234567890"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), S("a12345678901234567890"));
+ test(S("abcdefghij"), 5, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890fghij"));
+ test(S("abcdefghij"), 5, 1, SV(""), S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), S("abcde12345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), S("abcde1234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890ghij"));
+ test(S("abcdefghij"), 5, 2, SV(""), S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), S("abcde12345hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), S("abcde1234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), S("abcde12345678901234567890hij"));
+ test(S("abcdefghij"), 5, 4, SV(""), S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), S("abcde12345j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), S("abcde1234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), S("abcde12345678901234567890j"));
+ test(S("abcdefghij"), 5, 5, SV(""), S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), S("abcde12345"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), S("abcde12345678901234567890"));
+ test(S("abcdefghij"), 5, 6, SV(""), S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), S("abcde12345"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), S("abcde12345678901234567890"));
+ test(S("abcdefghij"), 9, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), S("abcdefghi12345678901234567890j"));
+ test(S("abcdefghij"), 9, 1, SV(""), S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
+ test(S("abcdefghij"), 9, 2, SV(""), S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
+ test(S("abcdefghij"), 10, 0, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 10, 1, SV(""), S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 11, 0, SV(""), S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), S("can't happen"));
+}
+
+template <class S, class SV>
+void test2()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), S("12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), S("1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), S("12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), S("1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), S("12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), S("12345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), S("1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), S("12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), S("12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), S("a12345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), S("a1234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), S("a12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), S("a1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), S("a12345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), S("a1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), S("a12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), S("a12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), S("a12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), S("abcdefghij12345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), S("abcdefghij1234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), S("abcdefghij12345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), S("abcdefghij1234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), S("abcdefghij12345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), S("abcdefghij1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), S("abcdefghij12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), S("can't happen"));
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::string_view SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ }
+#endif
+}
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 88c1bee32512..73727198f28e 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
@@ -68,7 +68,7 @@ int main()
{
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
#if TEST_STD_VER >= 14
- // In c++14, if POCS is set, swapping the allocator is required not to throw
+ // In C++14, if POCS is set, swapping the allocator is required not to throw
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
index bc2bf656db01..94f7890ddfdb 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
@@ -45,7 +45,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
{
try
{
- s.compare(pos1, n1, sv, pos2, n2);
+ TEST_IGNORE_NODISCARD s.compare(pos1, n1, sv, pos2, n2);
assert(false);
}
catch (const std::out_of_range&)
@@ -69,7 +69,7 @@ test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1,
{
try
{
- s.compare(pos1, n1, sv, pos2);
+ TEST_IGNORE_NODISCARD s.compare(pos1, n1, sv, pos2);
assert(false);
}
catch (const std::out_of_range&)
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 13f6c5a1cd7a..55af081a7261 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
@@ -40,7 +40,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
{
try
{
- s.compare(pos1, n1, str);
+ TEST_IGNORE_NODISCARD s.compare(pos1, n1, str);
assert(false);
}
catch (std::out_of_range&)
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 fc811c84671b..2fcecc7556a1 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
@@ -40,7 +40,7 @@ test(const S& s, typename S::size_type pos, typename S::size_type n1,
{
try
{
- s.compare(pos, n1, str, n2);
+ TEST_IGNORE_NODISCARD s.compare(pos, n1, str, n2);
assert(false);
}
catch (std::out_of_range&)
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 b3d7da29fb1f..0ddbf2e2f99f 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
@@ -40,7 +40,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
{
try
{
- s.compare(pos1, n1, str);
+ TEST_IGNORE_NODISCARD s.compare(pos1, n1, str);
assert(false);
}
catch (std::out_of_range&)
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 42bba9d5eb2b..590a1518812f 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
@@ -42,7 +42,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
{
try
{
- s.compare(pos1, n1, str, pos2, n2);
+ TEST_IGNORE_NODISCARD s.compare(pos1, n1, str, pos2, n2);
assert(false);
}
catch (const std::out_of_range&)
@@ -65,7 +65,7 @@ test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1,
{
try
{
- s.compare(pos1, n1, str, pos2);
+ TEST_IGNORE_NODISCARD s.compare(pos1, n1, str, pos2);
assert(false);
}
catch (const std::out_of_range&)
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp
index 6a5ba22cdc8d..53114f37c0e8 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp
@@ -40,7 +40,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
{
try
{
- s.compare(pos1, n1, sv);
+ TEST_IGNORE_NODISCARD s.compare(pos1, n1, sv);
assert(false);
}
catch (std::out_of_range&)
diff --git a/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp
index 59d216df09b4..7e46ff74a9ec 100644
--- a/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp
@@ -150,8 +150,8 @@ int main()
}
#if TEST_STD_VER >= 11
{
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
- typedef std::string_view SV;
+// typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+// typedef std::string_view SV;
// test0<S, SV>();
// test1<S, SV>();
}
diff --git a/test/std/strings/basic.string/string.starts_with/starts_with.char.pass.cpp b/test/std/strings/basic.string/string.starts_with/starts_with.char.pass.cpp
new file mode 100644
index 000000000000..4be35a76596c
--- /dev/null
+++ b/test/std/strings/basic.string/string.starts_with/starts_with.char.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, c++14, c++17
+
+// <string>
+
+// bool starts_with(charT x) const noexcept;
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ typedef std::string S;
+ S s1 {};
+ S s2 { "abcde", 5 };
+
+ ASSERT_NOEXCEPT(s1.starts_with('e'));
+
+ assert (!s1.starts_with('a'));
+ assert (!s1.starts_with('x'));
+ assert ( s2.starts_with('a'));
+ assert (!s2.starts_with('x'));
+ }
+}
diff --git a/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp b/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp
new file mode 100644
index 000000000000..5dec2156ed0a
--- /dev/null
+++ b/test/std/strings/basic.string/string.starts_with/starts_with.ptr.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, c++14, c++17
+
+// <string>
+
+// bool starts_with(const CharT *x) const;
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ typedef std::string S;
+ const char *s = "abcde";
+ S s0 {};
+ S s1 { s, 1 };
+ S s2 { s, 2 };
+// S s3 { s, 3 };
+// S s4 { s, 4 };
+// S s5 { s, 5 };
+ S sNot {"def", 3 };
+
+ LIBCPP_ASSERT_NOEXCEPT(s0.starts_with(""));
+
+ assert ( s0.starts_with(""));
+ assert (!s0.starts_with("a"));
+
+ assert ( s1.starts_with(""));
+ assert ( s1.starts_with("a"));
+ assert (!s1.starts_with("ab"));
+ assert (!s1.starts_with("abc"));
+ assert (!s1.starts_with("abcd"));
+ assert (!s1.starts_with("abcde"));
+ assert (!s1.starts_with("def"));
+
+ assert ( s2.starts_with(""));
+ assert ( s2.starts_with("a"));
+ assert ( s2.starts_with("ab"));
+ assert (!s2.starts_with("abc"));
+ assert (!s2.starts_with("abcd"));
+ assert (!s2.starts_with("abcde"));
+ assert (!s2.starts_with("def"));
+
+ assert ( sNot.starts_with(""));
+ assert (!sNot.starts_with("a"));
+ assert (!sNot.starts_with("ab"));
+ assert (!sNot.starts_with("abc"));
+ assert (!sNot.starts_with("abcd"));
+ assert (!sNot.starts_with("abcde"));
+ assert ( sNot.starts_with("def"));
+ }
+}
diff --git a/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp b/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp
new file mode 100644
index 000000000000..d542d3d79e13
--- /dev/null
+++ b/test/std/strings/basic.string/string.starts_with/starts_with.string_view.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, c++11, c++14, c++17
+
+// <string>
+
+// bool starts_with(string_view x) const noexcept;
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ const char *s = "abcde";
+
+ S s0;
+ S s1 { s, 1 };
+ S s2 { s, 2 };
+// S s3 { s, 3 };
+// S s4 { s, 4 };
+// S s5 { s, 5 };
+ S sNot { "def", 3 };
+
+ SV sv0;
+ SV sv1 { s, 1 };
+ SV sv2 { s, 2 };
+ SV sv3 { s, 3 };
+ SV sv4 { s, 4 };
+ SV sv5 { s, 5 };
+ SV svNot {"def", 3 };
+
+ ASSERT_NOEXCEPT(s0.starts_with(sv0));
+
+ assert ( s0.starts_with(sv0));
+ assert (!s0.starts_with(sv1));
+
+ assert ( s1.starts_with(sv0));
+ assert ( s1.starts_with(sv1));
+ assert (!s1.starts_with(sv2));
+ assert (!s1.starts_with(sv3));
+ assert (!s1.starts_with(sv4));
+ assert (!s1.starts_with(sv5));
+ assert (!s1.starts_with(svNot));
+
+ assert ( s2.starts_with(sv0));
+ assert ( s2.starts_with(sv1));
+ assert ( s2.starts_with(sv2));
+ assert (!s2.starts_with(sv3));
+ assert (!s2.starts_with(sv4));
+ assert (!s2.starts_with(sv5));
+ assert (!s2.starts_with(svNot));
+
+ assert ( sNot.starts_with(sv0));
+ assert (!sNot.starts_with(sv1));
+ assert (!sNot.starts_with(sv2));
+ assert (!sNot.starts_with(sv3));
+ assert (!sNot.starts_with(sv4));
+ assert (!sNot.starts_with(sv5));
+ assert ( sNot.starts_with(svNot));
+ }
+}
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 9b552347fe9e..4cf2b0adce02 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,16 +18,16 @@
int main()
{
- assert( std::char_traits<char>::lt('\0', 'A'));
- assert(!std::char_traits<char>::lt('A', '\0'));
+ 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', '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', 'z'));
+ assert( std::char_traits<char>::lt('A', 'Z'));
- assert( std::char_traits<char>::lt(' ', 'A'));
- assert( std::char_traits<char>::lt('A', '~'));
+ assert( std::char_traits<char>::lt(' ', 'A'));
+ assert( std::char_traits<char>::lt('A', '~'));
}
diff --git a/test/std/strings/string.view/string.view.access/at.pass.cpp b/test/std/strings/string.view/string.view.access/at.pass.cpp
index 6df879898f44..7d5cf241e66b 100644
--- a/test/std/strings/string.view/string.view.access/at.pass.cpp
+++ b/test/std/strings/string.view/string.view.access/at.pass.cpp
@@ -32,7 +32,7 @@ void test ( const CharT *s, size_t len ) {
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- try { sv.at(len); } catch ( const std::out_of_range & ) { return ; }
+ try { (void)sv.at(len); } catch ( const std::out_of_range & ) { return ; }
assert ( false );
#endif
}
diff --git a/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp b/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp
index d36c27886295..bb733c4fb13d 100644
--- a/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp
+++ b/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp
@@ -35,6 +35,10 @@ void test1 () {
{
SV sv1;
+ ASSERT_NOEXCEPT(sv1.size());
+ ASSERT_NOEXCEPT(sv1.empty());
+ ASSERT_NOEXCEPT(sv1.max_size());
+ ASSERT_NOEXCEPT(sv1.length());
assert ( sv1.size() == 0 );
assert ( sv1.empty());
assert ( sv1.size() == sv1.length());
diff --git a/test/std/strings/string.view/string.view.capacity/empty.fail.cpp b/test/std/strings/string.view/string.view.capacity/empty.fail.cpp
new file mode 100644
index 000000000000..da1a67b0844d
--- /dev/null
+++ b/test/std/strings/string.view/string.view.capacity/empty.fail.cpp
@@ -0,0 +1,28 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// class string_view
+
+// bool empty() const noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <string_view>
+
+#include "test_macros.h"
+
+int main ()
+{
+ std::string_view c;
+ c.empty(); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/strings/string.view/string.view.cons/default.pass.cpp b/test/std/strings/string.view/string.view.cons/default.pass.cpp
index ca332801ead9..79fadf619f25 100644
--- a/test/std/strings/string.view/string.view.cons/default.pass.cpp
+++ b/test/std/strings/string.view/string.view.cons/default.pass.cpp
@@ -21,6 +21,8 @@ template<typename T>
void test () {
#if TEST_STD_VER > 11
{
+ ASSERT_NOEXCEPT(T());
+
constexpr T sv1;
static_assert ( sv1.size() == 0, "" );
static_assert ( sv1.empty(), "");
diff --git a/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp b/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
index 6c9939340ce2..c98a8bd674b4 100644
--- a/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
+++ b/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
@@ -30,7 +30,11 @@ size_t StrLen ( const CharT *s ) {
template<typename CharT>
void test ( const CharT *s ) {
- std::basic_string_view<CharT> sv1 ( s );
+ typedef std::basic_string_view<CharT> SV;
+// I'd love to do this, but it would require traits::length() to be noexcept
+// LIBCPP_ASSERT_NOEXCEPT(SV(s));
+
+ SV sv1 ( s );
assert ( sv1.size() == StrLen( s ));
assert ( sv1.data() == s );
}
diff --git a/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp b/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
index da4d264ae371..2e4faab95005 100644
--- a/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
+++ b/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
@@ -23,7 +23,10 @@
template<typename CharT>
void test ( const CharT *s, size_t sz ) {
{
- std::basic_string_view<CharT> sv1 ( s, sz );
+ typedef std::basic_string_view<CharT> SV;
+ LIBCPP_ASSERT_NOEXCEPT(SV(s, sz));
+
+ SV sv1 ( s, sz );
assert ( sv1.size() == sz );
assert ( sv1.data() == s );
}
diff --git a/test/std/strings/string.view/string.view.cons/from_string.pass.cpp b/test/std/strings/string.view/string.view.cons/from_string.pass.cpp
index 3ca6ea16f5b8..5fad2bfaab14 100644
--- a/test/std/strings/string.view/string.view.cons/from_string.pass.cpp
+++ b/test/std/strings/string.view/string.view.cons/from_string.pass.cpp
@@ -24,7 +24,10 @@ struct dummy_char_traits : public std::char_traits<char> {};
template<typename CharT, typename Traits>
void test ( const std::basic_string<CharT, Traits> &str ) {
- std::basic_string_view<CharT, Traits> sv1 ( str );
+ typedef std::basic_string_view<CharT, Traits> SV;
+ ASSERT_NOEXCEPT(SV(str));
+
+ SV sv1 ( str );
assert ( sv1.size() == str.size());
assert ( sv1.data() == str.data());
}
diff --git a/test/std/strings/string.view/string.view.cons/from_string1.fail.cpp b/test/std/strings/string.view/string.view.cons/from_string1.fail.cpp
index 0f33dd87bca0..006bea7498ac 100644
--- a/test/std/strings/string.view/string.view.cons/from_string1.fail.cpp
+++ b/test/std/strings/string.view/string.view.cons/from_string1.fail.cpp
@@ -29,4 +29,4 @@ int main () {
assert ( sv1.size() == s.size());
assert ( sv1.data() == s.data());
}
-} \ No newline at end of file
+}
diff --git a/test/std/strings/string.view/string.view.template/ends_with.char.pass.cpp b/test/std/strings/string.view/string.view.template/ends_with.char.pass.cpp
new file mode 100644
index 000000000000..1511f014b18d
--- /dev/null
+++ b/test/std/strings/string.view/string.view.template/ends_with.char.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, c++11, c++14, c++17
+
+// <string_view>
+
+// constexpr bool ends_with(charT x) const noexcept;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int main()
+{
+ {
+ typedef std::string_view SV;
+ SV sv1 {};
+ SV sv2 { "abcde", 5 };
+
+ ASSERT_NOEXCEPT(sv1.ends_with('e'));
+
+ assert (!sv1.ends_with('e'));
+ assert (!sv1.ends_with('x'));
+ assert ( sv2.ends_with('e'));
+ assert (!sv2.ends_with('x'));
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1 {};
+ constexpr SV sv2 { "abcde", 5 };
+ static_assert (!sv1.ends_with('e'), "" );
+ static_assert (!sv1.ends_with('x'), "" );
+ static_assert ( sv2.ends_with('e'), "" );
+ static_assert (!sv2.ends_with('x'), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.template/ends_with.ptr.pass.cpp b/test/std/strings/string.view/string.view.template/ends_with.ptr.pass.cpp
new file mode 100644
index 000000000000..544cddd84076
--- /dev/null
+++ b/test/std/strings/string.view/string.view.template/ends_with.ptr.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, c++11, c++14, c++17
+
+// <string_view>
+
+// constexpr bool starts_with(const CharT *x) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int main()
+{
+ {
+ typedef std::string_view SV;
+ const char *s = "abcde";
+ SV sv0 {};
+ SV sv1 { s + 4, 1 };
+ SV sv2 { s + 3, 2 };
+// SV sv3 { s + 2, 3 };
+// SV sv4 { s + 1, 4 };
+// SV sv5 { s , 5 };
+ SV svNot {"def", 3 };
+
+ LIBCPP_ASSERT_NOEXCEPT(sv0.ends_with(""));
+
+ assert ( sv0.ends_with(""));
+ assert (!sv0.ends_with("e"));
+
+ assert ( sv1.ends_with(""));
+ assert ( sv1.ends_with("e"));
+ assert (!sv1.ends_with("de"));
+ assert (!sv1.ends_with("cde"));
+ assert (!sv1.ends_with("bcde"));
+ assert (!sv1.ends_with("abcde"));
+ assert (!sv1.ends_with("def"));
+
+ assert ( sv2.ends_with(""));
+ assert ( sv2.ends_with("e"));
+ assert ( sv2.ends_with("de"));
+ assert (!sv2.ends_with("cde"));
+ assert (!sv2.ends_with("bcde"));
+ assert (!sv2.ends_with("abcde"));
+ assert (!sv2.ends_with("def"));
+
+ assert ( svNot.ends_with(""));
+ assert (!svNot.ends_with("e"));
+ assert (!svNot.ends_with("de"));
+ assert (!svNot.ends_with("cde"));
+ assert (!svNot.ends_with("bcde"));
+ assert (!svNot.ends_with("abcde"));
+ assert ( svNot.ends_with("def"));
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr const char *s = "abcde";
+ constexpr SV sv0 {};
+ constexpr SV sv1 { s + 4, 1 };
+ constexpr SV sv2 { s + 3, 2 };
+// constexpr SV sv3 { s + 2, 3 };
+// constexpr SV sv4 { s + 1, 4 };
+// constexpr SV sv5 { s, 5 };
+ constexpr SV svNot {"def", 3 };
+
+ static_assert ( sv0.ends_with(""), "" );
+ static_assert (!sv0.ends_with("e"), "" );
+
+ static_assert ( sv1.ends_with(""), "" );
+ static_assert ( sv1.ends_with("e"), "" );
+ static_assert (!sv1.ends_with("de"), "" );
+ static_assert (!sv1.ends_with("cde"), "" );
+ static_assert (!sv1.ends_with("bcde"), "" );
+ static_assert (!sv1.ends_with("abcde"), "" );
+ static_assert (!sv1.ends_with("def"), "" );
+
+ static_assert ( sv2.ends_with(""), "" );
+ static_assert ( sv2.ends_with("e"), "" );
+ static_assert ( sv2.ends_with("de"), "" );
+ static_assert (!sv2.ends_with("cde"), "" );
+ static_assert (!sv2.ends_with("bcde"), "" );
+ static_assert (!sv2.ends_with("abcde"), "" );
+ static_assert (!sv2.ends_with("def"), "" );
+
+ static_assert ( svNot.ends_with(""), "" );
+ static_assert (!svNot.ends_with("e"), "" );
+ static_assert (!svNot.ends_with("de"), "" );
+ static_assert (!svNot.ends_with("cde"), "" );
+ static_assert (!svNot.ends_with("bcde"), "" );
+ static_assert (!svNot.ends_with("abcde"), "" );
+ static_assert ( svNot.ends_with("def"), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.template/ends_with.string_view.pass.cpp b/test/std/strings/string.view/string.view.template/ends_with.string_view.pass.cpp
new file mode 100644
index 000000000000..61ea807ba37e
--- /dev/null
+++ b/test/std/strings/string.view/string.view.template/ends_with.string_view.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, c++11, c++14, c++17
+
+// <string_view>
+
+// constexpr bool ends_with(string_view x) const noexcept;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int main()
+{
+ {
+ typedef std::string_view SV;
+ const char *s = "abcde";
+ SV sv0;
+ SV sv1 { s + 4, 1 };
+ SV sv2 { s + 3, 2 };
+ SV sv3 { s + 2, 3 };
+ SV sv4 { s + 1, 4 };
+ SV sv5 { s , 5 };
+ SV svNot {"def", 3 };
+
+ ASSERT_NOEXCEPT(sv0.ends_with(sv0));
+
+ assert ( sv0.ends_with(sv0));
+ assert (!sv0.ends_with(sv1));
+
+ assert ( sv1.ends_with(sv0));
+ assert ( sv1.ends_with(sv1));
+ assert (!sv1.ends_with(sv2));
+ assert (!sv1.ends_with(sv3));
+ assert (!sv1.ends_with(sv4));
+ assert (!sv1.ends_with(sv5));
+ assert (!sv1.ends_with(svNot));
+
+ assert ( sv2.ends_with(sv0));
+ assert ( sv2.ends_with(sv1));
+ assert ( sv2.ends_with(sv2));
+ assert (!sv2.ends_with(sv3));
+ assert (!sv2.ends_with(sv4));
+ assert (!sv2.ends_with(sv5));
+ assert (!sv2.ends_with(svNot));
+
+ assert ( svNot.ends_with(sv0));
+ assert (!svNot.ends_with(sv1));
+ assert (!svNot.ends_with(sv2));
+ assert (!svNot.ends_with(sv3));
+ assert (!svNot.ends_with(sv4));
+ assert (!svNot.ends_with(sv5));
+ assert ( svNot.ends_with(svNot));
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr const char *s = "abcde";
+ constexpr SV sv0 {};
+ constexpr SV sv1 { s + 4, 1 };
+ constexpr SV sv2 { s + 3, 2 };
+ constexpr SV sv3 { s + 2, 3 };
+ constexpr SV sv4 { s + 1, 4 };
+ constexpr SV sv5 { s, 5 };
+ constexpr SV svNot {"def", 3 };
+
+ static_assert ( sv0.ends_with(sv0), "" );
+ static_assert (!sv0.ends_with(sv1), "" );
+
+ static_assert ( sv1.ends_with(sv0), "" );
+ static_assert ( sv1.ends_with(sv1), "" );
+ static_assert (!sv1.ends_with(sv2), "" );
+ static_assert (!sv1.ends_with(sv3), "" );
+ static_assert (!sv1.ends_with(sv4), "" );
+ static_assert (!sv1.ends_with(sv5), "" );
+ static_assert (!sv1.ends_with(svNot), "" );
+
+ static_assert ( sv2.ends_with(sv0), "" );
+ static_assert ( sv2.ends_with(sv1), "" );
+ static_assert ( sv2.ends_with(sv2), "" );
+ static_assert (!sv2.ends_with(sv3), "" );
+ static_assert (!sv2.ends_with(sv4), "" );
+ static_assert (!sv2.ends_with(sv5), "" );
+ static_assert (!sv2.ends_with(svNot), "" );
+
+ static_assert ( svNot.ends_with(sv0), "" );
+ static_assert (!svNot.ends_with(sv1), "" );
+ static_assert (!svNot.ends_with(sv2), "" );
+ static_assert (!svNot.ends_with(sv3), "" );
+ static_assert (!svNot.ends_with(sv4), "" );
+ static_assert (!svNot.ends_with(sv5), "" );
+ static_assert ( svNot.ends_with(svNot), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.template/starts_with.char.pass.cpp b/test/std/strings/string.view/string.view.template/starts_with.char.pass.cpp
new file mode 100644
index 000000000000..042aea601b8d
--- /dev/null
+++ b/test/std/strings/string.view/string.view.template/starts_with.char.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, c++11, c++14, c++17
+
+// <string_view>
+
+// constexpr bool starts_with(charT x) const noexcept;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int main()
+{
+ {
+ typedef std::string_view SV;
+ SV sv1 {};
+ SV sv2 { "abcde", 5 };
+
+ ASSERT_NOEXCEPT(sv1.starts_with('e'));
+
+ assert (!sv1.starts_with('a'));
+ assert (!sv1.starts_with('x'));
+ assert ( sv2.starts_with('a'));
+ assert (!sv2.starts_with('x'));
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1 {};
+ constexpr SV sv2 { "abcde", 5 };
+ static_assert (!sv1.starts_with('a'), "" );
+ static_assert (!sv1.starts_with('x'), "" );
+ static_assert ( sv2.starts_with('a'), "" );
+ static_assert (!sv2.starts_with('x'), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.template/starts_with.ptr.pass.cpp b/test/std/strings/string.view/string.view.template/starts_with.ptr.pass.cpp
new file mode 100644
index 000000000000..baaa4c973bb1
--- /dev/null
+++ b/test/std/strings/string.view/string.view.template/starts_with.ptr.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, c++11, c++14, c++17
+
+// <string_view>
+
+// constexpr bool starts_with(string_view x) const noexcept;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int main()
+{
+ {
+ typedef std::string_view SV;
+ const char *s = "abcde";
+ SV sv0 {};
+ SV sv1 { s, 1 };
+ SV sv2 { s, 2 };
+// SV sv3 { s, 3 };
+// SV sv4 { s, 4 };
+// SV sv5 { s, 5 };
+ SV svNot {"def", 3 };
+
+ LIBCPP_ASSERT_NOEXCEPT(sv0.starts_with(""));
+
+ assert ( sv0.starts_with(""));
+ assert (!sv0.starts_with("a"));
+
+ assert ( sv1.starts_with(""));
+ assert ( sv1.starts_with("a"));
+ assert (!sv1.starts_with("ab"));
+ assert (!sv1.starts_with("abc"));
+ assert (!sv1.starts_with("abcd"));
+ assert (!sv1.starts_with("abcde"));
+ assert (!sv1.starts_with("def"));
+
+ assert ( sv2.starts_with(s + 5));
+ assert ( sv2.starts_with("a"));
+ assert ( sv2.starts_with("ab"));
+ assert (!sv2.starts_with("abc"));
+ assert (!sv2.starts_with("abcd"));
+ assert (!sv2.starts_with("abcde"));
+ assert (!sv2.starts_with("def"));
+
+ assert ( svNot.starts_with(""));
+ assert (!svNot.starts_with("a"));
+ assert (!svNot.starts_with("ab"));
+ assert (!svNot.starts_with("abc"));
+ assert (!svNot.starts_with("abcd"));
+ assert (!svNot.starts_with("abcde"));
+ assert ( svNot.starts_with("def"));
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr const char *s = "abcde";
+ constexpr SV sv0 {};
+ constexpr SV sv1 { s, 1 };
+ constexpr SV sv2 { s, 2 };
+// constexpr SV sv3 { s, 3 };
+// constexpr SV sv4 { s, 4 };
+// constexpr SV sv5 { s, 5 };
+ constexpr SV svNot {"def", 3 };
+
+ static_assert ( sv0.starts_with(""), "" );
+ static_assert (!sv0.starts_with("a"), "" );
+
+ static_assert ( sv1.starts_with(""), "" );
+ static_assert ( sv1.starts_with("a"), "" );
+ static_assert (!sv1.starts_with("ab"), "" );
+ static_assert (!sv1.starts_with("abc"), "" );
+ static_assert (!sv1.starts_with("abcd"), "" );
+ static_assert (!sv1.starts_with("abcde"), "" );
+ static_assert (!sv1.starts_with("def"), "" );
+
+ static_assert ( sv2.starts_with(s + 5), "" );
+ static_assert ( sv2.starts_with("a"), "" );
+ static_assert ( sv2.starts_with("ab"), "" );
+ static_assert (!sv2.starts_with("abc"), "" );
+ static_assert (!sv2.starts_with("abcd"), "" );
+ static_assert (!sv2.starts_with("abcde"), "" );
+ static_assert (!sv2.starts_with("def"), "" );
+
+ static_assert ( svNot.starts_with(""), "" );
+ static_assert (!svNot.starts_with("a"), "" );
+ static_assert (!svNot.starts_with("ab"), "" );
+ static_assert (!svNot.starts_with("abc"), "" );
+ static_assert (!svNot.starts_with("abcd"), "" );
+ static_assert (!svNot.starts_with("abcde"), "" );
+ static_assert ( svNot.starts_with("def"), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.template/starts_with.string_view.pass.cpp b/test/std/strings/string.view/string.view.template/starts_with.string_view.pass.cpp
new file mode 100644
index 000000000000..7501926af4d9
--- /dev/null
+++ b/test/std/strings/string.view/string.view.template/starts_with.string_view.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, c++11, c++14, c++17
+
+// <string_view>
+
+// constexpr bool starts_with(string_view x) const noexcept;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int main()
+{
+ {
+ typedef std::string_view SV;
+ const char *s = "abcde";
+ SV sv0 {};
+ SV sv1 { s, 1 };
+ SV sv2 { s, 2 };
+ SV sv3 { s, 3 };
+ SV sv4 { s, 4 };
+ SV sv5 { s, 5 };
+ SV svNot {"def", 3 };
+
+ ASSERT_NOEXCEPT(sv0.starts_with(sv0));
+
+ assert ( sv0.starts_with(sv0));
+ assert (!sv0.starts_with(sv1));
+
+ assert ( sv1.starts_with(sv0));
+ assert ( sv1.starts_with(sv1));
+ assert (!sv1.starts_with(sv2));
+ assert (!sv1.starts_with(sv3));
+ assert (!sv1.starts_with(sv4));
+ assert (!sv1.starts_with(sv5));
+ assert (!sv1.starts_with(svNot));
+
+ assert ( sv2.starts_with(sv0));
+ assert ( sv2.starts_with(sv1));
+ assert ( sv2.starts_with(sv2));
+ assert (!sv2.starts_with(sv3));
+ assert (!sv2.starts_with(sv4));
+ assert (!sv2.starts_with(sv5));
+ assert (!sv2.starts_with(svNot));
+
+ assert ( svNot.starts_with(sv0));
+ assert (!svNot.starts_with(sv1));
+ assert (!svNot.starts_with(sv2));
+ assert (!svNot.starts_with(sv3));
+ assert (!svNot.starts_with(sv4));
+ assert (!svNot.starts_with(sv5));
+ assert ( svNot.starts_with(svNot));
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr const char *s = "abcde";
+ constexpr SV sv0 {};
+ constexpr SV sv1 { s, 1 };
+ constexpr SV sv2 { s, 2 };
+ constexpr SV sv3 { s, 3 };
+ constexpr SV sv4 { s, 4 };
+ constexpr SV sv5 { s, 5 };
+ constexpr SV svNot {"def", 3 };
+
+ static_assert ( sv0.starts_with(sv0), "" );
+ static_assert (!sv0.starts_with(sv1), "" );
+
+ static_assert ( sv1.starts_with(sv0), "" );
+ static_assert ( sv1.starts_with(sv1), "" );
+ static_assert (!sv1.starts_with(sv2), "" );
+ static_assert (!sv1.starts_with(sv3), "" );
+ static_assert (!sv1.starts_with(sv4), "" );
+ static_assert (!sv1.starts_with(sv5), "" );
+ static_assert (!sv1.starts_with(svNot), "" );
+
+ static_assert ( sv2.starts_with(sv0), "" );
+ static_assert ( sv2.starts_with(sv1), "" );
+ static_assert ( sv2.starts_with(sv2), "" );
+ static_assert (!sv2.starts_with(sv3), "" );
+ static_assert (!sv2.starts_with(sv4), "" );
+ static_assert (!sv2.starts_with(sv5), "" );
+ static_assert (!sv2.starts_with(svNot), "" );
+
+ static_assert ( svNot.starts_with(sv0), "" );
+ static_assert (!svNot.starts_with(sv1), "" );
+ static_assert (!svNot.starts_with(sv2), "" );
+ static_assert (!svNot.starts_with(sv3), "" );
+ static_assert (!svNot.starts_with(sv4), "" );
+ static_assert (!svNot.starts_with(sv5), "" );
+ static_assert ( svNot.starts_with(svNot), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string_view.literals/literal.pass.cpp b/test/std/strings/string.view/string_view.literals/literal.pass.cpp
index 710009cc51ee..79fe355289d1 100644
--- a/test/std/strings/string.view/string_view.literals/literal.pass.cpp
+++ b/test/std/strings/string.view/string_view.literals/literal.pass.cpp
@@ -54,4 +54,10 @@ int main()
static_assert( L"ABC"sv.size() == 3, "");
static_assert( u"ABC"sv.size() == 3, "");
static_assert( U"ABC"sv.size() == 3, "");
+
+ static_assert(noexcept( "ABC"sv), "");
+ static_assert(noexcept(u8"ABC"sv), "");
+ static_assert(noexcept( L"ABC"sv), "");
+ static_assert(noexcept( u"ABC"sv), "");
+ static_assert(noexcept( U"ABC"sv), "");
}
diff --git a/test/std/thread/futures/futures.async/async.fail.cpp b/test/std/thread/futures/futures.async/async.fail.cpp
new file mode 100644
index 000000000000..594c67f52699
--- /dev/null
+++ b/test/std/thread/futures/futures.async/async.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: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+// <future>
+
+// template <class F, class... Args>
+// future<typename result_of<F(Args...)>::type>
+// async(F&& f, Args&&... args);
+
+// template <class F, class... Args>
+// 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"
+
+int foo (int x) { return x; }
+
+int main ()
+{
+ std::async( foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::async(std::launch::async, foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+} \ No newline at end of file
diff --git a/test/std/thread/futures/futures.async/async_race.pass.cpp b/test/std/thread/futures/futures.async/async_race.pass.cpp
index 9acdd1abc485..1189f3550b72 100644
--- a/test/std/thread/futures/futures.async/async_race.pass.cpp
+++ b/test/std/thread/futures/futures.async/async_race.pass.cpp
@@ -21,7 +21,7 @@
// async(launch policy, F&& f, Args&&... args);
// This test is designed to cause and allow TSAN to detect the race condition
-// reported in PR23293. (http://llvm.org/PR23293).
+// reported in PR23293: https://bugs.llvm.org/show_bug.cgi?id=23293
#include <future>
#include <chrono>
diff --git a/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp b/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
index 9cdc2e431f45..0ddbd0b08936 100644
--- a/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
@@ -1,130 +1,130 @@
- //===----------------------------------------------------------------------===//
- //
- // The LLVM Compiler Infrastructure
- //
- // This file is dual licensed under the MIT and the University of Illinois Open
- // Source Licenses. See LICENSE.TXT for details.
- //
- //===----------------------------------------------------------------------===//
- //
- // UNSUPPORTED: libcpp-has-no-threads
- // UNSUPPORTED: c++98, c++03
-
- // <future>
-
- // class shared_future<R>
-
- // template <class Clock, class Duration>
- // future_status
- // wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
-
- #include <future>
- #include <atomic>
- #include <cassert>
-
- enum class WorkerThreadState { Uninitialized, AllowedToRun, Exiting };
- typedef std::chrono::milliseconds ms;
-
- std::atomic<WorkerThreadState> thread_state(WorkerThreadState::Uninitialized);
-
- void set_worker_thread_state(WorkerThreadState state)
- {
- thread_state.store(state, std::memory_order_relaxed);
- }
-
- void wait_for_worker_thread_state(WorkerThreadState state)
- {
- while (thread_state.load(std::memory_order_relaxed) != state);
- }
-
- void func1(std::promise<int> p)
- {
- wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
- p.set_value(3);
- set_worker_thread_state(WorkerThreadState::Exiting);
- }
-
- int j = 0;
-
- void func3(std::promise<int&> p)
- {
- wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
- j = 5;
- p.set_value(j);
- set_worker_thread_state(WorkerThreadState::Exiting);
- }
-
- void func5(std::promise<void> p)
- {
- wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
- p.set_value();
- set_worker_thread_state(WorkerThreadState::Exiting);
- }
-
- int main()
- {
- typedef std::chrono::high_resolution_clock Clock;
- {
- typedef int T;
- std::promise<T> p;
- std::shared_future<T> f = p.get_future();
- std::thread(func1, std::move(p)).detach();
- assert(f.valid());
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
- assert(f.valid());
-
- // allow the worker thread to produce the result and wait until the worker is done
- set_worker_thread_state(WorkerThreadState::AllowedToRun);
- wait_for_worker_thread_state(WorkerThreadState::Exiting);
-
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
- assert(f.valid());
- Clock::time_point t0 = Clock::now();
- f.wait();
- Clock::time_point t1 = Clock::now();
- assert(f.valid());
- assert(t1-t0 < ms(5));
- }
- {
- typedef int& T;
- std::promise<T> p;
- std::shared_future<T> f = p.get_future();
- std::thread(func3, std::move(p)).detach();
- assert(f.valid());
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
- assert(f.valid());
-
- // allow the worker thread to produce the result and wait until the worker is done
- set_worker_thread_state(WorkerThreadState::AllowedToRun);
- wait_for_worker_thread_state(WorkerThreadState::Exiting);
-
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
- assert(f.valid());
- Clock::time_point t0 = Clock::now();
- f.wait();
- Clock::time_point t1 = Clock::now();
- assert(f.valid());
- assert(t1-t0 < ms(5));
- }
- {
- typedef void T;
- std::promise<T> p;
- std::shared_future<T> f = p.get_future();
- std::thread(func5, std::move(p)).detach();
- assert(f.valid());
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
- assert(f.valid());
-
- // allow the worker thread to produce the result and wait until the worker is done
- set_worker_thread_state(WorkerThreadState::AllowedToRun);
- wait_for_worker_thread_state(WorkerThreadState::Exiting);
-
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
- assert(f.valid());
- Clock::time_point t0 = Clock::now();
- f.wait();
- Clock::time_point t1 = Clock::now();
- assert(f.valid());
- assert(t1-t0 < ms(5));
- }
- }
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// <future>
+
+// class shared_future<R>
+
+// template <class Clock, class Duration>
+// future_status
+// wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
+
+#include <future>
+#include <atomic>
+#include <cassert>
+
+enum class WorkerThreadState { Uninitialized, AllowedToRun, Exiting };
+typedef std::chrono::milliseconds ms;
+
+std::atomic<WorkerThreadState> thread_state(WorkerThreadState::Uninitialized);
+
+void set_worker_thread_state(WorkerThreadState state)
+{
+ thread_state.store(state, std::memory_order_relaxed);
+}
+
+void wait_for_worker_thread_state(WorkerThreadState state)
+{
+ while (thread_state.load(std::memory_order_relaxed) != state);
+}
+
+void func1(std::promise<int> p)
+{
+ wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
+ p.set_value(3);
+ set_worker_thread_state(WorkerThreadState::Exiting);
+}
+
+int j = 0;
+
+void func3(std::promise<int&> p)
+{
+ wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
+ j = 5;
+ p.set_value(j);
+ set_worker_thread_state(WorkerThreadState::Exiting);
+}
+
+void func5(std::promise<void> p)
+{
+ wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
+ p.set_value();
+ set_worker_thread_state(WorkerThreadState::Exiting);
+}
+
+int main()
+{
+ typedef std::chrono::high_resolution_clock Clock;
+ {
+ typedef int T;
+ std::promise<T> p;
+ std::shared_future<T> f = p.get_future();
+ std::thread(func1, std::move(p)).detach();
+ assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
+ assert(f.valid());
+
+ // allow the worker thread to produce the result and wait until the worker is done
+ set_worker_thread_state(WorkerThreadState::AllowedToRun);
+ wait_for_worker_thread_state(WorkerThreadState::Exiting);
+
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
+ assert(f.valid());
+ Clock::time_point t0 = Clock::now();
+ f.wait();
+ Clock::time_point t1 = Clock::now();
+ assert(f.valid());
+ assert(t1-t0 < ms(5));
+ }
+ {
+ typedef int& T;
+ std::promise<T> p;
+ std::shared_future<T> f = p.get_future();
+ std::thread(func3, std::move(p)).detach();
+ assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
+ assert(f.valid());
+
+ // allow the worker thread to produce the result and wait until the worker is done
+ set_worker_thread_state(WorkerThreadState::AllowedToRun);
+ wait_for_worker_thread_state(WorkerThreadState::Exiting);
+
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
+ assert(f.valid());
+ Clock::time_point t0 = Clock::now();
+ f.wait();
+ Clock::time_point t1 = Clock::now();
+ assert(f.valid());
+ assert(t1-t0 < ms(5));
+ }
+ {
+ typedef void T;
+ std::promise<T> p;
+ std::shared_future<T> f = p.get_future();
+ std::thread(func5, std::move(p)).detach();
+ assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
+ assert(f.valid());
+
+ // allow the worker thread to produce the result and wait until the worker is done
+ set_worker_thread_state(WorkerThreadState::AllowedToRun);
+ wait_for_worker_thread_state(WorkerThreadState::Exiting);
+
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
+ assert(f.valid());
+ Clock::time_point t0 = Clock::now();
+ f.wait();
+ Clock::time_point t1 = Clock::now();
+ assert(f.valid());
+ assert(t1-t0 < ms(5));
+ }
+}
diff --git a/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp
index 7cac21d48aef..14b29715ef4f 100644
--- a/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
+// REQUIRES: c++11 || c++14
+// packaged_task allocator support was removed in C++17 (LWG 2921)
// <future>
diff --git a/test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp b/test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp
index bbe75de7f8a9..31ed57e221fc 100644
--- a/test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp
@@ -16,6 +16,8 @@
// XFAIL: c++98, c++03
// <future>
+// REQUIRES: c++11 || c++14
+// packaged_task allocator support was removed in C++17 (LWG 2976)
// class packaged_task<R(ArgTypes...)>
diff --git a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
index 4ad7a3ac2853..0f5f5591f918 100644
--- a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
@@ -102,7 +102,7 @@ int main()
L2 l1;
try
{
- std::try_lock(l0, l1);
+ (void)std::try_lock(l0, l1);
assert(false);
}
catch (int)
@@ -116,7 +116,7 @@ int main()
L0 l1;
try
{
- std::try_lock(l0, l1);
+ (void)std::try_lock(l0, l1);
assert(false);
}
catch (int)
@@ -152,7 +152,7 @@ int main()
L2 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -206,7 +206,7 @@ int main()
L2 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -222,7 +222,7 @@ int main()
L0 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -238,7 +238,7 @@ int main()
L0 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -301,7 +301,7 @@ int main()
L1 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -317,7 +317,7 @@ int main()
L0 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -333,7 +333,7 @@ int main()
L2 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -349,7 +349,7 @@ int main()
L2 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -365,7 +365,7 @@ int main()
L1 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -381,7 +381,7 @@ int main()
L2 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -406,7 +406,7 @@ int main()
L1 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -440,7 +440,7 @@ int main()
L1 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
@@ -456,7 +456,7 @@ int main()
L0 l2;
try
{
- std::try_lock(l0, l1, l2);
+ (void)std::try_lock(l0, l1, l2);
assert(false);
}
catch (int)
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 bd707bb90ce1..ee36e84c0a50 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
@@ -25,8 +25,8 @@ int main()
{
{
typedef std::shared_timed_mutex M;
- M m0;
- M m1;
+ M m0;
+ M m1;
std::shared_lock<M> lk0(m0);
std::shared_lock<M> lk1(m1);
lk1 = std::move(lk0);
@@ -37,8 +37,8 @@ int main()
}
{
typedef nasty_mutex M;
- M m0;
- M m1;
+ M m0;
+ M m1;
std::shared_lock<M> lk0(m0);
std::shared_lock<M> lk1(m1);
lk1 = std::move(lk0);
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
index 947b1ad012ec..06dc11742ffb 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
@@ -44,7 +44,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock();
+ TEST_IGNORE_NODISCARD lk.try_lock();
assert(false);
}
catch (std::system_error& e)
@@ -60,7 +60,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock();
+ TEST_IGNORE_NODISCARD lk.try_lock();
assert(false);
}
catch (std::system_error& e)
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
index 5cb805412563..7feb7139072f 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
@@ -49,7 +49,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock_for(ms(5));
+ TEST_IGNORE_NODISCARD lk.try_lock_for(ms(5));
assert(false);
}
catch (std::system_error& e)
@@ -65,7 +65,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock_for(ms(5));
+ TEST_IGNORE_NODISCARD lk.try_lock_for(ms(5));
assert(false);
}
catch (std::system_error& e)
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
index 3ba4128d719c..836a9ae50b6d 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
@@ -49,7 +49,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock_until(Clock::now());
+ TEST_IGNORE_NODISCARD lk.try_lock_until(Clock::now());
assert(false);
}
catch (std::system_error& e)
@@ -65,7 +65,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock_until(Clock::now());
+ TEST_IGNORE_NODISCARD lk.try_lock_until(Clock::now());
assert(false);
}
catch (std::system_error& e)
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 8d864ea8e7da..4ecd6c0415ca 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
@@ -20,8 +20,8 @@ int main()
{
{
typedef std::mutex M;
- M m0;
- M m1;
+ M m0;
+ M m1;
std::unique_lock<M> lk0(m0);
std::unique_lock<M> lk1(m1);
lk1 = lk0;
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 6f17383298fd..2d5feabf8d29 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
@@ -23,8 +23,8 @@ int main()
{
{
typedef std::mutex M;
- M m0;
- M m1;
+ M m0;
+ M m1;
std::unique_lock<M> lk0(m0);
std::unique_lock<M> lk1(m1);
lk1 = std::move(lk0);
@@ -35,8 +35,8 @@ int main()
}
{
typedef nasty_mutex M;
- M m0;
- M m1;
+ M m0;
+ M m1;
std::unique_lock<M> lk0(m0);
std::unique_lock<M> lk1(m1);
lk1 = std::move(lk0);
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
index ca8bc6982253..dcfdfd11a7e1 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
@@ -54,7 +54,7 @@ int main()
t.join();
#ifdef __cpp_deduction_guides
- std::unique_lock ul(m);
+ std::unique_lock ul(m);
static_assert((std::is_same<decltype(ul), std::unique_lock<decltype(m)>>::value), "" );
#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
index 709c56978af8..3f7bd25a5e84 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
@@ -43,7 +43,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock();
+ TEST_IGNORE_NODISCARD lk.try_lock();
assert(false);
}
catch (std::system_error& e)
@@ -59,7 +59,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock();
+ TEST_IGNORE_NODISCARD lk.try_lock();
assert(false);
}
catch (std::system_error& e)
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
index 6c981787d4b4..b73590441025 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
@@ -48,7 +48,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock_for(ms(5));
+ TEST_IGNORE_NODISCARD lk.try_lock_for(ms(5));
assert(false);
}
catch (std::system_error& e)
@@ -64,7 +64,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock_for(ms(5));
+ TEST_IGNORE_NODISCARD lk.try_lock_for(ms(5));
assert(false);
}
catch (std::system_error& e)
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
index 57231b207a72..c8d0aad6f82f 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
@@ -48,7 +48,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock_until(Clock::now());
+ TEST_IGNORE_NODISCARD lk.try_lock_until(Clock::now());
assert(false);
}
catch (std::system_error& e)
@@ -64,7 +64,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
- lk.try_lock_until(Clock::now());
+ TEST_IGNORE_NODISCARD lk.try_lock_until(Clock::now());
assert(false);
}
catch (std::system_error& e)
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/default.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/default.pass.cpp
index c61a93aa0c7f..3ac901520978 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/default.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/default.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11, c++14
+// 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/lock.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
index 0a6d6e3683ed..efc4d3254a0f 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
index b7edc50978d2..72f74d551aa0 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock.pass.cpp
index 6f3ca24a4558..f22f44c6d19d 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11, c++14
+// 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/try_lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp
index f615981bc94d..d2d486a8b079 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp
index 45cd563f9407..a4e7670e796a 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
index 83979d4c4e51..0e173b0a1672 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
index 516f43192580..753d65d12f89 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock.pass.cpp
index 61900ba83342..fbe3cdcd5350 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
index 3d36911889b1..e562c99e382b 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
index 452fc3c19d65..b5fdbdec32ba 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
index f478a29367a1..69d71bf48153 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
index f33edfc1a534..ba135a95732b 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
index d5715c76f458..559cf8f266c5 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST.
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until_deadlock_bug.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until_deadlock_bug.pass.cpp
index ed288099c979..0caea1d09241 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until_deadlock_bug.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until_deadlock_bug.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// UNSUPPORTED: c++03, c++98, c++11
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
index 21011ed17cd9..62f1b784b7d9 100644
--- a/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
@@ -20,10 +20,12 @@ int main()
{
{
std::once_flag f;
+ (void)f;
}
#if TEST_STD_VER >= 11
{
constexpr std::once_flag f;
+ (void)f;
}
#endif
}
diff --git a/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp b/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
index 9f3941b93adf..6b622029365c 100644
--- a/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
@@ -22,7 +22,6 @@ int main()
{
typedef std::chrono::system_clock Clock;
typedef Clock::time_point time_point;
- typedef Clock::duration duration;
std::chrono::milliseconds ms(500);
time_point t0 = Clock::now();
std::this_thread::sleep_until(t0 + ms);
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.fail.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.fail.cpp
new file mode 100644
index 000000000000..c5244a0d1bbd
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+// <memory>
+
+// template <class OuterAlloc, class... InnerAllocs>
+// class scoped_allocator_adaptor
+
+// pointer allocate(size_type n);
+
+#include <scoped_allocator>
+#include <cassert>
+
+#include "allocators.h"
+
+int main()
+{
+ std::scoped_allocator_adaptor<A1<int>> a;
+ a.allocate(10); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.fail.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.fail.cpp
new file mode 100644
index 000000000000..622147c9cf21
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+// <memory>
+
+// template <class OuterAlloc, class... InnerAllocs>
+// class scoped_allocator_adaptor
+
+// pointer allocate(size_type n, const_void_pointer hint);
+
+#include <scoped_allocator>
+#include <cassert>
+
+#include "allocators.h"
+
+int main()
+{
+ std::scoped_allocator_adaptor<A1<int>> a;
+ a.allocate(10, (const void*)0); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
index 8568c7380b6d..71421464df2b 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
@@ -26,7 +26,7 @@
#include "uses_alloc_types.hpp"
#include "controlled_allocators.hpp"
-// — If uses_allocator_v<T, inner_allocator_type> is false and
+// - If uses_allocator_v<T, inner_allocator_type> is false and
// is_constructible_v<T, Args...> is true, calls
// OUTERMOST_ALLOC_TRAITS(*this)::construct(
// OUTERMOST (*this), p, std::forward<Args>(args)...).
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 f8a9ea0f9eca..44e8709a8e30 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
@@ -26,12 +26,12 @@ int main()
{
// sanity checks
static_assert( (std::is_same<
- std::allocator_traits<A1<int>>::is_always_equal, std::false_type>::value
- ), "" );
+ std::allocator_traits<A1<int>>::is_always_equal, std::false_type>::value
+ ), "" );
static_assert( (std::is_same<
- std::allocator_traits<min_allocator<int>>::is_always_equal, std::true_type>::value
- ), "" );
+ std::allocator_traits<min_allocator<int>>::is_always_equal, std::true_type>::value
+ ), "" );
// wrapping one allocator
static_assert(
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
index ed04a91ca406..419fd1a40cf8 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -80,7 +80,7 @@ void checkThrows(any& a)
{
#if !defined(TEST_HAS_NO_EXCEPTIONS)
try {
- any_cast<Type>(a);
+ TEST_IGNORE_NODISCARD any_cast<Type>(a);
assert(false);
} catch (bad_any_cast const &) {
// do nothing
@@ -89,7 +89,7 @@ void checkThrows(any& a)
}
try {
- any_cast<ConstT>(static_cast<any const&>(a));
+ TEST_IGNORE_NODISCARD any_cast<ConstT>(static_cast<any const&>(a));
assert(false);
} catch (bad_any_cast const &) {
// do nothing
@@ -103,7 +103,7 @@ void checkThrows(any& a)
typename std::remove_reference<Type>::type&&,
Type
>::type;
- any_cast<RefType>(static_cast<any&&>(a));
+ TEST_IGNORE_NODISCARD any_cast<RefType>(static_cast<any&&>(a));
assert(false);
} catch (bad_any_cast const &) {
// do nothing
@@ -111,13 +111,13 @@ void checkThrows(any& a)
assert(false);
}
#else
- ((void)a);
+ (TEST_IGNORE_NODISCARD a);
#endif
}
void test_cast_empty() {
// None of these operations should allocate.
- DisableAllocationGuard g; ((void)g);
+ DisableAllocationGuard g; (TEST_IGNORE_NODISCARD g);
any a;
checkThrows<int>(a);
}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
index 07578a28e82f..9638521260a9 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
@@ -25,12 +25,12 @@ using std::any_cast;
void test_const_lvalue_cast_request_non_const_lvalue()
{
const any a;
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
any_cast<TestType &>(a); // expected-note {{requested here}}
const any a2(42);
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{binding value of type 'const int' to reference to type 'int' drops 'const' qualifier}}
any_cast<int&>(a2); // expected-note {{requested here}}
}
@@ -38,22 +38,22 @@ void test_const_lvalue_cast_request_non_const_lvalue()
void test_lvalue_any_cast_request_rvalue()
{
any a;
- // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
any_cast<TestType &&>(a); // expected-note {{requested here}}
any a2(42);
- // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
any_cast<int&&>(a2); // expected-note {{requested here}}
}
void test_rvalue_any_cast_request_lvalue()
{
any a;
- // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{non-const lvalue reference to type 'TestType' cannot bind to a temporary}}
any_cast<TestType &>(std::move(a)); // expected-note {{requested here}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{non-const lvalue reference to type 'int' cannot bind to a temporary}}
any_cast<int&>(42);
}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
index 3f6955a8cbce..bad229dac886 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
@@ -29,18 +29,18 @@ int main()
any a;
// expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType &>(static_cast<any const&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{cannot cast from lvalue of type 'const TestType' to rvalue reference type 'TestType &&'; types are not compatible}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType &&>(static_cast<any const&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{binding value of type 'const TestType2' to reference to type 'TestType2' drops 'const' qualifier}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType2 &>(static_cast<any const&&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{cannot cast from lvalue of type 'const TestType2' to rvalue reference type 'TestType2 &&'; types are not compatible}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType2 &&>(static_cast<any const&&>(a)); // expected-note {{requested here}}
}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
index ed4b96d644d2..2d18cf4ba090 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
@@ -42,17 +42,17 @@ struct no_move {
int main() {
any a;
- // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{static_cast from 'no_copy' to 'no_copy' uses deleted function}}
any_cast<no_copy>(static_cast<any&>(a)); // expected-note {{requested here}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{static_cast from 'const no_copy' to 'no_copy' uses deleted function}}
any_cast<no_copy>(static_cast<any const&>(a)); // expected-note {{requested here}}
any_cast<no_copy>(static_cast<any &&>(a)); // OK
- // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{static_cast from 'typename remove_reference<no_move &>::type' (aka 'no_move') to 'no_move' uses deleted function}}
any_cast<no_move>(static_cast<any &&>(a));
}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp
index bbc135051ef8..204c5c0d6af9 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp
@@ -26,29 +26,29 @@ int main()
{
any a(1);
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &>(&a); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &&>(&a); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &>(&a); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const&&>(&a); // expected-note {{requested here}}
any const& a2 = a;
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &>(&a2); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &&>(&a2); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &>(&a2); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &&>(&a2); // expected-note {{requested here}}
}
diff --git a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
index 5a4a3c3c189f..9850851fc6ed 100644
--- a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
+++ b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
@@ -115,14 +115,14 @@ void test_make_any_throws()
{
{
try {
- std::make_any<Type>(101);
+ TEST_IGNORE_NODISCARD std::make_any<Type>(101);
assert(false);
} catch (int const&) {
}
}
{
try {
- std::make_any<Type>({1, 2, 3}, 101);
+ TEST_IGNORE_NODISCARD std::make_any<Type>({1, 2, 3}, 101);
assert(false);
} catch (int const&) {
}
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 b85f439ba7a0..fce826f4215d 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
@@ -11,15 +11,15 @@
#include <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(0)) == 1;
};
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 db7168c44f8b..bcd353eba1e2 100644
--- a/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp
@@ -11,15 +11,15 @@
#include <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(0)) == 1;
};
diff --git a/test/std/utilities/function.objects/comparisons/transparent.pass.cpp b/test/std/utilities/function.objects/comparisons/transparent.pass.cpp
index f353fe7a72a6..ebae262b2423 100644
--- a/test/std/utilities/function.objects/comparisons/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/comparisons/transparent.pass.cpp
@@ -11,15 +11,15 @@
#include <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(0)) == 1;
};
diff --git a/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp b/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp
index aaac98474fcb..9c3f24262ef0 100644
--- a/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp
+++ b/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp
@@ -36,4 +36,4 @@ int main() {
#if defined(__cpp_lib_invoke)
assert(std::invoke(foo, 101) == 42);
#endif
-} \ No newline at end of file
+}
diff --git a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
index aa8eb3916db9..7601ff9d147d 100644
--- a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
+++ b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
@@ -438,26 +438,26 @@ void throws_in_constructor_test()
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, "");
+ static_assert(std::is_invocable<T>::value, ""); // callable only with no args
+ static_assert(!std::is_invocable<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, "");
+ static_assert(std::is_invocable<T, MemFunCallable&>::value, "");
+ static_assert(!std::is_invocable<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, "");
+ static_assert(std::is_invocable<NCT>::value, "");
+ static_assert(!std::is_invocable<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, "");
+ static_assert(std::is_invocable<T, bool>::value, "");
+ static_assert(!std::is_invocable<T, std::string>::value, "");
}
}
@@ -587,7 +587,7 @@ void call_operator_noexcept_test()
}
void test_lwg2767() {
- // See http://wg21.link/LWG2767
+ // See https://cplusplus.github.io/LWG/lwg-defects.html#2767
struct Abstract { virtual void f() const = 0; };
struct Derived : public Abstract { void f() const {} };
struct F { bool operator()(Abstract&&) { return false; } };
diff --git a/test/std/utilities/function.objects/func.require/binary_function.pass.cpp b/test/std/utilities/function.objects/func.require/binary_function.pass.cpp
index fa7afb2e7b9c..93463190374e 100644
--- a/test/std/utilities/function.objects/func.require/binary_function.pass.cpp
+++ b/test/std/utilities/function.objects/func.require/binary_function.pass.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES: c++98 || c++03 || c++11 || c++14
+// binary_function was removed in C++17
// binary_function
diff --git a/test/std/utilities/function.objects/func.require/unary_function.pass.cpp b/test/std/utilities/function.objects/func.require/unary_function.pass.cpp
index f14b2d3a2ce5..40a9d480b183 100644
--- a/test/std/utilities/function.objects/func.require/unary_function.pass.cpp
+++ b/test/std/utilities/function.objects/func.require/unary_function.pass.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES: c++98 || c++03 || c++11 || c++14
+// unary_function was removed in C++17
// unary_function
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp
index 812f6fc502d9..7d3a5dec4ef6 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
-// REQUIRES: c++11 || c++14
// <functional>
@@ -25,5 +24,7 @@ struct S : public std::function<void()> { using function::function; };
int main() {
S s( [](){} );
S f1( s );
+#if TEST_STD_VER <= 14
S f2(std::allocator_arg, std::allocator<int>{}, s);
+#endif
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp
index 24f7fceb877b..b23153465168 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp
@@ -25,5 +25,5 @@ void foo(int) {}
int main()
{
- std::function<void(int)> f(std::allocator_arg, std::allocator<int>(), foo);
+ std::function<void(int)> f(std::allocator_arg, std::allocator<int>(), foo);
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
index 4c1a1ca95ff4..8a2a12e0f789 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
// <functional>
-// REQUIRES: c++98 || c++03 || c++11 ||c++14
+// REQUIRES: c++98 || c++03 || c++11 || c++14
// class function<R(ArgTypes...)>
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp
index 9967457ff821..2e4633b11693 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp
@@ -24,7 +24,7 @@
int main()
{
- typedef std::function<void(int)> F;
- F f1;
- F f2(std::allocator_arg, std::allocator<int>(), f1);
+ typedef std::function<void(int)> F;
+ F f1;
+ F f2(std::allocator_arg, std::allocator<int>(), f1);
}
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 00e513ec546f..d64c02f97cd4 100644
--- a/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp
@@ -11,15 +11,15 @@
#include <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(0)) == 1;
};
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
index df0b55a5d060..fede2538a851 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
@@ -17,7 +17,6 @@
#include <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
index 122716a23a8b..ba3c71e48260 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
@@ -17,7 +17,6 @@
#include <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
index 721a442d4431..d9f05b4e57a9 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
@@ -17,7 +17,6 @@
#include <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
index 564a3f77433c..d0dabd2643e5 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
@@ -17,7 +17,6 @@
#include <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
diff --git a/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp b/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp
index 609094dae406..7ce4c846e923 100644
--- a/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp
@@ -16,27 +16,42 @@
#include <functional>
#include <type_traits>
+template <class Arg, class Result>
+struct my_unary_function
+{ // std::unary_function was removed in C++17
+ typedef Arg argument_type;
+ typedef Result result_type;
+};
+
+template <class Arg1, class Arg2, class Result>
+struct my_binary_function
+{ // std::binary_function was removed in C++17
+ typedef Arg1 first_argument_type;
+ typedef Arg2 second_argument_type;
+ typedef Result result_type;
+};
+
class functor1
- : public std::unary_function<int, char>
+ : public my_unary_function<int, char>
{
};
class functor2
- : public std::binary_function<char, int, double>
+ : public my_binary_function<char, int, double>
{
};
class functor3
- : public std::unary_function<char, int>,
- public std::binary_function<char, int, double>
+ : public my_unary_function<char, int>,
+ public my_binary_function<char, int, double>
{
public:
typedef float result_type;
};
class functor4
- : public std::unary_function<char, int>,
- public std::binary_function<char, int, double>
+ : public my_unary_function<char, int>,
+ public my_binary_function<char, int, double>
{
public:
};
diff --git a/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp b/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
index ed173f280d05..7b427b9ac1e4 100644
--- a/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
@@ -13,7 +13,7 @@
// Hashing a struct w/o a defined hash should *not* fail, but it should
// create a type that is not constructible and not callable.
-// See also: http://cplusplus.github.io/LWG/lwg-active.html#2543
+// See also: https://cplusplus.github.io/LWG/lwg-defects.html#2543
#include <functional>
#include <cassert>
@@ -32,7 +32,7 @@ int main()
static_assert(!std::is_copy_assignable<H>::value, "");
static_assert(!std::is_move_assignable<H>::value, "");
#if TEST_STD_VER > 14
- static_assert(!std::is_callable<H(X&)>::value, "");
- static_assert(!std::is_callable<H(X const&)>::value, "");
+ static_assert(!std::is_invocable<H, X&>::value, "");
+ static_assert(!std::is_invocable<H, X const&>::value, "");
#endif
}
diff --git a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
index 36280a38e0a7..f1c56aed78b8 100644
--- a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
@@ -41,7 +41,7 @@ test()
assert(h(&i) != h(&j));
}
-// can't hash nullptr_t until c++17
+// can't hash nullptr_t until C++17
void test_nullptr()
{
#if TEST_STD_VER > 14
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.fail.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.fail.cpp
new file mode 100644
index 000000000000..71201f0ef0d9
--- /dev/null
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+// static pointer allocate(allocator_type& a, size_type n);
+// ...
+// };
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <memory>
+#include <cstdint>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T>
+struct A
+{
+ typedef T value_type;
+
+ value_type* allocate(std::size_t n)
+ {
+ assert(n == 12);
+ return reinterpret_cast<value_type*>(static_cast<std::uintptr_t>(0xEEADBEEF));
+ }
+ value_type* allocate(std::size_t n, const void* p)
+ {
+ assert(n == 11);
+ assert(p == 0);
+ return reinterpret_cast<value_type*>(static_cast<std::uintptr_t>(0xFEADBEEF));
+ }
+};
+
+int main()
+{
+ A<int> a;
+ std::allocator_traits<A<int> >::allocate(a, 10); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::allocator_traits<A<int> >::allocate(a, 10, nullptr); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
index ab8179c5ab4d..292d68de9786 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
@@ -20,6 +20,8 @@
#include <cstdint>
#include <cassert>
+#include "incomplete_type_helper.h"
+
template <class T>
struct A
{
@@ -34,6 +36,14 @@ struct A
int main()
{
+ {
A<int> a;
assert(std::allocator_traits<A<int> >::allocate(a, 10) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
+ }
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ assert(std::allocator_traits<Alloc >::allocate(a, 10) == reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
+ }
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
index 808284261f7d..90a9154e1840 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -52,12 +53,29 @@ struct B
}
};
+
int main()
{
#if TEST_STD_VER >= 11
+ {
A<int> a;
assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
+ }
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ assert(std::allocator_traits<Alloc >::allocate(a, 10, nullptr) == reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
+ }
#endif
+ {
B<int> b;
assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xFEADBEEF)));
+ }
+ {
+ typedef IncompleteHolder* VT;
+ typedef B<VT> Alloc;
+ Alloc b;
+ assert(std::allocator_traits<Alloc >::allocate(b, 11, nullptr) == reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xFEADBEEF)));
+ }
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
index 46075f62c6c1..e4aceffdd6b6 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
@@ -23,6 +23,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -107,6 +108,13 @@ int main()
std::allocator_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5);
assert(A2::count == 1);
}
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ std::aligned_storage<sizeof(VT)>::type store;
+ std::allocator_traits<Alloc>::construct(a, (VT*)&store, nullptr);
+ }
#if TEST_STD_VER >= 11
{
A0::count = 0;
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
index 8176d8b3767a..ecb67adb58e9 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
@@ -20,6 +20,8 @@
#include <cstdint>
#include <cassert>
+#include "incomplete_type_helper.h"
+
int called = 0;
template <class T>
@@ -37,7 +39,17 @@ struct A
int main()
{
+ {
A<int> a;
std::allocator_traits<A<int> >::deallocate(a, reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF)), 10);
assert(called == 1);
+ }
+ called = 0;
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ std::allocator_traits<Alloc >::deallocate(a, reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xDEADBEEF)), 10);
+ assert(called == 1);
+ }
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
index 2ee64b8b4a07..1a812876bf0c 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
@@ -23,6 +23,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -65,6 +66,13 @@ int main()
std::allocator_traits<A<int> >::destroy(a, (A0*)&a0);
assert(A0::count == 1);
}
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ std::aligned_storage<sizeof(VT)>::type store;
+ std::allocator_traits<Alloc>::destroy(a, (VT*)&store);
+ }
#if TEST_STD_VER >= 11
{
A0::count = 0;
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/incomplete_type_helper.h b/test/std/utilities/memory/allocator.traits/allocator.traits.members/incomplete_type_helper.h
new file mode 100644
index 000000000000..7662338d73c4
--- /dev/null
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/incomplete_type_helper.h
@@ -0,0 +1,14 @@
+#ifndef TEST_INCOMPLETE_TYPE_HELPER_H
+#define TEST_INCOMPLETE_TYPE_HELPER_H
+
+#include "min_allocator.h"
+
+namespace NS {
+ struct Incomplete;
+}
+
+template <class T> struct Holder { T value; };
+
+typedef Holder<NS::Incomplete> IncompleteHolder;
+
+#endif
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 d2c9a9826e14..12c0d02227fa 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
@@ -22,6 +22,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -51,6 +52,12 @@ int main()
const B<int> b = {};
assert(std::allocator_traits<B<int> >::max_size(b) == 100);
}
+ {
+ typedef IncompleteHolder* VT;
+ typedef B<VT> Alloc;
+ Alloc a;
+ assert(std::allocator_traits<Alloc >::max_size(a) == 100);
+ }
#if TEST_STD_VER >= 11
{
A<int> a;
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
index 2e9703037894..8355db18276a 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
@@ -23,6 +23,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -57,6 +58,12 @@ int main()
const A<int> a(0);
assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0);
}
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ assert(std::allocator_traits<Alloc>::select_on_container_copy_construction(a).id == 0);
+ }
#if TEST_STD_VER >= 11
{
B<int> b;
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
index 31a0f171d33d..7f7b155c35c8 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
@@ -37,7 +37,7 @@ template <class T>
struct C
{
typedef T value_type;
- int not_empty_; // some random member variable
+ int not_empty_; // some random member variable
};
int main()
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp
new file mode 100644
index 000000000000..490309eddd6e
--- /dev/null
+++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ std::allocator<int> a;
+ a.allocate(3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ a.allocate(3, nullptr); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
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
index 768d41878437..34cbb8dc5377 100644
--- 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
@@ -23,7 +23,7 @@ void test_max(size_t count)
{
std::allocator<T> a;
try {
- a.allocate(count);
+ TEST_IGNORE_NODISCARD a.allocate(count);
assert(false);
} catch (const std::exception &) {
}
diff --git a/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp b/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
new file mode 100644
index 000000000000..64a5c73affe1
--- /dev/null
+++ b/test/std/utilities/memory/pointer.conversion/to_address.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// template <class T> constexpr T* to_address(T* p) noexcept;
+// template <class Ptr> auto to_address(const Ptr& p) noexcept;
+
+#include <memory>
+#include <cassert>
+#include "test_macros.h"
+
+class P1
+{
+public:
+ using element_type = int;
+
+ explicit P1(int* p)
+ : p_(p) { }
+
+ int* operator->() const noexcept
+ { return p_; }
+
+private:
+ int* p_;
+};
+
+class P2
+{
+public:
+ using element_type = int;
+
+ explicit P2(int* p)
+ : p_(p) { }
+
+ P1 operator->() const noexcept
+ { return p_; }
+
+private:
+ P1 p_;
+};
+
+class P3
+{
+public:
+ explicit P3(int* p)
+ : p_(p) { }
+
+ int* get() const noexcept
+ { return p_; }
+
+private:
+ int* p_;
+};
+
+namespace std
+{
+template<>
+struct pointer_traits<::P3>
+{
+ static int* to_address(const ::P3& p) noexcept
+ { return p.get(); }
+};
+}
+
+class P4
+{
+public:
+ explicit P4(int* p)
+ : p_(p) { }
+
+ int* operator->() const noexcept
+ { return nullptr; }
+
+ int* get() const noexcept
+ { return p_; }
+
+private:
+ int* p_;
+};
+
+namespace std
+{
+template<>
+struct pointer_traits<::P4>
+{
+ static int* to_address(const ::P4& p) noexcept
+ { return p.get(); }
+};
+}
+
+int n = 0;
+static_assert(std::to_address(&n) == &n);
+
+int main()
+{
+ int i = 0;
+ ASSERT_NOEXCEPT(std::to_address(&i));
+ assert(std::to_address(&i) == &i);
+ P1 p1(&i);
+ ASSERT_NOEXCEPT(std::to_address(p1));
+ assert(std::to_address(p1) == &i);
+ P2 p2(&i);
+ ASSERT_NOEXCEPT(std::to_address(p2));
+ assert(std::to_address(p2) == &i);
+ P3 p3(&i);
+ ASSERT_NOEXCEPT(std::to_address(p3));
+ assert(std::to_address(p3) == &i);
+ P4 p4(&i);
+ ASSERT_NOEXCEPT(std::to_address(p4));
+ assert(std::to_address(p4) == &i);
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp
index 81f49eaac39b..3ff32df11338 100644
--- a/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp
@@ -19,7 +19,7 @@
int main()
{
#if TEST_STD_VER > 14
- const int *p = std::addressof<const int>(0);
+ const int *p = std::addressof<const int>(0);
#else
#error
#endif
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
index ad6a51500e36..319df229668f 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
@@ -112,4 +112,4 @@ int main()
{
test_counted();
test_value_initialized();
-} \ No newline at end of file
+}
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 1829dff354d3..2f387a4cef97 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
@@ -71,7 +71,7 @@ int main()
std::uninitialized_copy(b, b+2, bp);
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
- assert(B::population_ == N + 2);
+ assert(B::population_ == N + 2);
}
{
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
index 6c535250fd1f..d914129f2a4a 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
@@ -111,4 +111,4 @@ void test_counted()
int main() {
test_counted();
test_ctor_throws();
-} \ No newline at end of file
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
index 4175c6bce688..4083bc367cf2 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
@@ -114,4 +114,4 @@ int main()
{
test_counted();
test_ctor_throws();
-} \ No newline at end of file
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp
new file mode 100644
index 000000000000..48c90f7b9661
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// Because we don't have a functioning decltype in C++03
+
+// <memory>
+
+// unique_ptr
+
+// template<class CharT, class Traits, class Y, class D>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os, const unique_ptr<Y, D>& p);
+
+// -?- Remarks: This function shall not participate in overload resolution unless os << p.get() is a valid expression.
+
+#include <memory>
+#include <sstream>
+#include <cassert>
+
+class A {};
+
+int main()
+{
+ std::unique_ptr<A> p(new A);
+ std::ostringstream os;
+ os << p;
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.pass.cpp
new file mode 100644
index 000000000000..1166a01e8198
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.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
+// Because we don't have a functioning decltype in C++03
+
+// <memory>
+
+// unique_ptr
+
+// template<class CharT, class Traits, class Y, class D>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os, const unique_ptr<Y, D>& p);
+
+#include <memory>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ std::unique_ptr<int> p(new int(3));
+ std::ostringstream os;
+ assert(os.str().empty());
+ os << p;
+ assert(!os.str().empty());
+}
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 eb0d0a955fc5..8bd8993e5bec 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
@@ -41,7 +41,7 @@ void nullDeleter(void*) {}
struct Foo : virtual public std::enable_shared_from_this<Foo>
{
- virtual ~Foo() {}
+ virtual ~Foo() {}
};
struct Bar : public Foo {
@@ -80,12 +80,11 @@ int main()
}
{
typedef std::shared_ptr<PrivateBase> APtr;
- typedef std::weak_ptr<PrivateBase> WeakAPtr;
APtr a1 = std::make_shared<PrivateBase>();
assert(a1.use_count() == 1);
}
// Test LWG issue 2529. Only reset '__weak_ptr_' when it's already expired.
- // http://cplusplus.github.io/LWG/lwg-active.html#2529.
+ // https://cplusplus.github.io/LWG/lwg-defects.html#2529
// Test two different ways:
// * Using 'weak_from_this().expired()' in C++17.
// * Using 'shared_from_this()' in all dialects.
@@ -135,7 +134,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try {
- ptr->shared_from_this();
+ TEST_IGNORE_NODISCARD ptr->shared_from_this();
assert(false);
} catch (std::bad_weak_ptr const&) {
} catch (...) { assert(false); }
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/nothing_to_do.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp
index b58f5c55b643..7f304054bda0 100644
--- a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/nothing_to_do.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp
@@ -7,6 +7,23 @@
//
//===----------------------------------------------------------------------===//
+// <memory>
+
+// shared_ptr
+
+// template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct S {
+private:
+ S () {}; // ctor is private
+};
+
int main()
{
+ std::shared_ptr<S> p = std::make_shared<S>();
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp
new file mode 100644
index 000000000000..0eeeed4e88c9
--- /dev/null
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// shared_ptr
+
+// template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct S {
+protected:
+ S () {}; // ctor is protected
+};
+
+int main()
+{
+ std::shared_ptr<S> p = std::make_shared<S>(); // expected-error-re@memory:* {{static_assert failed{{.*}} "Can't construct object in make_shared"}}
+}
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 501844a1d6ce..b7ea8d4dc6d3 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
@@ -74,14 +74,14 @@ int main()
assert(!cs(p2, p1));
assert(cs(p1 ,p3) || cs(p3, p1));
assert(cs(p3, p1) == cs(p3, p2));
- ASSERT_NOEXCEPT(cs(p1, p1));
+ ASSERT_NOEXCEPT(cs(p1, p1));
assert(!cs(p1, w2));
assert(!cs(p2, w1));
assert(cs(p1, w3) || cs(p3, w1));
assert(cs(p3, w1) == cs(p3, w2));
- ASSERT_NOEXCEPT(cs(p1, w1));
- ASSERT_NOEXCEPT(cs(w1, p1));
+ ASSERT_NOEXCEPT(cs(p1, w1));
+ ASSERT_NOEXCEPT(cs(w1, p1));
}
{
typedef std::owner_less<std::weak_ptr<int> > CS;
@@ -95,14 +95,14 @@ int main()
assert(!cs(w2, w1));
assert(cs(w1, w3) || cs(w3, w1));
assert(cs(w3, w1) == cs(w3, w2));
- ASSERT_NOEXCEPT(cs(w1, w1));
+ ASSERT_NOEXCEPT(cs(w1, w1));
assert(!cs(w1, p2));
assert(!cs(w2, p1));
assert(cs(w1, p3) || cs(w3, p1));
assert(cs(w3, p1) == cs(w3, p2));
- ASSERT_NOEXCEPT(cs(w1, p1));
- ASSERT_NOEXCEPT(cs(p1, w1));
+ ASSERT_NOEXCEPT(cs(w1, p1));
+ ASSERT_NOEXCEPT(cs(p1, w1));
}
#if TEST_STD_VER > 14
{
@@ -112,21 +112,21 @@ int main()
std::weak_ptr<int> wp1;
std::owner_less<> cmp;
- cmp(sp1, sp2);
- cmp(sp1, wp1);
- cmp(sp1, sp3);
- cmp(wp1, sp1);
- cmp(wp1, wp1);
- ASSERT_NOEXCEPT(cmp(sp1, sp1));
- ASSERT_NOEXCEPT(cmp(sp1, wp1));
- ASSERT_NOEXCEPT(cmp(wp1, sp1));
- ASSERT_NOEXCEPT(cmp(wp1, wp1));
+ assert(!cmp(sp1, sp2));
+ assert(!cmp(sp1, wp1));
+ assert(!cmp(sp1, sp3));
+ assert(!cmp(wp1, sp1));
+ assert(!cmp(wp1, wp1));
+ ASSERT_NOEXCEPT(cmp(sp1, sp1));
+ ASSERT_NOEXCEPT(cmp(sp1, wp1));
+ ASSERT_NOEXCEPT(cmp(wp1, sp1));
+ ASSERT_NOEXCEPT(cmp(wp1, wp1));
}
{
// test heterogeneous lookups
std::set<std::shared_ptr<X>, std::owner_less<>> s;
std::shared_ptr<void> vp;
- s.find(vp);
+ assert(s.find(vp) == s.end());
}
#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
index 458f8a11ed12..23df0d8e68ed 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
@@ -29,6 +29,5 @@ int main()
assert(!w2.owner_before(p1));
assert(w1.owner_before(p3) || w3.owner_before(p1));
assert(w3.owner_before(p1) == w3.owner_before(p2));
-// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted
- LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(p2));
+ ASSERT_NOEXCEPT(w1.owner_before(p2));
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
index 5cd171a53021..a38bf67c2e03 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
@@ -29,6 +29,5 @@ int main()
assert(!w2.owner_before(w1));
assert(w1.owner_before(w3) || w3.owner_before(w1));
assert(w3.owner_before(w1) == w3.owner_before(w2));
-// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted
- LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(w2));
+ ASSERT_NOEXCEPT(w1.owner_before(w2));
}
diff --git a/test/std/utilities/meta/meta.rel/is_callable.pass.cpp b/test/std/utilities/meta/meta.rel/is_callable.pass.cpp
deleted file mode 100644
index 4c85f440b0bf..000000000000
--- a/test/std/utilities/meta/meta.rel/is_callable.pass.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file 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_invocable.pass.cpp b/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp
new file mode 100644
index 000000000000..1b2a9286f949
--- /dev/null
+++ b/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp
@@ -0,0 +1,166 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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_invocable
+
+// Most testing of is_invocable 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_invocable<Fn, Tag&, int>::value, "");
+ static_assert(std::is_invocable<Fn, DerFromTag&, int>::value, "");
+ static_assert(std::is_invocable<RFn, Tag&&, int>::value, "");
+ static_assert(!std::is_invocable<RFn, Tag&, int>::value, "");
+ static_assert(!std::is_invocable<Fn, Tag&>::value, "");
+ static_assert(!std::is_invocable<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_invocable<Fn, T&, int>::value, "");
+ static_assert(std::is_invocable<Fn, DT&, int>::value, "");
+ static_assert(std::is_invocable<Fn, const T&, int>::value, "");
+ static_assert(std::is_invocable<Fn, T&&, int>::value, "");
+ static_assert(!std::is_invocable<Fn, CT&, int>::value, "");
+ static_assert(!std::is_invocable<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_invocable<Fn, T&, int>::value, "");
+ static_assert(std::is_invocable<Fn, DT&, int>::value, "");
+ static_assert(std::is_invocable<Fn, const T&, int>::value, "");
+ static_assert(std::is_invocable<Fn, T&&, int>::value, "");
+ static_assert(std::is_invocable<Fn, ST, int>::value, "");
+ static_assert(!std::is_invocable<Fn, CT&, int>::value, "");
+ static_assert(!std::is_invocable<RFn, T, int>::value, "");
+ }
+ }
+ {
+ // Bullets 4, 5 and 6
+ using Fn = int (Tag::*);
+ static_assert(!std::is_invocable<Fn>::value, "");
+ {
+ // Bullet 4
+ static_assert(std::is_invocable<Fn, Tag&>::value, "");
+ static_assert(std::is_invocable<Fn, DerFromTag&>::value, "");
+ static_assert(std::is_invocable<Fn, Tag&&>::value, "");
+ static_assert(std::is_invocable<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_invocable<Fn, T&>::value, "");
+ static_assert(std::is_invocable<Fn, DT&>::value, "");
+ static_assert(std::is_invocable<Fn, const T&>::value, "");
+ static_assert(std::is_invocable<Fn, T&&>::value, "");
+ static_assert(std::is_invocable<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_invocable<Fn, T&>::value, "");
+ static_assert(std::is_invocable<Fn, DT&>::value, "");
+ static_assert(std::is_invocable<Fn, const T&>::value, "");
+ static_assert(std::is_invocable<Fn, T&&>::value, "");
+ static_assert(std::is_invocable<Fn, ST>::value, "");
+ static_assert(std::is_invocable<Fn, CT&>::value, "");
+ }
+ }
+ {
+ // INVOKE bullet 7
+ {
+ // Function pointer
+ using Fp = void(*)(Tag&, int);
+ static_assert(std::is_invocable<Fp, Tag&, int>::value, "");
+ static_assert(std::is_invocable<Fp, DerFromTag&, int>::value, "");
+ static_assert(!std::is_invocable<Fp, const Tag&, int>::value, "");
+ static_assert(!std::is_invocable<Fp>::value, "");
+ static_assert(!std::is_invocable<Fp, Tag&>::value, "");
+ }
+ {
+ // Function reference
+ using Fp = void(&)(Tag&, int);
+ static_assert(std::is_invocable<Fp, Tag&, int>::value, "");
+ static_assert(std::is_invocable<Fp, DerFromTag&, int>::value, "");
+ static_assert(!std::is_invocable<Fp, const Tag&, int>::value, "");
+ static_assert(!std::is_invocable<Fp>::value, "");
+ static_assert(!std::is_invocable<Fp, Tag&>::value, "");
+ }
+ {
+ // Function object
+ using Fn = NotCallableWithInt;
+ static_assert(std::is_invocable<Fn, Tag>::value, "");
+ static_assert(!std::is_invocable<Fn, int>::value, "");
+ }
+ }
+ {
+ // Check that the conversion to the return type is properly checked
+ using Fn = int(*)();
+ static_assert(std::is_invocable_r<Implicit, Fn>::value, "");
+ static_assert(std::is_invocable_r<double, Fn>::value, "");
+ static_assert(std::is_invocable_r<const volatile void, Fn>::value, "");
+ static_assert(!std::is_invocable_r<Explicit, Fn>::value, "");
+ }
+ {
+ // Check for is_invocable_v
+ using Fn = void(*)();
+ static_assert(std::is_invocable_v<Fn>, "");
+ static_assert(!std::is_invocable_v<Fn, int>, "");
+ }
+ {
+ // Check for is_invocable_r_v
+ using Fn = void(*)();
+ static_assert(std::is_invocable_r_v<void, Fn>, "");
+ static_assert(!std::is_invocable_r_v<int, Fn>, "");
+ }
+}
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
deleted file mode 100644
index eefa6d1f22b1..000000000000
--- a/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file 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.rel/is_nothrow_invocable.pass.cpp b/test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp
new file mode 100644
index 000000000000..3be3d46f295b
--- /dev/null
+++ b/test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp
@@ -0,0 +1,121 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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_invocable
+
+#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, class ...Args>
+constexpr bool throws_invocable() {
+ return std::is_invocable<Fn, Args...>::value &&
+ !std::is_nothrow_invocable<Fn, Args...>::value;
+}
+
+template <class Ret, class Fn, class ...Args>
+constexpr bool throws_invocable_r() {
+ return std::is_invocable_r<Ret, Fn, Args...>::value &&
+ !std::is_nothrow_invocable_r<Ret, Fn, Args...>::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_invocable will always
+ // return false because 'noexcept' is not part of the function type.
+ static_assert(throws_invocable<decltype(&Dummy::foo), Dummy&>(), "");
+ static_assert(throws_invocable<decltype(&Dummy::bar)>(), "");
+ }
+#else
+ {
+ // Check that PMF's and function pointers actually work and that
+ // is_nothrow_invocable returns true for noexcept PMF's and function
+ // pointers.
+ static_assert(std::is_nothrow_invocable<decltype(&Dummy::foo), Dummy&>::value, "");
+ static_assert(std::is_nothrow_invocable<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_invocable_r<Implicit, Fn>::value, "");
+ static_assert(std::is_nothrow_invocable_r<double, Fn>::value, "");
+ static_assert(std::is_nothrow_invocable_r<const volatile void, Fn>::value, "");
+ static_assert(throws_invocable_r<ThrowsImplicit, Fn>(), "");
+ static_assert(!std::is_nothrow_invocable<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_invocable<Fn, Implicit&, ThrowsImplicit&>::value, "");
+ static_assert(std::is_nothrow_invocable<Fn, int, ThrowsImplicit&>::value, "");
+ static_assert(throws_invocable<Fn, int, int>(), "");
+ static_assert(!std::is_nothrow_invocable<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_invocable<Fn>::value, "");
+ static_assert(throws_invocable<Fn2>(), "");
+ }
+ {
+ // Check that PMD derefs are noexcept
+ using Fn = int (Tag::*);
+ static_assert(std::is_nothrow_invocable<Fn, Tag&>::value, "");
+ static_assert(std::is_nothrow_invocable_r<Implicit, Fn, Tag&>::value, "");
+ static_assert(throws_invocable_r<ThrowsImplicit, Fn, Tag&>(), "");
+ }
+ {
+ // Check for is_nothrow_invocable_v
+ using Fn = CallObject<true, int>;
+ static_assert(std::is_nothrow_invocable_v<Fn>, "");
+ static_assert(!std::is_nothrow_invocable_v<Fn, int>, "");
+ }
+ {
+ // Check for is_nothrow_invocable_r_v
+ using Fn = CallObject<true, int>;
+ static_assert(std::is_nothrow_invocable_r_v<void, Fn>, "");
+ static_assert(!std::is_nothrow_invocable_r_v<int, Fn, int>, "");
+ }
+ test_noexcept_function_pointers();
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/nothing_to_do.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.fail.cpp
index b58f5c55b643..efee5064cf59 100644
--- a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/nothing_to_do.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.fail.cpp
@@ -7,6 +7,17 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
+// type_traits
+
+// aligned_union<size_t Len, class ...Types>
+
+#include <type_traits>
+
+class A; // Incomplete
+
int main()
{
+ typedef std::aligned_union<10, A>::type T1;
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
index 4f45a0340a91..c0aece771f0c 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
@@ -34,9 +34,9 @@ int main()
test_decay<const int[3], const int*>();
test_decay<void(), void (*)()>();
#if TEST_STD_VER > 11
- test_decay<int(int) const, int(int) const>();
- test_decay<int(int) volatile, int(int) volatile>();
- test_decay<int(int) &, int(int) &>();
- test_decay<int(int) &&, int(int) &&>();
+ test_decay<int(int) const, int(int) const>();
+ test_decay<int(int) volatile, int(int) volatile>();
+ test_decay<int(int) &, int(int) &>();
+ test_decay<int(int) &&, int(int) &&>();
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp
new file mode 100644
index 000000000000..e06229f7e975
--- /dev/null
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// type_traits
+
+// remove_cvref
+
+#include <type_traits>
+
+#include "test_macros.h"
+
+template <class T, class U>
+void test_remove_cvref()
+{
+ static_assert((std::is_same<typename std::remove_cvref<T>::type, U>::value), "");
+ static_assert((std::is_same< std::remove_cvref_t<T>, U>::value), "");
+}
+
+int main()
+{
+ test_remove_cvref<void, void>();
+ test_remove_cvref<int, int>();
+ test_remove_cvref<const int, int>();
+ test_remove_cvref<const volatile int, int>();
+ test_remove_cvref<volatile int, int>();
+
+// Doesn't decay
+ test_remove_cvref<int[3], int[3]>();
+ test_remove_cvref<int const [3], int[3]>();
+ test_remove_cvref<int volatile [3], int[3]>();
+ test_remove_cvref<int const volatile [3], int[3]>();
+ test_remove_cvref<void(), void ()>();
+
+ test_remove_cvref<int &, int>();
+ test_remove_cvref<const int &, int>();
+ test_remove_cvref<const volatile int &, int>();
+ test_remove_cvref<volatile int &, int>();
+
+ test_remove_cvref<int*, int*>();
+ test_remove_cvref<int(int) const, int(int) const>();
+ test_remove_cvref<int(int) volatile, int(int) volatile>();
+ test_remove_cvref<int(int) &, int(int) &>();
+ test_remove_cvref<int(int) &&, int(int) &&>();
+}
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 fc01b22c36ab..24231526b2bf 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
@@ -42,16 +42,46 @@ struct HasType : std::false_type {};
template <class T>
struct HasType<T, typename Voider<typename T::type>::type> : std::true_type {};
+#if TEST_STD_VER > 14
+template <typename T, typename U>
+struct test_invoke_result;
+
+template <typename Fn, typename ...Args, typename Ret>
+struct test_invoke_result<Fn(Args...), Ret>
+{
+ static void call()
+ {
+ static_assert(std::is_invocable<Fn, Args...>::value, "");
+ static_assert(std::is_invocable_r<Ret, Fn, Args...>::value, "");
+ static_assert((std::is_same<typename std::invoke_result<Fn, Args...>::type, Ret>::value), "");
+ }
+};
+#endif
+
template <class T, class U>
void test_result_of()
{
+ static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
#if TEST_STD_VER > 14
- static_assert(std::is_callable<T>::value, "");
- static_assert(std::is_callable<T, U>::value, "");
+ test_invoke_result<T, U>::call();
#endif
- static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
}
+#if TEST_STD_VER > 14
+template <typename T>
+struct test_invoke_no_result;
+
+template <typename Fn, typename ...Args>
+struct test_invoke_no_result<Fn(Args...)>
+{
+ static void call()
+ {
+ static_assert(std::is_invocable<Fn, Args...>::value == false, "");
+ static_assert((!HasType<std::invoke_result<Fn, Args...> >::value), "");
+ }
+};
+#endif
+
template <class T>
void test_no_result()
{
@@ -59,7 +89,7 @@ void test_no_result()
static_assert((!HasType<std::result_of<T> >::value), "");
#endif
#if TEST_STD_VER > 14
- static_assert(std::is_callable<T>::value == false, "");
+ test_invoke_no_result<T>::call();
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
index eac4e4a089fe..2b8cd709677b 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
@@ -27,6 +27,23 @@ struct wat
struct F {};
struct FD : public F {};
+#if TEST_STD_VER > 14
+template <typename T, typename U>
+struct test_invoke_result;
+
+template <typename Fn, typename ...Args, typename Ret>
+struct test_invoke_result<Fn(Args...), Ret>
+{
+ static void call()
+ {
+ static_assert(std::is_invocable<Fn, Args...>::value, "");
+ static_assert(std::is_invocable_r<Ret, Fn, Args...>::value, "");
+ static_assert((std::is_same<typename std::invoke_result<Fn, Args...>::type, Ret>::value), "");
+ static_assert((std::is_same<std::invoke_result_t<Fn, Args...>, Ret>::value), "");
+ }
+};
+#endif
+
template <class T, class U>
void test_result_of_imp()
{
@@ -35,8 +52,7 @@ void test_result_of_imp()
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, "");
+ test_invoke_result<T, U>::call();
#endif
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
index 4e875fa94520..23d5176127a1 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
@@ -77,11 +77,11 @@ typedef void (*FunctionPtr)();
int main()
{
- test_is_function<void(void)>();
- test_is_function<int(int)>();
- test_is_function<int(int, double)>();
- test_is_function<int(Abstract *)>();
- test_is_function<void(...)>();
+ test_is_function<void(void)>();
+ test_is_function<int(int)>();
+ test_is_function<int(int, double)>();
+ test_is_function<int(Abstract *)>();
+ test_is_function<void(...)>();
test_is_not_function<std::nullptr_t>();
test_is_not_function<void>();
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 f776196dd7a9..052b0b9851d6 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
@@ -91,11 +91,11 @@ int main()
test_is_fundamental<unsigned char>();
test_is_fundamental<wchar_t>();
test_is_fundamental<double>();
- test_is_fundamental<float>();
- test_is_fundamental<double>();
- test_is_fundamental<long double>();
- test_is_fundamental<char16_t>();
- test_is_fundamental<char32_t>();
+ test_is_fundamental<float>();
+ test_is_fundamental<double>();
+ test_is_fundamental<long double>();
+ test_is_fundamental<char16_t>();
+ test_is_fundamental<char32_t>();
test_is_not_fundamental<char[3]>();
test_is_not_fundamental<char[]>();
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 3955d4bc3306..8d63a23494b9 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
@@ -81,5 +81,5 @@ int main()
test_is_not_assignable<int(), int> ();
// pointer to incomplete template type
- test_is_assignable<X<D>*&, X<D>*> ();
+ test_is_assignable<X<D>*&, X<D>*> ();
}
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 9d2ec5edea58..1f7c32a8cc07 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
@@ -9,7 +9,7 @@
// type_traits
// XFAIL: apple-clang-6.0
-// The Apple-6 compiler gets is_constructible<void ()> wrong.
+// The Apple-6 compiler gets is_constructible<void ()> wrong.
// template <class T, class... Args>
// struct is_constructible;
diff --git a/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp b/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp
index f9ea7b47911f..c97bebe29c3c 100644
--- a/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp
+++ b/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp
@@ -11,17 +11,15 @@
// <optional>
// struct nullopt_t{see below};
-// constexpr nullopt_t nullopt(unspecified);
+// inline constexpr nullopt_t nullopt(unspecified);
// [optional.nullopt]/2:
-// Type nullopt_t shall not have a default constructor or an initializer-list constructor.
-// It shall not be an aggregate and shall be a literal type.
-// Constant nullopt shall be initialized with an argument of literal type.
+// Type nullopt_t shall not have a default constructor or an initializer-list
+// constructor, and shall not be an aggregate.
#include <optional>
-#include "test_macros.h"
int main()
{
- std::nullopt_t n = {};
+ std::nullopt_t n = {};
}
diff --git a/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp
index 9b752a665a83..247fce58fe97 100644
--- a/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp
+++ b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp
@@ -11,33 +11,30 @@
// <optional>
// struct nullopt_t{see below};
-// constexpr nullopt_t nullopt(unspecified);
+// inline constexpr nullopt_t nullopt(unspecified);
// [optional.nullopt]/2:
-// Type nullopt_t shall not have a default constructor or an initializer-list constructor.
-// It shall not be an aggregate and shall be a literal type.
-// Constant nullopt shall be initialized with an argument of literal type.
+// Type nullopt_t shall not have a default constructor or an initializer-list
+// constructor, and shall not be an aggregate.
#include <optional>
#include <type_traits>
-using std::optional;
using std::nullopt_t;
using std::nullopt;
-constexpr
-int
-test(const nullopt_t&)
+constexpr bool test()
{
- return 3;
+ nullopt_t foo{nullopt};
+ (void)foo;
+ return true;
}
int main()
{
- 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(std::is_empty_v<nullopt_t>);
+ static_assert(!std::is_default_constructible_v<nullopt_t>);
- static_assert(test(nullopt) == 3, "");
+ static_assert(std::is_same_v<const nullopt_t, decltype(nullopt)>);
+ static_assert(test());
}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp
index 3224c1bac756..77e411b2e3b5 100644
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp
@@ -21,11 +21,11 @@
#include "test_macros.h"
struct S {
- constexpr S() : v_(0) {}
- S(int v) : v_(v) {}
- S(const S &rhs) : v_(rhs.v_) {} // make it not trivially copyable
- int v_;
- };
+ constexpr S() : v_(0) {}
+ S(int v) : v_(v) {}
+ S(const S &rhs) : v_(rhs.v_) {} // make it not trivially copyable
+ int v_;
+ };
int main()
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp
index fb2e139ad591..4e3991c18487 100644
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp
@@ -21,12 +21,12 @@
#include "test_macros.h"
struct S {
- constexpr S() : v_(0) {}
- S(int v) : v_(v) {}
- constexpr S(const S &rhs) : v_(rhs.v_) {} // not trivially moveable
- constexpr S(const S &&rhs) : v_(rhs.v_) {} // not trivially moveable
- int v_;
- };
+ constexpr S() : v_(0) {}
+ S(int v) : v_(v) {}
+ constexpr S(const S &rhs) : v_(rhs.v_) {} // not trivially moveable
+ constexpr S(const S &&rhs) : v_(rhs.v_) {} // not trivially moveable
+ int v_;
+ };
int main()
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
index 44e6e7305901..bbc70014f099 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -69,7 +69,7 @@ int main()
optional<X> opt;
try
{
- opt.value();
+ (void)opt.value();
assert(false);
}
catch (const bad_optional_access&)
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
index e2d48ec99302..c644fb9d6696 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -61,7 +61,7 @@ int main()
const optional<X> opt;
try
{
- opt.value();
+ (void)opt.value();
assert(false);
}
catch (const bad_optional_access&)
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
index 874a5441a4c2..5347d3f558bb 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
@@ -61,7 +61,7 @@ int main()
const optional<X> opt;
try
{
- std::move(opt).value();
+ (void)std::move(opt).value();
assert(false);
}
catch (const bad_optional_access&)
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
index 60cab7d27c64..1a577e68b99e 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
@@ -67,7 +67,7 @@ int main()
optional<X> opt;
try
{
- std::move(opt).value();
+ (void)std::move(opt).value();
assert(false);
}
catch (const bad_optional_access&)
diff --git a/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp b/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp
index 8a2c77af0ec1..11ddcb7c0028 100644
--- a/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp
+++ b/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp
@@ -26,22 +26,22 @@ int main()
{
using std::optional;
{
- // expected-error@optional:* 2 {{static_assert failed "instantiation of optional with a reference type is ill-formed}}
+ // expected-error-re@optional:* 2 {{static_assert failed{{.*}} "instantiation of optional with a reference type is ill-formed}}
optional<int&> opt1;
optional<int&&> opt2;
}
{
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed"}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-destructible type is ill-formed"}}
optional<X> opt3;
}
{
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-object type is undefined behavior"}}
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-object type is undefined behavior"}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-destructible type is ill-formed}}
optional<void()> opt4;
}
{
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-object type is undefined behavior"}}
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-object type is undefined behavior"}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-destructible type is ill-formed}}
// expected-error@optional:* 1+ {{cannot form a reference to 'void'}}
optional<const void> opt4;
}
diff --git a/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp b/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
index 687625e8b673..57903020fedb 100644
--- a/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
+++ b/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
@@ -19,4 +19,5 @@ int main()
using std::optional;
std::initializer_list<int> list;
+ (void)list;
}
diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp
index 4e2a6dfa3dd1..d747483a9d5a 100644
--- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp
+++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp
@@ -14,7 +14,7 @@
// Test unique_ptr converting move ctor
-// NOTE: unique_ptr does not provide converting constructors in c++03
+// NOTE: unique_ptr does not provide converting constructors in C++03
// UNSUPPORTED: c++98, c++03
#include <memory>
diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp
index b05fb71cdc67..50058a6208a5 100644
--- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp
+++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp
@@ -19,6 +19,6 @@
int main() {
std::unique_ptr<int[]> p(new int(3));
const std::unique_ptr<int[]>& cp = p;
- (void)(*p); // expected-error {{indirection requires pointer operand ('std::unique_ptr<int []>' invalid)}}
- (void)(*cp); // expected-error {{indirection requires pointer operand ('const std::unique_ptr<int []>' invalid)}}
+ TEST_IGNORE_NODISCARD (*p); // expected-error {{indirection requires pointer operand ('std::unique_ptr<int []>' invalid)}}
+ TEST_IGNORE_NODISCARD (*cp); // expected-error {{indirection requires pointer operand ('const std::unique_ptr<int []>' invalid)}}
}
diff --git a/test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp b/test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
index a2c9df6b4a22..20578511c8cf 100644
--- a/test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
@@ -36,11 +36,18 @@ void test_to_ullong()
std::bitset<N> v(j);
assert(j == v.to_ullong());
}
+ { // test values bigger than can fit into the bitset
+ const unsigned long long val = 0x55AAAAFFFFAAAA55ULL;
+ const bool canFit = N < sizeof(unsigned long long) * CHAR_BIT;
+ const unsigned long long mask = canFit ? (1ULL << (canFit ? N : 0)) - 1 : (unsigned long long)(-1); // avoid compiler warnings
+ std::bitset<N> v(val);
+ assert(v.to_ullong() == (val & mask)); // we shouldn't return bit patterns from outside the limits of the bitset.
+ }
}
int main()
{
- test_to_ullong<0>();
+// test_to_ullong<0>();
test_to_ullong<1>();
test_to_ullong<31>();
test_to_ullong<32>();
diff --git a/test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp b/test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
index 7cabd06e5f32..0872d77bca91 100644
--- a/test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
@@ -37,6 +37,14 @@ void test_to_ulong()
std::bitset<N> v(j);
assert(j == v.to_ulong());
}
+
+ { // test values bigger than can fit into the bitset
+ const unsigned long val = 0x5AFFFFA5UL;
+ const bool canFit = N < sizeof(unsigned long) * CHAR_BIT;
+ const unsigned long mask = canFit ? (1UL << (canFit ? N : 0)) - 1 : (unsigned long)(-1); // avoid compiler warnings
+ std::bitset<N> v(val);
+ assert(v.to_ulong() == (val & mask)); // we shouldn't return bit patterns from outside the limits of the bitset.
+ }
}
int main()
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 24847dd70f86..2f8a707bfa2f 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
@@ -24,8 +24,8 @@
#include <chrono>
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
int main()
{
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 cdb38dfce3f5..4458d6f213fa 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
@@ -26,8 +26,8 @@
#include <chrono>
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
int main()
{
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 dfc08a3bca69..deb4615fa5a1 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
@@ -24,8 +24,8 @@
#include <chrono>
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
int main()
{
diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp
index 702c38d2d4a9..416a8db8ae5b 100644
--- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp
@@ -11,7 +11,7 @@
// duration
-// constexpr duration& operator++(); // constexpr in c++17
+// constexpr duration& operator++(); // constexpr in C++17
#include <chrono>
#include <cassert>
diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp
index 49b8c76ee8ee..deb4daa8d86b 100644
--- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp
@@ -11,7 +11,7 @@
// duration
-// constexpr duration operator++(int); // constexpr in c++17
+// constexpr duration operator++(int); // constexpr in C++17
#include <chrono>
#include <cassert>
diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp
index bec8effbe220..b74011a3b27b 100644
--- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp
@@ -11,7 +11,7 @@
// duration
-// constexpr duration& operator+=(const duration& d); // constexpr in c++17
+// constexpr duration& operator+=(const duration& d); // constexpr in C++17
#include <chrono>
#include <cassert>
diff --git a/test/std/utilities/tuple/tuple.general/ignore.pass.cpp b/test/std/utilities/tuple/tuple.general/ignore.pass.cpp
index 8dae3a5dcb0e..a7a0904cf492 100644
--- a/test/std/utilities/tuple/tuple.general/ignore.pass.cpp
+++ b/test/std/utilities/tuple/tuple.general/ignore.pass.cpp
@@ -48,9 +48,7 @@ int main() {
{
static_assert(test_ignore_constexpr(), "");
}
-#if defined(_LIBCPP_VERSION)
{
- static_assert(std::is_trivial<decltype(std::ignore)>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_trivial<decltype(std::ignore)>::value, "");
}
-#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 d1b974c50753..811dfc03ba11 100644
--- a/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp
+++ b/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp
@@ -29,5 +29,5 @@ int main () {
}
// 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.
+ // See https://reviews.llvm.org/D21320 for more information.
}
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 06284df56642..fed27aa84ff6 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
@@ -147,6 +147,7 @@ int main()
#if TEST_STD_VER > 11
{
constexpr std::tuple<Empty> t0{Empty()};
+ (void)t0;
}
{
constexpr std::tuple<A, A> t(3, 2);
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 b262f3cacecf..bf66da1626a0 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
@@ -102,6 +102,8 @@ int main()
using T = NonDefaultConstructible<>;
T v(42);
std::tuple<T, T> t(v, v);
+ (void)t;
std::tuple<T, T> t2(42, 42);
+ (void)t2;
}
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
index fa2f116f7718..731946608bab 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
@@ -49,6 +49,7 @@ int main()
{
{
std::tuple<> t;
+ (void)t;
}
{
std::tuple<int> t;
@@ -88,6 +89,7 @@ int main()
}
{
constexpr std::tuple<> t;
+ (void)t;
}
{
constexpr std::tuple<int> t;
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp
index 7b9c061b3ae8..85036b59186d 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp
@@ -15,10 +15,11 @@
// against libstdc++.
// XFAIL: gcc
-// <string>
+// <tuple>
-// Test that the constructors offered by std::basic_string are formulated
-// so they're compatible with implicit deduction guides.
+// Test that the constructors offered by std::tuple are formulated
+// so they're compatible with implicit deduction guides, or if that's not
+// possible that they provide explicit guides to make it work.
#include <tuple>
#include <memory>
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
index 74e6efd983bd..af9424806752 100644
--- 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
@@ -11,17 +11,18 @@
#include <tuple>
#include <string>
+#include "test_macros.h"
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}}
+ TEST_IGNORE_NODISCARD std::get<int>(t1); // expected-error@tuple:* {{type not found}}
+ TEST_IGNORE_NODISCARD std::get<long>(t1); // expected-note {{requested here}}
+ TEST_IGNORE_NODISCARD 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}}
+ TEST_IGNORE_NODISCARD std::get<char*>(t0); // expected-node {{requested here}}
// expected-error@tuple:* 1 {{type not in empty type list}}
}
diff --git a/test/std/utilities/utility/as_const/as_const.fail.cpp b/test/std/utilities/utility/as_const/as_const.fail.cpp
index 6334e1460259..c28957cfc505 100644
--- a/test/std/utilities/utility/as_const/as_const.fail.cpp
+++ b/test/std/utilities/utility/as_const/as_const.fail.cpp
@@ -18,5 +18,5 @@ struct S {int i;};
int main()
{
- std::as_const(S{});
+ std::as_const(S{});
}
diff --git a/test/std/utilities/utility/as_const/as_const.pass.cpp b/test/std/utilities/utility/as_const/as_const.pass.cpp
index 7bb5849d0bd0..268f2d1b04ee 100644
--- a/test/std/utilities/utility/as_const/as_const.pass.cpp
+++ b/test/std/utilities/utility/as_const/as_const.pass.cpp
@@ -37,10 +37,10 @@ void test(T& t)
int main()
{
- int i = 3;
- double d = 4.0;
- S s{2};
- test(i);
- test(d);
- test(s);
+ int i = 3;
+ double d = 4.0;
+ S s{2};
+ test(i);
+ test(d);
+ test(s);
}
diff --git a/test/std/utilities/utility/forward/forward.fail.cpp b/test/std/utilities/utility/forward/forward.fail.cpp
index a3bb890482ef..c845216d86dc 100644
--- a/test/std/utilities/utility/forward/forward.fail.cpp
+++ b/test/std/utilities/utility/forward/forward.fail.cpp
@@ -25,7 +25,7 @@ int main()
#if TEST_STD_VER >= 11
{
std::forward<A&>(source()); // expected-note {{requested here}}
- // expected-error@type_traits:* 1 {{static_assert failed "can not forward an rvalue as an lvalue"}}
+ // expected-error-re@type_traits:* 1 {{static_assert failed{{.*}} "can not forward an rvalue as an lvalue"}}
}
#else
{
diff --git a/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp b/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp
index 8e994126cc0d..4ca31f7debe8 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp
@@ -18,5 +18,5 @@
int main()
{
typedef std::pair<int, short> T;
- typename std::tuple_element<2, T>::type foo; // expected-error@utility:* {{Index out of bounds in std::tuple_element<std::pair<T1, T2>>}}
+ std::tuple_element<2, T>::type foo; // expected-error@utility:* {{Index out of bounds in std::tuple_element<std::pair<T1, T2>>}}
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
index ade8130d7822..715b65537761 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
@@ -71,7 +71,7 @@ int main()
P1 p1(42, 101);
P2 p2(p1);
assert(p2.first == 42);
- assert(p2.second = 101);
+ assert(p2.second == 101);
}
{
test_pair_const<AllCtors, AllCtors>(); // copy construction
diff --git a/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp
new file mode 100644
index 000000000000..7933dd99c1f4
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.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, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+// GCC's implementation of class template deduction is still immature and runs
+// into issues with libc++. However GCC accepts this code when compiling
+// against libstdc++.
+// XFAIL: gcc
+
+// <utility>
+
+// Test that the constructors offered by std::pair are formulated
+// so they're compatible with implicit deduction guides, or if that's not
+// possible that they provide explicit guides to make it work.
+
+#include <utility>
+#include <memory>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+
+// Overloads
+// ---------------
+// (1) pair(const T1&, const T2&) -> pair<T1, T2>
+// (2) explicit pair(const T1&, const T2&) -> pair<T1, T2>
+// (3) pair(pair const& t) -> decltype(t)
+// (4) pair(pair&& t) -> decltype(t)
+// (5) pair(pair<U1, U2> const&) -> pair<U1, U2>
+// (6) explicit pair(pair<U1, U2> const&) -> pair<U1, U2>
+// (7) pair(pair<U1, U2> &&) -> pair<U1, U2>
+// (8) explicit pair(pair<U1, U2> &&) -> pair<U1, U2>
+int main()
+{
+ using E = ExplicitTestTypes::TestType;
+ static_assert(!std::is_convertible<E const&, E>::value, "");
+ { // Testing (1)
+ int const x = 42;
+ std::pair t1("abc", x);
+ ASSERT_SAME_TYPE(decltype(t1), std::pair<const char*, int>);
+ }
+ { // Testing (2)
+ std::pair p1(E{}, 42);
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<E, int>);
+
+ const E t{};
+ std::pair p2(t, E{});
+ ASSERT_SAME_TYPE(decltype(p2), std::pair<E, E>);
+ }
+ { // Testing (3, 5)
+ std::pair<double, decltype(nullptr)> const p(0.0, nullptr);
+ std::pair p1(p);
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<double, decltype(nullptr)>);
+ }
+ { // Testing (3, 6)
+ std::pair<E, decltype(nullptr)> const p(E{}, nullptr);
+ std::pair p1(p);
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<E, decltype(nullptr)>);
+ }
+ { // Testing (4, 7)
+ std::pair<std::string, void*> p("abc", nullptr);
+ std::pair p1(std::move(p));
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<std::string, void*>);
+ }
+ { // Testing (4, 8)
+ std::pair<std::string, E> p("abc", E{});
+ std::pair p1(std::move(p));
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<std::string, E>);
+ }
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
index 2856190841c0..f5d3bb621deb 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
@@ -81,7 +81,7 @@ int main()
P1 p1(42, 101);
P2 p2(std::move(p1));
assert(p2.first == 42);
- assert(p2.second = 101);
+ assert(p2.second == 101);
}
{
test_pair_rv<AllCtors, AllCtors>();
diff --git a/test/std/utilities/utility/synopsis.pass.cpp b/test/std/utilities/utility/synopsis.pass.cpp
index 5f5b4eeaad52..009b65cbbe53 100644
--- a/test/std/utilities/utility/synopsis.pass.cpp
+++ b/test/std/utilities/utility/synopsis.pass.cpp
@@ -17,5 +17,6 @@
int main()
{
std::initializer_list<int> x;
+ (void)x;
}
diff --git a/test/std/utilities/variant/variant.get/get_index.pass.cpp b/test/std/utilities/variant/variant.get/get_index.pass.cpp
index 4f04f4a399d7..f52dc5556466 100644
--- a/test/std/utilities/variant/variant.get/get_index.pass.cpp
+++ b/test/std/utilities/variant/variant.get/get_index.pass.cpp
@@ -259,7 +259,7 @@ void test_throws_for_all_value_categories() {
auto test = [](auto idx, auto &&v) {
using Idx = decltype(idx);
try {
- std::get<Idx::value>(std::forward<decltype(v)>(v));
+ TEST_IGNORE_NODISCARD std::get<Idx::value>(std::forward<decltype(v)>(v));
} catch (const std::bad_variant_access &) {
return true;
} catch (...) { /* ... */
diff --git a/test/std/utilities/variant/variant.get/get_type.pass.cpp b/test/std/utilities/variant/variant.get/get_type.pass.cpp
index 63221f69c8f8..0a2222cbf277 100644
--- a/test/std/utilities/variant/variant.get/get_type.pass.cpp
+++ b/test/std/utilities/variant/variant.get/get_type.pass.cpp
@@ -259,7 +259,7 @@ void test_throws_for_all_value_categories() {
auto test = [](auto idx, auto &&v) {
using Idx = decltype(idx);
try {
- std::get<typename Idx::type>(std::forward<decltype(v)>(v));
+ TEST_IGNORE_NODISCARD std::get<typename Idx::type>(std::forward<decltype(v)>(v));
} catch (const std::bad_variant_access &) {
return true;
} catch (...) { /* ... */
diff --git a/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp b/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp
index cbaa2a568d5b..31521dae223c 100644
--- a/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp
+++ b/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp
@@ -28,5 +28,5 @@
int main() {
using V = std::variant<int, void *, const void *, long double>;
- typename std::variant_alternative<4, V>::type foo; // expected-error@variant:* {{Index out of bounds in std::variant_alternative<>}}
+ std::variant_alternative<4, V>::type foo; // expected-error@variant:* {{Index out of bounds in std::variant_alternative<>}}
}
diff --git a/test/std/utilities/variant/variant.visit/visit.pass.cpp b/test/std/utilities/variant/variant.visit/visit.pass.cpp
index 316f2d22b01d..c0db967933b0 100644
--- a/test/std/utilities/variant/variant.visit/visit.pass.cpp
+++ b/test/std/utilities/variant/variant.visit/visit.pass.cpp
@@ -300,7 +300,7 @@ void test_exceptions() {
#endif
}
-// See http://llvm.org/PR31916
+// See https://bugs.llvm.org/show_bug.cgi?id=31916
void test_caller_accepts_nonconst() {
struct A {};
struct Visitor {