aboutsummaryrefslogtreecommitdiff
path: root/test/std/experimental
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:58 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:58 +0000
commit53a420fba21cf1644972b34dcd811a43cdb8368d (patch)
tree66a19f6f8b65215772549a51d688492ab8addc0d /test/std/experimental
parentb50f1549701eb950921e5d6f2e55ba1a1dadbb43 (diff)
Notes
Diffstat (limited to 'test/std/experimental')
-rw-r--r--test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp5
-rw-r--r--test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp18
-rw-r--r--test/std/experimental/any/any.class/any.assign/copy.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.assign/move.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.assign/value.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.cons/copy.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.cons/default.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.cons/move.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.cons/value.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.observers/empty.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.observers/type.pass.cpp2
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp2
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp5
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp7
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp83
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp71
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp18
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp116
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp39
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp2
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp8
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp2
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp2
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp2
-rw-r--r--test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp6
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp77
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp30
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp15
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp15
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp15
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp25
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp29
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp6
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp19
-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.cpp9
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp4
-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/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp2
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp5
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp5
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp5
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp4
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp4
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp4
-rw-r--r--test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp15
-rw-r--r--test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp15
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp24
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp24
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp132
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp24
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp24
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp131
-rw-r--r--test/std/experimental/optional/optional.nullops/less_equal.pass.cpp4
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp13
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp19
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp13
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp18
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp23
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp23
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp6
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp34
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp3
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp5
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp5
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp18
-rw-r--r--test/std/experimental/optional/optional.specalg/swap.pass.cpp9
-rw-r--r--test/std/experimental/string.view/string.view.access/data.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.access/index.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.cons/default.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.iterators/begin.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.iterators/end.pass.cpp9
-rw-r--r--test/std/experimental/string.view/string.view.iterators/rend.pass.cpp7
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.ops/substr.pass.cpp1
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp40
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/detected_t.pass.cpp48
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/is_detected.pass.cpp37
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/is_detected_convertible.pass.cpp50
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/is_detected_exact.pass.cpp49
-rw-r--r--test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp68
-rw-r--r--test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp68
-rw-r--r--test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp41
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp1
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp2
-rw-r--r--test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp1
-rw-r--r--test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp32
-rw-r--r--test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp3
143 files changed, 1671 insertions, 229 deletions
diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
index eeb437379325..85ff8e15d162 100644
--- a/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
+++ b/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template <class PopulationIterator, class SampleIterator, class Distance,
@@ -32,5 +34,8 @@ template <class PopulationIterator, class SampleIterator> void test() {
}
int main() {
+ // expected-error@algorithm:* {{static_assert failed "SampleIterator must meet the requirements of RandomAccessIterator"}}
+ // expected-error@algorithm:* 2 {{does not provide a subscript operator}}
+ // expected-error@algorithm:* {{invalid operands}}
test<input_iterator<int *>, output_iterator<int *> >();
}
diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
index 1a9f9b099b20..531731791c5d 100644
--- a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
+++ b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
@@ -46,8 +46,8 @@ template <>
struct TestExpectations<std::input_iterator_tag>
: public ReservoirSampleExpectations {};
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test() {
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
typedef SampleIteratorType<SampleItem *> SampleIterator;
@@ -68,13 +68,13 @@ void test() {
assert(std::equal(oa, oa + os, oa1));
end = std::experimental::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
- SampleIterator(oa), os, g);
+ SampleIterator(oa), os, std::move(g));
assert(end.base() - oa == std::min(os, is));
assert(std::equal(oa, oa + os, oa2));
}
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test_empty_population() {
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
typedef SampleIteratorType<SampleItem *> SampleIterator;
@@ -88,8 +88,8 @@ void test_empty_population() {
assert(end.base() == oa);
}
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test_empty_sample() {
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
typedef SampleIteratorType<SampleItem *> SampleIterator;
@@ -103,8 +103,8 @@ void test_empty_sample() {
assert(end.base() == oa);
}
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test_small_population() {
// The population size is less than the sample size.
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
diff --git a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
index 8ee575c408f9..17b01fe630bf 100644
--- a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
+++ b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
@@ -18,7 +18,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.assign/move.pass.cpp b/test/std/experimental/any/any.class/any.assign/move.pass.cpp
index 0a2d71967cd4..49508febd941 100644
--- a/test/std/experimental/any/any.class/any.assign/move.pass.cpp
+++ b/test/std/experimental/any/any.class/any.assign/move.pass.cpp
@@ -18,7 +18,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "test_macros.h"
using std::experimental::any;
diff --git a/test/std/experimental/any/any.class/any.assign/value.pass.cpp b/test/std/experimental/any/any.class/any.assign/value.pass.cpp
index 8262990523c3..b42a4ba2b050 100644
--- a/test/std/experimental/any/any.class/any.assign/value.pass.cpp
+++ b/test/std/experimental/any/any.class/any.assign/value.pass.cpp
@@ -18,7 +18,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp b/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
index 3d0b34b27406..69341ca6b801 100644
--- a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
+++ b/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
@@ -16,7 +16,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.cons/default.pass.cpp b/test/std/experimental/any/any.class/any.cons/default.pass.cpp
index b52c83fc3881..3839e3afc81d 100644
--- a/test/std/experimental/any/any.class/any.cons/default.pass.cpp
+++ b/test/std/experimental/any/any.class/any.cons/default.pass.cpp
@@ -17,7 +17,7 @@
#include <type_traits>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
diff --git a/test/std/experimental/any/any.class/any.cons/move.pass.cpp b/test/std/experimental/any/any.class/any.cons/move.pass.cpp
index 40534cb55066..2a050946afab 100644
--- a/test/std/experimental/any/any.class/any.cons/move.pass.cpp
+++ b/test/std/experimental/any/any.class/any.cons/move.pass.cpp
@@ -18,7 +18,7 @@
#include <type_traits>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.cons/value.pass.cpp b/test/std/experimental/any/any.class/any.cons/value.pass.cpp
index 7bb134efd28a..a3ab0edc8b6b 100644
--- a/test/std/experimental/any/any.class/any.cons/value.pass.cpp
+++ b/test/std/experimental/any/any.class/any.cons/value.pass.cpp
@@ -23,7 +23,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
index 603490cef43d..781ed73f2b33 100644
--- a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
+++ b/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
@@ -16,7 +16,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
int main()
{
diff --git a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
index 064935167eb5..b1d315468968 100644
--- a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
+++ b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
@@ -18,7 +18,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
using std::experimental::any;
using std::experimental::any_cast;
diff --git a/test/std/experimental/any/any.class/any.observers/empty.pass.cpp b/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
index 8c681f37017f..bdf0d511b811 100644
--- a/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
+++ b/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
@@ -16,7 +16,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
int main()
{
diff --git a/test/std/experimental/any/any.class/any.observers/type.pass.cpp b/test/std/experimental/any/any.class/any.observers/type.pass.cpp
index 682b73bc98c4..6d0048403677 100644
--- a/test/std/experimental/any/any.class/any.observers/type.pass.cpp
+++ b/test/std/experimental/any/any.class/any.observers/type.pass.cpp
@@ -17,7 +17,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
int main()
{
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
index 9d9a5cdb4726..46ddbe5b05a1 100644
--- a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
+++ b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
@@ -21,7 +21,7 @@
#include <type_traits>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
using std::experimental::any;
using std::experimental::any_cast;
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
index e97560937fb0..47fe52f7b1dd 100644
--- a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -24,7 +24,7 @@
#include <type_traits>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
@@ -98,6 +98,8 @@ void checkThrows(any& a)
} catch (...) {
assert(false);
}
+#else
+ ((void)a);
#endif
}
@@ -176,7 +178,6 @@ void test_cast_to_value() {
Type::reset();
{
any a((Type(42)));
- any const& ca = a;
assert(Type::count == 1);
assert(Type::copied == 0);
assert(Type::moved == 1);
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 a6becb1bafaa..830e8123150a 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
@@ -87,9 +87,10 @@ TEST_CASE(access_denied_test_case)
env.create_file(testFile, 42);
// Test that we can iterator over the directory before changing the perms
- directory_iterator it(testDir);
- TEST_REQUIRE(it != directory_iterator{});
-
+ {
+ directory_iterator it(testDir);
+ TEST_REQUIRE(it != directory_iterator{});
+ }
// Change the permissions so we can no longer iterate
permissions(testDir, perms::none);
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp
index 1118497e06a8..f344e1153071 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp
@@ -24,6 +24,7 @@
#include <experimental/filesystem>
#include <type_traits>
+#include <string_view>
#include <cassert>
#include "test_macros.h"
@@ -77,6 +78,7 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
+ using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
@@ -99,6 +101,16 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC)
}
assert(LHS == E);
}
+ // basic_string_view
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ StrView RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS /= RHS;
+ }
+ assert(LHS == E);
+ }
// CharT*
{
path LHS(L); PathReserve(LHS, ReserveSize);
@@ -153,6 +165,7 @@ void doAppendSourceTest(AppendOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
+ using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
const Ptr R = TC.rhs;
@@ -172,6 +185,21 @@ void doAppendSourceTest(AppendOperatorTestcase const& TC)
assert(LHS == E);
assert(&Ref == &LHS);
}
+ // basic_string_view
+ {
+ path LHS(L);
+ StrView RHS(R);
+ path& Ref = (LHS /= RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ StrView RHS(R);
+ path& Ref = LHS.append(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
// Char*
{
path LHS(L);
@@ -218,6 +246,60 @@ void doAppendSourceTest(AppendOperatorTestcase const& TC)
}
}
+
+
+template <class It, class = decltype(fs::path{}.append(std::declval<It>()))>
+constexpr bool has_append(int) { return true; }
+template <class It>
+constexpr bool has_append(long) { return false; }
+
+template <class It, class = decltype(fs::path{}.operator/=(std::declval<It>()))>
+constexpr bool has_append_op(int) { return true; }
+template <class It>
+constexpr bool has_append_op(long) { return false; }
+
+template <class It>
+constexpr bool has_append() {
+ static_assert(has_append<It>(0) == has_append_op<It>(0), "must be same");
+ return has_append<It>(0) && has_append_op<It>(0);
+}
+
+void test_sfinae()
+{
+ using namespace fs;
+ {
+ using It = const char* const;
+ static_assert(has_append<It>(), "");
+ }
+ {
+ using It = input_iterator<const char*>;
+ static_assert(has_append<It>(), "");
+ }
+ {
+ struct Traits {
+ using iterator_category = std::input_iterator_tag;
+ using value_type = const char;
+ using pointer = const char*;
+ using reference = const char&;
+ using difference_type = std::ptrdiff_t;
+ };
+ using It = input_iterator<const char*, Traits>;
+ static_assert(has_append<It>(), "");
+ }
+ {
+ using It = output_iterator<const char*>;
+ static_assert(!has_append<It>(), "");
+
+ }
+ {
+ static_assert(!has_append<int*>(), "");
+ }
+ {
+ static_assert(!has_append<char>(), "");
+ static_assert(!has_append<const char>(), "");
+ }
+}
+
int main()
{
using namespace fs;
@@ -238,4 +320,5 @@ int main()
doAppendSourceAllocTest<char>(TC);
doAppendSourceAllocTest<wchar_t>(TC);
}
+ test_sfinae();
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp
index 4c2d5112d10b..9e48cbf1e7f2 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp
@@ -23,6 +23,7 @@
#include <experimental/filesystem>
#include <type_traits>
+#include <string_view>
#include <cassert>
#include "test_macros.h"
@@ -69,6 +70,32 @@ void RunTestCase(MultiStringType const& MS) {
assert(p.string<CharT>() == TestPath);
assert(p.string<CharT>() == S);
}
+ // basic_string<Char, Traits, Alloc>
+ {
+ const std::basic_string_view<CharT> S(TestPath);
+ path p; PathReserve(p, S.length() + 1);
+ {
+ // string provides a contigious iterator. No allocation needed.
+ DisableAllocationGuard g;
+ path& pref = (p = S);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ assert(p.string<CharT>() == S);
+ }
+ {
+ const std::basic_string_view<CharT> S(TestPath);
+ path p; PathReserve(p, S.length() + 1);
+ {
+ DisableAllocationGuard g;
+ path& pref = p.assign(S);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ assert(p.string<CharT>() == S);
+ }
//////////////////////////////////////////////////////////////////////////////
// Char* pointers
{
@@ -143,6 +170,49 @@ void RunTestCase(MultiStringType const& MS) {
}
}
+template <class It, class = decltype(fs::path{}.assign(std::declval<It>()))>
+constexpr bool has_assign(int) { return true; }
+template <class It>
+constexpr bool has_assign(long) { return false; }
+template <class It>
+constexpr bool has_assign() { return has_assign<It>(0); }
+
+void test_sfinae() {
+ using namespace fs;
+ {
+ using It = const char* const;
+ static_assert(std::is_assignable<path, It>::value, "");
+ static_assert(has_assign<It>(), "");
+ }
+ {
+ using It = input_iterator<const char*>;
+ static_assert(std::is_assignable<path, It>::value, "");
+ static_assert(has_assign<It>(), "");
+ }
+ {
+ struct Traits {
+ using iterator_category = std::input_iterator_tag;
+ using value_type = const char;
+ using pointer = const char*;
+ using reference = const char&;
+ using difference_type = std::ptrdiff_t;
+ };
+ using It = input_iterator<const char*, Traits>;
+ static_assert(std::is_assignable<path, It>::value, "");
+ static_assert(has_assign<It>(), "");
+ }
+ {
+ using It = output_iterator<const char*>;
+ static_assert(!std::is_assignable<path, It>::value, "");
+ static_assert(!has_assign<It>(), "");
+
+ }
+ {
+ static_assert(!std::is_assignable<path, int*>::value, "");
+ static_assert(!has_assign<int*>(), "");
+ }
+}
+
int main() {
for (auto const& MS : PathList) {
RunTestCase<char>(MS);
@@ -150,4 +220,5 @@ int main() {
RunTestCase<char16_t>(MS);
RunTestCase<char32_t>(MS);
}
+ test_sfinae();
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
index 557c1b24d88f..69d08e6eb49a 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
@@ -73,6 +73,11 @@ const PathCompareTest CompareTestCases[] =
#undef LONGC
#undef LONGD
+static inline int normalize_ret(int ret)
+{
+ return ret < 0 ? -1 : (ret > 0 ? 1 : 0);
+}
+
int main()
{
using namespace fs;
@@ -80,17 +85,18 @@ int main()
const path p1(TC.LHS);
const path p2(TC.RHS);
const std::string R(TC.RHS);
+ const std::string_view RV(TC.RHS);
const int E = TC.expect;
{ // compare(...) functions
DisableAllocationGuard g; // none of these operations should allocate
// check runtime results
- int ret1 = p1.compare(p2);
- int ret2 = p1.compare(R);
- int ret3 = p1.compare(TC.RHS);
- assert(ret1 == ret2 && ret1 == ret3);
- int normalized_ret = ret1 < 0 ? -1 : (ret1 > 0 ? 1 : 0);
- assert(normalized_ret == E);
+ int ret1 = normalize_ret(p1.compare(p2));
+ int ret2 = normalize_ret(p1.compare(R));
+ int ret3 = normalize_ret(p1.compare(TC.RHS));
+ int ret4 = normalize_ret(p1.compare(RV));
+ assert(ret1 == ret2 && ret1 == ret3 && ret1 == ret4);
+ assert(ret1 == E);
// check signatures
ASSERT_NOEXCEPT(p1.compare(p2));
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp
index 6e00afe0b49c..89269362d06f 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp
@@ -14,8 +14,9 @@
// class path
// path& operator+=(const path& x);
-// path& operator+=(const string_type& x); // Implemented as Source template
-// path& operator+=(const value_type* x); // Implemented as Source template
+// path& operator+=(const string_type& x);
+// path& operator+=(string_view x);
+// path& operator+=(const value_type* x);
// path& operator+=(value_type x);
// template <class Source>
// path& operator+=(const Source& x);
@@ -29,6 +30,8 @@
#include <experimental/filesystem>
#include <type_traits>
+#include <string>
+#include <string_view>
#include <cassert>
#include "test_macros.h"
@@ -82,6 +85,7 @@ void doConcatSourceAllocTest(ConcatOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
+ using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
@@ -98,6 +102,16 @@ void doConcatSourceAllocTest(ConcatOperatorTestcase const& TC)
}
assert(LHS == E);
}
+ // basic_string_view
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ StrView RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS += RHS;
+ }
+ assert(LHS == E);
+ }
// CharT*
{
path LHS(L); PathReserve(LHS, ReserveSize);
@@ -152,6 +166,7 @@ void doConcatSourceTest(ConcatOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
+ using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
const Ptr R = TC.rhs;
@@ -171,6 +186,21 @@ void doConcatSourceTest(ConcatOperatorTestcase const& TC)
assert(LHS == E);
assert(&Ref == &LHS);
}
+ // basic_string_view
+ {
+ path LHS(L);
+ StrView RHS(R);
+ path& Ref = (LHS += RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ StrView RHS(R);
+ path& Ref = LHS.concat(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
// Char*
{
path LHS(L);
@@ -235,6 +265,68 @@ void doConcatECharTest(ConcatOperatorTestcase const& TC)
}
}
+
+template <class It, class = decltype(fs::path{}.concat(std::declval<It>()))>
+constexpr bool has_concat(int) { return true; }
+template <class It>
+constexpr bool has_concat(long) { return false; }
+
+template <class It, class = decltype(fs::path{}.operator+=(std::declval<It>()))>
+constexpr bool has_concat_op(int) { return true; }
+template <class It>
+constexpr bool has_concat_op(long) { return false; }
+template <class It>
+constexpr bool has_concat_op() { return has_concat_op<It>(0); }
+
+template <class It>
+constexpr bool has_concat() {
+ static_assert(has_concat<It>(0) == has_concat_op<It>(0), "must be same");
+ return has_concat<It>(0) && has_concat_op<It>(0);
+}
+
+void test_sfinae() {
+ using namespace fs;
+ {
+ static_assert(has_concat_op<char>(), "");
+ static_assert(has_concat_op<const char>(), "");
+ static_assert(has_concat_op<char16_t>(), "");
+ static_assert(has_concat_op<const char16_t>(), "");
+ }
+ {
+ using It = const char* const;
+ static_assert(has_concat<It>(), "");
+ }
+ {
+ using It = input_iterator<const char*>;
+ static_assert(has_concat<It>(), "");
+ }
+ {
+ struct Traits {
+ using iterator_category = std::input_iterator_tag;
+ using value_type = const char;
+ using pointer = const char*;
+ using reference = const char&;
+ using difference_type = std::ptrdiff_t;
+ };
+ using It = input_iterator<const char*, Traits>;
+ static_assert(has_concat<It>(), "");
+ }
+ {
+ using It = output_iterator<const char*>;
+ static_assert(!has_concat<It>(), "");
+ }
+ {
+ static_assert(!has_concat<int>(0), "");
+ // operator+=(int) is well formed since it converts to operator+=(value_type)
+ // but concat(int) isn't valid because there is no concat(value_type).
+ // This should probably be addressed by a LWG issue.
+ static_assert(has_concat_op<int>(), "");
+ }
+ {
+ static_assert(!has_concat<int*>(), "");
+ }
+}
+
int main()
{
using namespace fs;
@@ -246,6 +338,13 @@ int main()
assert(LHS == (const char*)TC.expect);
assert(&Ref == &LHS);
}
+ {
+ path LHS((const char*)TC.lhs);
+ std::string_view RHS((const char*)TC.rhs);
+ path& Ref = (LHS += RHS);
+ assert(LHS == (const char*)TC.expect);
+ assert(&Ref == &LHS);
+ }
doConcatSourceTest<char> (TC);
doConcatSourceTest<wchar_t> (TC);
doConcatSourceTest<char16_t>(TC);
@@ -265,6 +364,18 @@ int main()
}
assert(LHS == E);
}
+ {
+ path LHS((const char*)TC.lhs);
+ std::string_view RHS((const char*)TC.rhs);
+ const char* E = TC.expect;
+ PathReserve(LHS, StrLen(E) + 5);
+ {
+ DisableAllocationGuard g;
+ path& Ref = (LHS += RHS);
+ assert(&Ref == &LHS);
+ }
+ assert(LHS == E);
+ }
doConcatSourceAllocTest<char>(TC);
doConcatSourceAllocTest<wchar_t>(TC);
}
@@ -274,4 +385,5 @@ int main()
doConcatECharTest<char16_t>(TC);
doConcatECharTest<char32_t>(TC);
}
+ test_sfinae();
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp
index d89e7c815efb..a04f35af5780 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp
@@ -47,6 +47,13 @@ void RunTestCase(MultiStringType const& MS) {
assert(p.string<CharT>() == TestPath);
assert(p.string<CharT>() == S);
}
+ {
+ const std::basic_string_view<CharT> S(TestPath);
+ path p(S);
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ assert(p.string<CharT>() == S);
+ }
// Char* pointers
{
path p(TestPath);
@@ -73,6 +80,37 @@ void RunTestCase(MultiStringType const& MS) {
}
}
+void test_sfinae() {
+ using namespace fs;
+ {
+ using It = const char* const;
+ static_assert(std::is_constructible<path, It>::value, "");
+ }
+ {
+ using It = input_iterator<const char*>;
+ static_assert(std::is_constructible<path, It>::value, "");
+ }
+ {
+ struct Traits {
+ using iterator_category = std::input_iterator_tag;
+ using value_type = const char;
+ using pointer = const char*;
+ using reference = const char&;
+ using difference_type = std::ptrdiff_t;
+ };
+ using It = input_iterator<const char*, Traits>;
+ static_assert(std::is_constructible<path, It>::value, "");
+ }
+ {
+ using It = output_iterator<const char*>;
+ static_assert(!std::is_constructible<path, It>::value, "");
+
+ }
+ {
+ static_assert(!std::is_constructible<path, int*>::value, "");
+ }
+}
+
int main() {
for (auto const& MS : PathList) {
RunTestCase<char>(MS);
@@ -80,4 +118,5 @@ int main() {
RunTestCase<char16_t>(MS);
RunTestCase<char32_t>(MS);
}
+ test_sfinae();
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
index 5be934968c46..7881c9700d6e 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
@@ -28,7 +28,6 @@ namespace fs = std::experimental::filesystem;
int main() {
using namespace fs;
- const path p("/foo/bar/baz");
{
path p;
ASSERT_NOEXCEPT(p.clear());
@@ -37,6 +36,7 @@ int main() {
assert(p.empty());
}
{
+ const path p("/foo/bar/baz");
path p2(p);
assert(p == p2);
p2.clear();
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
index 4ad9084dbf81..e414202bf8ff 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
@@ -35,16 +35,24 @@ const RemoveFilenameTestcase TestCases[] =
{
{"", ""}
, {"/", ""}
+ , {"//", ""}
+ , {"///", ""}
, {"\\", ""}
, {".", ""}
, {"..", ""}
, {"/foo", "/"}
+ , {"//foo", ""}
+ , {"//foo/", ""}
+ , {"//foo///", ""}
+ , {"///foo", "/"}
+ , {"///foo/", "///foo"}
, {"/foo/", "/foo"}
, {"/foo/.", "/foo"}
, {"/foo/..", "/foo"}
, {"/foo/////", "/foo"}
, {"/foo\\\\", "/"}
, {"/foo//\\/", "/foo//\\"}
+ , {"///foo", "/"}
, {"file.txt", ""}
, {"bar/../baz/./file.txt", "bar/../baz/."}
};
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
index 7cf3564bb9b1..796609432727 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
@@ -30,8 +30,8 @@ int main()
using namespace fs;
const char* const value = "hello world";
const std::string str_value = value;
- path p(value);
{ // Check signature
+ path p(value);
ASSERT_SAME_TYPE(path::value_type const*, decltype(p.c_str()));
ASSERT_NOEXCEPT(p.c_str());
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
index 7f8df27faf0a..db1326483776 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
@@ -28,8 +28,8 @@ int main()
{
using namespace fs;
const char* const value = "hello world";
- path p(value);
{ // Check signature
+ path p(value);
ASSERT_SAME_TYPE(path::string_type const&, decltype(p.native()));
ASSERT_NOEXCEPT(p.native());
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
index 9ef83f989aa5..013d26cdb7f6 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
@@ -30,8 +30,8 @@ int main()
using namespace fs;
using string_type = path::string_type;
const char* const value = "hello world";
- path p(value);
{ // Check signature
+ path p(value);
static_assert(std::is_convertible<path, string_type>::value, "");
static_assert(std::is_constructible<string_type, path>::value, "");
ASSERT_SAME_TYPE(string_type, decltype(p.operator string_type()));
diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
index e8d150f1e39d..4b7ad735c7f8 100644
--- a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
@@ -40,7 +40,6 @@ void doIOTest() {
using namespace fs;
using Ptr = const CharT*;
using StrStream = std::basic_stringstream<CharT>;
- const char* const InCStr = InStr;
const Ptr E = OutStr;
const path p((const char*)InStr);
StrStream ss;
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 1cddccd0d724..8f6009d399c1 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
@@ -91,8 +91,10 @@ TEST_CASE(access_denied_test_case)
env.create_file(testFile, 42);
// Test that we can iterator over the directory before changing the perms
- RDI it(testDir);
- TEST_REQUIRE(it != RDI{});
+ {
+ RDI it(testDir);
+ TEST_REQUIRE(it != RDI{});
+ }
// Change the permissions so we can no longer iterate
permissions(testDir, perms::none);
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 7d318719f740..c9b42b3596ad 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
@@ -19,6 +19,7 @@
#include <experimental/filesystem>
#include <type_traits>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -59,6 +60,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)t); ((void)ec);
return true;
#endif
};
@@ -69,37 +71,44 @@ TEST_CASE(test_error_reporting)
const path fifo = env.create_fifo("fifo");
TEST_REQUIRE(is_other(fifo));
+ const auto test_ec = GetTestEC();
+
// !exists(f)
{
- std::error_code ec;
+ std::error_code ec = test_ec;
const path f = StaticEnv::DNE;
const path t = env.test_root;
fs::copy(f, t, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(f, t, ec));
}
{ // equivalent(f, t) == true
- std::error_code ec;
+ std::error_code ec = test_ec;
fs::copy(file, file, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(file, file, ec));
}
{ // is_directory(from) && is_file(to)
- std::error_code ec;
+ std::error_code ec = test_ec;
fs::copy(dir, file, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(dir, file, ec));
}
{ // is_other(from)
- std::error_code ec;
+ std::error_code ec = test_ec;
fs::copy(fifo, dir, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(fifo, dir, ec));
}
{ // is_other(to)
- std::error_code ec;
+ std::error_code ec = test_ec;
fs::copy(file, fifo, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(file, fifo, ec));
}
}
@@ -129,11 +138,13 @@ TEST_CASE(from_is_symlink)
std::error_code ec = GetTestEC();
fs::copy(symlink, file, copy_options::copy_symlinks, ec);
TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
}
{ // create symlinks but target exists
std::error_code ec = GetTestEC();
fs::copy(symlink, file, copy_options::create_symlinks, ec);
TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
}
}
@@ -187,7 +198,7 @@ TEST_CASE(from_is_directory)
{
struct FileInfo {
path filename;
- int size;
+ std::size_t size;
};
const FileInfo files[] = {
{"file1", 0},
@@ -246,6 +257,60 @@ TEST_CASE(from_is_directory)
TEST_CHECK(file_size(nested_created) == FI.size);
}
}
+}
+TEST_CASE(test_copy_symlinks_to_symlink_dir)
+{
+ scoped_test_env env;
+ const path file1 = env.create_file("file1", 42);
+ const path file2 = env.create_file("file2", 101);
+ const path file2_sym = env.create_symlink(file2, "file2_sym");
+ const path dir = env.create_dir("dir");
+ const path dir_sym = env.create_symlink(dir, "dir_sym");
+ {
+ std::error_code ec = GetTestEC();
+ fs::copy(file1, dir_sym, copy_options::copy_symlinks, ec);
+ TEST_CHECK(!ec);
+ const path dest = env.make_env_path("dir/file1");
+ TEST_CHECK(exists(dest));
+ TEST_CHECK(!is_symlink(dest));
+ TEST_CHECK(file_size(dest) == 42);
+ }
}
+
+
+TEST_CASE(test_dir_create_symlink)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir1");
+ const path dest = env.make_env_path("dne");
+ {
+ std::error_code ec = GetTestEC();
+ fs::copy(dir, dest, copy_options::create_symlinks, ec);
+ TEST_CHECK(ec == std::make_error_code(std::errc::is_a_directory));
+ TEST_CHECK(!exists(dest));
+ TEST_CHECK(!is_symlink(dest));
+ }
+ {
+ std::error_code ec = GetTestEC();
+ fs::copy(dir, dest, copy_options::create_symlinks|copy_options::recursive, ec);
+ TEST_CHECK(ec == std::make_error_code(std::errc::is_a_directory));
+ TEST_CHECK(!exists(dest));
+ TEST_CHECK(!is_symlink(dest));
+ }
+}
+
+TEST_CASE(test_otherwise_no_effects_clause)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir1");
+ { // skip copy because of directory
+ const path dest = env.make_env_path("dest1");
+ std::error_code ec;
+ fs::copy(dir, dest, CO::directories_only, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(dest));
+ }
+}
+
TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
index ac9877bbd9ce..8c5241c71af8 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
@@ -62,6 +62,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)t); ((void)ec);
return true;
#endif
};
@@ -138,7 +139,6 @@ TEST_CASE(test_attributes_get_copied)
const path file = env.create_file("file1", 42);
const path dest = env.make_env_path("file2");
auto st = status(file);
- perms default_perms = st.permissions();
perms new_perms = perms::owner_read;
permissions(file, new_perms);
std::error_code ec;
@@ -153,12 +153,36 @@ TEST_CASE(copy_dir_test)
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path dest = env.create_dir("dir1");
- std::error_code ec;
+ std::error_code ec = GetTestEC();
TEST_CHECK(fs::copy_file(file, dest, ec) == false);
TEST_CHECK(ec);
- ec.clear();
+ TEST_CHECK(ec != GetTestEC());
+ ec = GetTestEC();
TEST_CHECK(fs::copy_file(dest, file, ec) == false);
TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+}
+
+TEST_CASE(non_regular_file_test)
+{
+ scoped_test_env env;
+ const path fifo = env.create_fifo("fifo");
+ const path dest = env.make_env_path("dest");
+ const path file = env.create_file("file", 42);
+ {
+ std::error_code ec = GetTestEC();
+ TEST_REQUIRE(fs::copy_file(fifo, dest, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(!exists(dest));
+ }
+ {
+ std::error_code ec = GetTestEC();
+ TEST_REQUIRE(fs::copy_file(file, fifo, copy_options::overwrite_existing, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(is_fifo(fifo));
+ }
}
TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
index 6fae11195206..fe4729806772 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)t); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
index e0473754cc88..85a3b6cb3465 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
@@ -37,21 +37,6 @@ TEST_CASE(test_signatures)
TEST_CASE(test_error_reporting)
{
- auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
- {
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try {
- fs::create_directory_symlink(f, t);
- return true;
- } catch (filesystem_error const& err) {
- return err.path1() == f
- && err.code() == ec;
- }
-#else
- return true;
-#endif
- };
-
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
index 4a865fdee7e8..7aefece46a4a 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
@@ -36,21 +36,6 @@ TEST_CASE(test_signatures)
TEST_CASE(test_error_reporting)
{
- auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
- {
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try {
- fs::create_hard_link(f, t);
- return true;
- } catch (filesystem_error const& err) {
- return err.path1() == f
- && err.code() == ec;
- }
-#else
- return true;
-#endif
- };
-
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
index 35ba57f3ab46..d261d987a1ee 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
@@ -37,21 +37,6 @@ TEST_CASE(test_signatures)
TEST_CASE(test_error_reporting)
{
- auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
- {
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try {
- fs::create_symlink(f, t);
- return true;
- } catch (filesystem_error const& err) {
- return err.path1() == f
- && err.code() == ec;
- }
-#else
- return true;
-#endif
- };
-
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
index abc50e9c6a41..7537ac20c757 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -45,18 +45,27 @@ TEST_CASE(hard_link_count_for_file)
TEST_CASE(hard_link_count_for_directory)
{
- uintmax_t DirExpect = 3;
- uintmax_t Dir3Expect = 2;
+ uintmax_t DirExpect = 3; // hard link from . .. and Dir2
+ uintmax_t Dir3Expect = 2; // hard link from . ..
+ uintmax_t DirExpectAlt = DirExpect;
+ uintmax_t Dir3ExpectAlt = Dir3Expect;
#if defined(__APPLE__)
- DirExpect += 2;
- Dir3Expect += 1;
+ // Filesystems formatted with case sensitive hfs+ behave unixish as
+ // expected. Normal hfs+ filesystems report the number of directory
+ // entries instead.
+ DirExpectAlt = 5; // . .. Dir2 file1 file2
+ Dir3Expect = 3; // . .. file5
#endif
- TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect);
- TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
+ hard_link_count(StaticEnv::Dir) == DirExpectAlt);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
+ hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
std::error_code ec;
- TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect);
- TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
+ hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
+ hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt);
}
TEST_CASE(hard_link_count_increments_test)
{
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 ba07d09d10d9..bc62086c2cff 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
@@ -77,4 +77,33 @@ TEST_CASE(test_is_empty_fails)
TEST_CHECK_THROW(filesystem_error, is_empty(dir2));
}
+TEST_CASE(test_directory_access_denied)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file1 = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(is_empty(dir, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+
+ TEST_CHECK_THROW(filesystem_error, is_empty(dir));
+}
+
+
+TEST_CASE(test_fifo_fails)
+{
+ scoped_test_env env;
+ const path fifo = env.create_fifo("fifo");
+
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(is_empty(fifo, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+
+ TEST_CHECK_THROW(filesystem_error, is_empty(fifo));
+}
+
TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
index b177693c09bd..4177392141e5 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
@@ -35,7 +35,8 @@ TEST_CASE(test_signatures)
std::error_code ec; ((void)ec);
ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts));
// Not noexcept because of narrow contract
- ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts, ec));
+ LIBCPP_ONLY(
+ ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts, ec)));
}
TEST_CASE(test_error_reporting)
@@ -52,6 +53,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)opts); ((void)ec);
return true;
#endif
};
@@ -115,7 +117,7 @@ TEST_CASE(basic_permissions_test)
permissions(TC.p, TC.set_perms, ec);
TEST_CHECK(!ec);
auto pp = status(TC.p).permissions();
- TEST_CHECK(status(TC.p).permissions() == TC.expected);
+ TEST_CHECK(pp == TC.expected);
}
}
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
index 00581cbe8bcc..d69e95ce5d5c 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
@@ -51,6 +51,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp
index edb0c4fc76c9..f7ce8a30e64e 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp
@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
index aecfce7885e9..b84c18c1da06 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp
index c2ae854c0bf6..e265c7af6b10 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp
@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)t); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
index 8a6aa09b14c7..f7c2ee14e83a 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
@@ -52,6 +52,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)s); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp
index 865191520be3..8f241810fc7d 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp
@@ -57,6 +57,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
index 215c35a33f30..148564e61961 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
@@ -51,7 +51,6 @@ TEST_CASE(basic_tests)
const path dir_perms = env.create_dir("bad_perms_dir");
const path nested_dir = env.create_dir("bad_perms_dir/nested");
permissions(dir_perms, perms::none);
- const std::error_code set_ec = std::make_error_code(std::errc::address_in_use);
const std::error_code expect_ec = std::make_error_code(std::errc::not_a_directory);
struct TestCase {
std::string name;
@@ -66,7 +65,7 @@ TEST_CASE(basic_tests)
PutEnv(TC.name, TC.p);
}
for (auto& TC : cases) {
- std::error_code ec = set_ec;
+ std::error_code ec = GetTestEC();
path ret = temp_directory_path(ec);
TEST_CHECK(!ec);
TEST_CHECK(ret == TC.p);
@@ -75,21 +74,25 @@ TEST_CASE(basic_tests)
// Set the env variable to a path that does not exist and check
// that it fails.
PutEnv(TC.name, dne);
- ec = set_ec;
+ ec = GetTestEC();
ret = temp_directory_path(ec);
- TEST_CHECK(ec == expect_ec);
+ LIBCPP_ONLY(TEST_CHECK(ec == expect_ec));
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(ec);
TEST_CHECK(ret == "");
// Set the env variable to point to a file and check that it fails.
PutEnv(TC.name, file);
- ec = set_ec;
+ ec = GetTestEC();
ret = temp_directory_path(ec);
- TEST_CHECK(ec == expect_ec);
+ LIBCPP_ONLY(TEST_CHECK(ec == expect_ec));
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(ec);
TEST_CHECK(ret == "");
// Set the env variable to point to a dir we can't access
PutEnv(TC.name, nested_dir);
- ec = set_ec;
+ ec = GetTestEC();
ret = temp_directory_path(ec);
TEST_CHECK(ec == std::make_error_code(std::errc::permission_denied));
TEST_CHECK(ret == "");
@@ -99,7 +102,7 @@ TEST_CASE(basic_tests)
}
// No env variables are defined
{
- std::error_code ec = set_ec;
+ std::error_code ec = GetTestEC();
path ret = temp_directory_path(ec);
TEST_CHECK(!ec);
TEST_CHECK(ret == "/tmp");
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 bc44f1f6cbbf..467e09d5d2b6 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
@@ -43,7 +43,7 @@ template <typename T> struct MyHash {
};
template <typename Iter1, typename Iter2>
-void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned /*max_count*/) {
std::experimental::boyer_moore_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
s{b2, e2};
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 743ab92156be..b0e5e877dfe1 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
@@ -58,7 +58,9 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
count_equal>
s{b2, e2};
+ count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
+ assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
@@ -78,7 +80,9 @@ test()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
- do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+
int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1};
@@ -93,6 +97,7 @@ test()
const unsigned sh = sizeof(ih)/sizeof(ih[0]);
int ii[] = {1, 1, 2};
do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+
}
template <class Iter1, class Iter2>
@@ -112,7 +117,9 @@ test2()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+
char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
char ic[] = {1};
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
index b27cabd76ab3..c80ef7968628 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
@@ -54,7 +54,7 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
-// assert(count_equal::count <= max_count);
+ assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
@@ -74,7 +74,9 @@ test()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+
int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1};
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 28a3f6d912f8..abfab17d02ce 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
@@ -42,7 +42,7 @@ template <typename T> struct MyHash {
};
template <typename Iter1, typename Iter2>
-void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned /*max_count*/) {
std::experimental::boyer_moore_horspool_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
s{b2, e2};
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 3a6647dbc7f5..28f3324966ea 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
@@ -57,7 +57,9 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
count_equal>
s{b2, e2};
+ count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
+ assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
index 8c78b9de0b35..4e961ec9e20c 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
@@ -53,7 +53,7 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
-// assert(count_equal::count <= max_count);
+ assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
index 50a71eeca82b..acc42d39f60c 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
@@ -23,7 +23,12 @@
#include <tuple>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
index b6adb558b1e4..05cf82cfbd2b 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
@@ -23,7 +23,12 @@
#include <tuple>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
index a913742a854b..1a76072661d6 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
@@ -23,7 +23,12 @@
#include <tuple>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
index d0d76503da50..8f78521995d8 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
@@ -24,7 +24,11 @@
#include <tuple>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
index 73e4f0e101a8..a02dcf336960 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
@@ -21,7 +21,11 @@
#include <type_traits>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp b/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
index 26cf903fe0d8..efb529b3c118 100644
--- a/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
+++ b/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
@@ -73,8 +73,8 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
{
TestResource R2;
- auto& P = R2.getController();
- P.throw_on_alloc = true;
+ auto& P2 = R2.getController();
+ P2.throw_on_alloc = true;
memory_resource& M2 = R2;
try {
M2.allocate(42);
diff --git a/test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp b/test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..7b2527f22bf4
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+// <numeric>
+
+#include <experimental/numeric>
+
+int main () {}
diff --git a/test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp b/test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..7b2527f22bf4
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+// <numeric>
+
+#include <experimental/numeric>
+
+int main () {}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp
new file mode 100644
index 000000000000..8b069832aac8
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type, the program is ill-formed.
+
+#include <experimental/numeric>
+
+
+int main()
+{
+ std::experimental::gcd(2.0, 4);
+}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp
new file mode 100644
index 000000000000..ca9b871ef5e0
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type, the program is ill-formed.
+
+#include <experimental/numeric>
+
+
+int main()
+{
+ std::experimental::gcd(4, 6.0);
+}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
new file mode 100644
index 000000000000..a52b50b391cd
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
@@ -0,0 +1,132 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+#include <experimental/numeric>
+#include <cassert>
+#include <cstdlib> // for rand()
+#include <iostream>
+
+constexpr struct {
+ int x;
+ int y;
+ int expect;
+} Cases[] = {
+ {0, 0, 0},
+ {1, 0, 1},
+ {0, 1, 1},
+ {1, 1, 1},
+ {2, 3, 1},
+ {2, 4, 2},
+ {36, 17, 1},
+ {36, 18, 18}
+};
+
+
+template <typename Input1, typename Input2, typename Output>
+constexpr bool test0(Input1 in1, Input2 in2, Output out)
+{
+ static_assert((std::is_same<Output, decltype(std::experimental::gcd(in1, in2))>::value), "" );
+ static_assert((std::is_same<Output, decltype(std::experimental::gcd(in2, in1))>::value), "" );
+ return out == std::experimental::gcd(in1, in2) ? true : (std::abort(), false);
+}
+
+
+template <typename Input1, typename Input2 = Input1>
+constexpr bool do_test(int = 0)
+{
+ using S1 = typename std::make_signed<Input1>::type;
+ using S2 = typename std::make_signed<Input2>::type;
+ using U1 = typename std::make_unsigned<Input1>::type;
+ using U2 = typename std::make_unsigned<Input2>::type;
+ bool accumulate = true;
+ for (auto TC : Cases) {
+ { // Test with two signed types
+ using Output = std::common_type_t<S1, S2>;
+ accumulate &= test0<S1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, -TC.y, TC.expect);
+ }
+ { // test with two unsigned types
+ using Output = std::common_type_t<U1, U2>;
+ accumulate &= test0<U1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, U1, Output>(TC.x, TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S1, U2>;
+ accumulate &= test0<S1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, U2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, -TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S2, U1>;
+ accumulate &= test0<S2, U1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, U1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, -TC.y, TC.expect);
+ }
+ }
+ return accumulate;
+}
+
+int main()
+{
+ auto non_cce = std::rand(); // a value that can't possibly be constexpr
+
+ static_assert(do_test<signed char>(), "");
+ static_assert(do_test<short>(), "");
+ static_assert(do_test<int>(), "");
+ static_assert(do_test<long>(), "");
+ static_assert(do_test<long long>(), "");
+
+ assert(do_test<signed char>(non_cce));
+ assert(do_test<short>(non_cce));
+ assert(do_test<int>(non_cce));
+ assert(do_test<long>(non_cce));
+ assert(do_test<long long>(non_cce));
+
+ static_assert(do_test< int8_t>(), "");
+ static_assert(do_test<int16_t>(), "");
+ static_assert(do_test<int32_t>(), "");
+ static_assert(do_test<int64_t>(), "");
+
+ assert(do_test< int8_t>(non_cce));
+ assert(do_test<int16_t>(non_cce));
+ assert(do_test<int32_t>(non_cce));
+ assert(do_test<int64_t>(non_cce));
+
+ static_assert(do_test<signed char, int>(), "");
+ static_assert(do_test<int, signed char>(), "");
+ static_assert(do_test<short, int>(), "");
+ static_assert(do_test<int, short>(), "");
+ static_assert(do_test<int, long>(), "");
+ static_assert(do_test<long, int>(), "");
+ static_assert(do_test<int, long long>(), "");
+ static_assert(do_test<long long, int>(), "");
+
+ assert((do_test<signed char, int>(non_cce)));
+ assert((do_test<int, signed char>(non_cce)));
+ assert((do_test<short, int>(non_cce)));
+ assert((do_test<int, short>(non_cce)));
+ assert((do_test<int, long>(non_cce)));
+ assert((do_test<long, int>(non_cce)));
+ assert((do_test<int, long long>(non_cce)));
+ assert((do_test<long long, int>(non_cce)));
+}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp
new file mode 100644
index 000000000000..d12b35609b1e
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type, the program is ill-formed.
+
+#include <experimental/numeric>
+
+
+int main()
+{
+ std::experimental::lcm(2.0, 4);
+}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp
new file mode 100644
index 000000000000..d5731870eb19
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type, the program is ill-formed.
+
+#include <experimental/numeric>
+
+
+int main()
+{
+ std::experimental::lcm(4, 6.0);
+}
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
new file mode 100644
index 000000000000..e3c109f7447b
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
@@ -0,0 +1,131 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+#include <experimental/numeric>
+#include <cassert>
+#include <cstdlib>
+#include <iostream>
+
+constexpr struct {
+ int x;
+ int y;
+ int expect;
+} Cases[] = {
+ {0, 0, 0},
+ {1, 0, 0},
+ {0, 1, 0},
+ {1, 1, 1},
+ {2, 3, 6},
+ {2, 4, 4},
+ {3, 17, 51},
+ {36, 18, 36}
+};
+
+template <typename Input1, typename Input2, typename Output>
+constexpr bool test0(Input1 in1, Input2 in2, Output out)
+{
+ static_assert((std::is_same<Output, decltype(std::experimental::lcm(Input1(0), Input2(0)))>::value), "" );
+ static_assert((std::is_same<Output, decltype(std::experimental::lcm(Input2(0), Input1(0)))>::value), "" );
+ return out == std::experimental::lcm(in1, in2) ? true : (std::abort(), false);
+}
+
+
+template <typename Input1, typename Input2 = Input1>
+constexpr bool do_test(int = 0)
+{
+ using S1 = typename std::make_signed<Input1>::type;
+ using S2 = typename std::make_signed<Input2>::type;
+ using U1 = typename std::make_unsigned<Input1>::type;
+ using U2 = typename std::make_unsigned<Input2>::type;
+ bool accumulate = true;
+ for (auto TC : Cases) {
+ { // Test with two signed types
+ using Output = std::common_type_t<S1, S2>;
+ accumulate &= test0<S1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, -TC.y, TC.expect);
+ }
+ { // test with two unsigned types
+ using Output = std::common_type_t<U1, U2>;
+ accumulate &= test0<U1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, U1, Output>(TC.x, TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S1, U2>;
+ accumulate &= test0<S1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, U2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, -TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S2, U1>;
+ accumulate &= test0<S2, U1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, U1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, -TC.y, TC.expect);
+ }
+ }
+ return accumulate;
+}
+
+int main()
+{
+ auto non_cce = std::rand(); // a value that can't possibly be constexpr
+
+ static_assert(do_test<signed char>(), "");
+ static_assert(do_test<short>(), "");
+ static_assert(do_test<int>(), "");
+ static_assert(do_test<long>(), "");
+ static_assert(do_test<long long>(), "");
+
+ assert(do_test<signed char>(non_cce));
+ assert(do_test<short>(non_cce));
+ assert(do_test<int>(non_cce));
+ assert(do_test<long>(non_cce));
+ assert(do_test<long long>(non_cce));
+
+ static_assert(do_test< int8_t>(), "");
+ static_assert(do_test<int16_t>(), "");
+ static_assert(do_test<int32_t>(), "");
+ static_assert(do_test<int64_t>(), "");
+
+ assert(do_test< int8_t>(non_cce));
+ assert(do_test<int16_t>(non_cce));
+ assert(do_test<int32_t>(non_cce));
+ assert(do_test<int64_t>(non_cce));
+
+ static_assert(do_test<signed char, int>(), "");
+ static_assert(do_test<int, signed char>(), "");
+ static_assert(do_test<short, int>(), "");
+ static_assert(do_test<int, short>(), "");
+ static_assert(do_test<int, long>(), "");
+ static_assert(do_test<long, int>(), "");
+ static_assert(do_test<int, long long>(), "");
+ static_assert(do_test<long long, int>(), "");
+
+ assert((do_test<signed char, int>(non_cce)));
+ assert((do_test<int, signed char>(non_cce)));
+ assert((do_test<short, int>(non_cce)));
+ assert((do_test<int, short>(non_cce)));
+ assert((do_test<int, long>(non_cce)));
+ assert((do_test<long, int>(non_cce)));
+ assert((do_test<int, long long>(non_cce)));
+ assert((do_test<long long, int>(non_cce)));
+}
diff --git a/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp b/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
index cddb27e93a6a..ac7be156c69c 100644
--- a/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
@@ -15,9 +15,11 @@
#include <experimental/optional>
+#include "test_macros.h"
+
int main()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
index 3d0d2e03158b..0215417ce0b2 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
@@ -19,6 +19,14 @@
using std::experimental::optional;
+struct AllowConstAssign {
+ AllowConstAssign() {}
+ AllowConstAssign(AllowConstAssign const&) {}
+ AllowConstAssign const& operator=(AllowConstAssign const&) const {
+ return *this;
+ }
+};
+
struct X
{
};
@@ -53,6 +61,11 @@ int main()
assert(*opt == i);
}
{
+ optional<const AllowConstAssign> opt;
+ const AllowConstAssign other;
+ opt = other;
+ }
+ {
optional<std::unique_ptr<int>> opt;
opt = std::unique_ptr<int>(new int(3));
assert(static_cast<bool>(opt) == true);
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
index 89ea345029c2..17ee9754531f 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// optional<T>& operator=(const optional<T>& rhs);
@@ -17,8 +16,17 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
+struct AllowConstAssign {
+ AllowConstAssign(AllowConstAssign const&) {}
+ AllowConstAssign const& operator=(AllowConstAssign const&) const {
+ return *this;
+ }
+};
+
struct X
{
static bool throw_now;
@@ -27,7 +35,7 @@ struct X
X(const X&)
{
if (throw_now)
- throw 6;
+ TEST_THROW(6);
}
};
@@ -43,6 +51,11 @@ int main()
assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
}
{
+ optional<const AllowConstAssign> opt;
+ optional<const AllowConstAssign> opt2;
+ opt = opt2;
+ }
+ {
optional<int> opt;
constexpr optional<int> opt2(2);
opt = opt2;
@@ -67,6 +80,7 @@ int main()
assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
assert(*opt == *opt2);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
optional<X> opt;
optional<X> opt2(X{});
@@ -83,4 +97,5 @@ int main()
assert(static_cast<bool>(opt) == false);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
index 94f2bb21a475..256396094a90 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// template <class... Args> void optional<T>::emplace(Args&&... args);
@@ -18,6 +17,8 @@
#include <cassert>
#include <memory>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -48,7 +49,7 @@ class Z
public:
static bool dtor_called;
Z() = default;
- Z(int) {throw 6;}
+ Z(int) {TEST_THROW(6);}
~Z() {dtor_called = true;}
};
@@ -81,6 +82,12 @@ int main()
assert(*opt == 1);
}
{
+ optional<const int> opt(2);
+ opt.emplace(1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == 1);
+ }
+ {
optional<X> opt;
opt.emplace();
assert(static_cast<bool>(opt) == true);
@@ -125,6 +132,7 @@ int main()
assert(Y::dtor_called == true);
}
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
Z z;
optional<Z> opt(z);
@@ -141,4 +149,5 @@ int main()
assert(Z::dtor_called == true);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
index fec37408e43b..8a265808a3c3 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// template <class U, class... Args>
@@ -19,6 +18,8 @@
#include <cassert>
#include <vector>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -60,7 +61,7 @@ public:
constexpr Z() : i_(0) {}
constexpr Z(int i) : i_(i) {}
Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
- {throw 6;}
+ {TEST_THROW(6);}
~Z() {dtor_called = true;}
friend constexpr bool operator==(const Z& x, const Z& y)
@@ -81,6 +82,17 @@ int main()
assert(*opt == X({1, 2}));
}
}
+ X::dtor_called = false;
+ {
+ X x;
+ {
+ optional<const X> opt(x);
+ assert(X::dtor_called == false);
+ opt.emplace({1, 2});
+ assert(X::dtor_called == true);
+ assert(*opt == X({1, 2}));
+ }
+ }
{
optional<std::vector<int>> opt;
opt.emplace({1, 2, 3}, std::allocator<int>());
@@ -93,6 +105,7 @@ int main()
assert(static_cast<bool>(opt) == true);
assert(*opt == Y({1, 2}));
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
Z z;
optional<Z> opt(z);
@@ -109,4 +122,5 @@ int main()
assert(Z::dtor_called == true);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
index fa00f5602c7f..4e2aca978865 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// optional<T>& operator=(optional<T>&& rhs)
@@ -19,8 +18,17 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
+struct AllowConstAssign {
+ AllowConstAssign(AllowConstAssign const&) {}
+ AllowConstAssign const& operator=(AllowConstAssign const&) const {
+ return *this;
+ }
+};
+
struct X
{
static bool throw_now;
@@ -29,7 +37,7 @@ struct X
X(X&&)
{
if (throw_now)
- throw 6;
+ TEST_THROW(6);
}
X& operator=(X&&) noexcept
{
@@ -37,10 +45,10 @@ struct X
}
};
-struct Y {};
-
bool X::throw_now = false;
+struct Y {};
+
int main()
{
{
@@ -77,6 +85,12 @@ int main()
assert(*opt == *opt2);
}
{
+ optional<const AllowConstAssign> opt;
+ optional<const AllowConstAssign> opt2;
+ opt = std::move(opt2);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
static_assert(!std::is_nothrow_move_assignable<optional<X>>::value, "");
optional<X> opt;
optional<X> opt2(X{});
@@ -93,6 +107,7 @@ int main()
assert(static_cast<bool>(opt) == false);
}
}
+#endif
{
static_assert(std::is_nothrow_move_assignable<optional<Y>>::value, "");
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
index 9b6511a0006d..6371dcb4e51c 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
@@ -18,6 +17,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -42,7 +43,7 @@ class Z
{
public:
Z(int) {}
- Z(const Z&) {throw 6;}
+ Z(const Z&) {TEST_THROW(6);}
};
@@ -97,6 +98,7 @@ int main()
};
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
typedef Z T;
try
@@ -110,4 +112,5 @@ int main()
assert(i == 6);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
index 144af2e3a7dc..4b66fe80bbb2 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// optional(const optional<T>& rhs);
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
template <class T>
@@ -24,7 +25,12 @@ void
test(const optional<T>& rhs, bool is_going_to_throw = false)
{
bool rhs_engaged = static_cast<bool>(rhs);
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (is_going_to_throw)
+ return;
+#else
try
+#endif
{
optional<T> lhs = rhs;
assert(is_going_to_throw == false);
@@ -32,10 +38,13 @@ test(const optional<T>& rhs, bool is_going_to_throw = false)
if (rhs_engaged)
assert(*lhs == *rhs);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (int i)
{
assert(i == 6);
+ assert(is_going_to_throw);
}
+#endif
}
class X
@@ -68,7 +77,7 @@ public:
Z(const Z&)
{
if (++count == 2)
- throw 6;
+ TEST_THROW(6);
}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
@@ -88,6 +97,11 @@ int main()
test(rhs);
}
{
+ typedef const int T;
+ optional<T> rhs(3);
+ test(rhs);
+ }
+ {
typedef X T;
optional<T> rhs;
test(rhs);
@@ -98,6 +112,11 @@ int main()
test(rhs);
}
{
+ typedef const X T;
+ optional<T> rhs(X(3));
+ test(rhs);
+ }
+ {
typedef Y T;
optional<T> rhs;
test(rhs);
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
index dc1666b10362..c46407896576 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
@@ -19,6 +18,7 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
using std::experimental::optional;
using std::experimental::in_place_t;
@@ -55,7 +55,7 @@ public:
class Z
{
public:
- Z(int i) {throw 6;}
+ Z(int) {TEST_THROW(6);}
};
@@ -128,6 +128,7 @@ int main()
};
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
try
{
@@ -139,4 +140,5 @@ int main()
assert(i == 6);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
index 9bd6b18989fc..b75c147df513 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// template <class U, class... Args>
@@ -20,6 +19,8 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
@@ -60,7 +61,7 @@ public:
constexpr Z() : i_(0) {}
constexpr Z(int i) : i_(i) {}
Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
- {throw 6;}
+ {TEST_THROW(6);}
friend constexpr bool operator==(const Z& x, const Z& y)
{return x.i_ == y.i_ && x.j_ == y.j_;}
@@ -100,6 +101,7 @@ int main()
constexpr test_constexpr_ctor dopt(in_place, {42, 101, -1});
static_assert(*dopt == Y{42, 101, -1}, "");
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
static_assert(std::is_constructible<optional<Z>, std::initializer_list<int>&>::value, "");
try
@@ -112,4 +114,5 @@ int main()
assert(i == 6);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
index 851157f960f9..a8bb6e9c275c 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// optional(optional<T>&& rhs) noexcept(is_nothrow_move_constructible<T>::value);
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
template <class T>
@@ -26,16 +27,24 @@ test(optional<T>& rhs, bool is_going_to_throw = false)
static_assert(std::is_nothrow_move_constructible<optional<T>>::value ==
std::is_nothrow_move_constructible<T>::value, "");
bool rhs_engaged = static_cast<bool>(rhs);
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (is_going_to_throw)
+ return;
+#else
try
+#endif
{
optional<T> lhs = std::move(rhs);
assert(is_going_to_throw == false);
assert(static_cast<bool>(lhs) == rhs_engaged);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (int i)
{
assert(i == 6);
+ assert(is_going_to_throw);
}
+#endif
}
class X
@@ -68,12 +77,23 @@ public:
Z(Z&&)
{
if (++count == 2)
- throw 6;
+ TEST_THROW(6);
}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
};
+
+class ConstMovable
+{
+ int i_;
+public:
+ ConstMovable(int i) : i_(i) {}
+ ConstMovable(const ConstMovable&& x) : i_(x.i_) {}
+ ~ConstMovable() {i_ = 0;}
+ friend bool operator==(const ConstMovable& x, const ConstMovable& y) {return x.i_ == y.i_;}
+};
+
int main()
{
{
@@ -87,6 +107,11 @@ int main()
test(rhs);
}
{
+ typedef const int T;
+ optional<T> rhs(3);
+ test(rhs);
+ }
+ {
typedef X T;
optional<T> rhs;
test(rhs);
@@ -97,6 +122,11 @@ int main()
test(rhs);
}
{
+ typedef const ConstMovable T;
+ optional<T> rhs(ConstMovable(3));
+ test(rhs);
+ }
+ {
typedef Y T;
optional<T> rhs;
test(rhs);
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
index ef21fcdf9e6d..1941546a53f7 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
@@ -18,6 +17,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -44,7 +45,7 @@ class Z
{
public:
Z(int) {}
- Z(Z&&) {throw 6;}
+ Z(Z&&) {TEST_THROW(6);}
};
@@ -92,6 +93,7 @@ int main()
constexpr test_constexpr_ctor(T&&) {}
};
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
typedef Z T;
try
@@ -104,4 +106,5 @@ int main()
assert(i == 6);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
index cf900d7029e1..46586c65a6e0 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
@@ -51,6 +51,9 @@ int main()
{
constexpr optional<Z> opt(Z{});
assert(opt->test() == 1);
+#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
+ static_assert(opt->test() == 1, "");
+#endif
}
#ifdef _LIBCPP_DEBUG
{
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
index b998f3067f4f..c8f07111c23d 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// T& optional<T>::value();
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
using std::experimental::bad_optional_access;
@@ -35,6 +36,7 @@ int main()
opt.emplace();
assert(opt.value().test() == 4);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
optional<X> opt;
try
@@ -46,4 +48,5 @@ int main()
{
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
index a38b1f930c72..98ff16e4d13b 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// constexpr const T& optional<T>::value() const;
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
@@ -40,6 +41,7 @@ int main()
const optional<X> opt(in_place);
assert(opt.value().test() == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
const optional<X> opt;
try
@@ -51,4 +53,5 @@ int main()
{
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
index 620dda19e3ff..f2d373c299bf 100644
--- a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// void swap(optional&)
@@ -19,6 +18,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -56,11 +57,15 @@ class Z
int i_;
public:
Z(int i) : i_(i) {}
- Z(Z&&) {throw 7;}
+ Z(Z&&) {TEST_THROW(7);}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
- friend void swap(Z& x, Z& y) {throw 6;}
+ friend void swap(Z&, Z&) {TEST_THROW(6);}
+};
+
+struct ConstSwappable {
};
+void swap(ConstSwappable const&, ConstSwappable const&) {}
int main()
{
@@ -113,6 +118,11 @@ int main()
assert(*opt2 == 1);
}
{
+ optional<const ConstSwappable> opt;
+ optional<const ConstSwappable> opt2;
+ opt.swap(opt2);
+ }
+ {
optional<X> opt1;
optional<X> opt2;
static_assert(noexcept(opt1.swap(opt2)) == true, "");
@@ -222,6 +232,7 @@ int main()
assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 1);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
optional<Z> opt1;
optional<Z> opt2;
@@ -298,4 +309,5 @@ int main()
assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 2);
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.specalg/swap.pass.cpp b/test/std/experimental/optional/optional.specalg/swap.pass.cpp
index d339c53c1f77..4d643cb44b67 100644
--- a/test/std/experimental/optional/optional.specalg/swap.pass.cpp
+++ b/test/std/experimental/optional/optional.specalg/swap.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// template <class T> void swap(optional<T>& x, optional<T>& y)
@@ -18,6 +17,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -55,10 +56,10 @@ class Z
int i_;
public:
Z(int i) : i_(i) {}
- Z(Z&&) {throw 7;}
+ Z(Z&&) {TEST_THROW(7);}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
- friend void swap(Z& x, Z& y) {throw 6;}
+ friend void swap(Z&, Z&) {TEST_THROW(6);}
};
int main()
@@ -231,6 +232,7 @@ int main()
assert(static_cast<bool>(opt1) == false);
assert(static_cast<bool>(opt2) == false);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
optional<Z> opt1;
opt1.emplace(1);
@@ -297,4 +299,5 @@ int main()
assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 2);
}
+#endif // TEST_HAS_NO_EXCEPTIONS
}
diff --git a/test/std/experimental/string.view/string.view.access/data.pass.cpp b/test/std/experimental/string.view/string.view.access/data.pass.cpp
index 53e95ddaea31..4b581d653eac 100644
--- a/test/std/experimental/string.view/string.view.access/data.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/data.pass.cpp
@@ -39,7 +39,7 @@ int main () {
test ( U"a", 1 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const char *s = "ABC";
constexpr std::experimental::basic_string_view<char> sv( s, 2 );
diff --git a/test/std/experimental/string.view/string.view.access/index.pass.cpp b/test/std/experimental/string.view/string.view.access/index.pass.cpp
index 2c1bd1dc91cb..0cb385eeff58 100644
--- a/test/std/experimental/string.view/string.view.access/index.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/index.pass.cpp
@@ -42,7 +42,7 @@ int main () {
test ( U"a", 1 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::experimental::basic_string_view<char> sv ( "ABC", 2 );
static_assert ( sv.length() == 2, "" );
diff --git a/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp b/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp
index 9f5d86f2f82b..a5108bf12660 100644
--- a/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp
+++ b/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp
@@ -23,7 +23,7 @@
template<typename SV>
void test1 () {
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr SV sv1;
static_assert ( sv1.size() == 0, "" );
diff --git a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
index 0df37a6ffd9f..bd566a986276 100644
--- a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
index 5971f6974380..51decdca67cd 100644
--- a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
index f5bcb7e97b73..cf8a30a3942c 100644
--- a/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
index e13a4ea119d1..1bacf285f4eb 100644
--- a/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
index 63002a5c415c..0aae3d41a825 100644
--- a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
index 3047cc7be118..e014872a613c 100644
--- a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
index c542efea99a7..bdc4c966fd06 100644
--- a/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
index 17219a42602c..e814283ad5b6 100644
--- a/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
index 2c0461481e78..10e82437cd6d 100644
--- a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
index df9e90893f7c..77d8fa3e5b27 100644
--- a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
index 1deee9ac7fc6..9c13199d24a7 100644
--- a/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
index c99489eb3070..c74b327f14bb 100644
--- a/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.cons/default.pass.cpp b/test/std/experimental/string.view/string.view.cons/default.pass.cpp
index e817bfffb89d..37df020e7ea4 100644
--- a/test/std/experimental/string.view/string.view.cons/default.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/default.pass.cpp
@@ -15,9 +15,11 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template<typename T>
void test () {
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr T sv1;
static_assert ( sv1.size() == 0, "" );
diff --git a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp
index 9de3a3039523..a8638389e168 100644
--- a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp
@@ -18,6 +18,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template<typename CharT>
@@ -55,7 +56,7 @@ int main () {
test ( U"" );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::experimental::basic_string_view<char, constexpr_char_traits<char>> sv1 ( "ABCDE" );
static_assert ( sv1.size() == 5, "");
diff --git a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp
index 663d25e954f9..c2f312daa863 100644
--- a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp
@@ -34,7 +34,7 @@ int main () {
test ( "QBCDE", 5 );
test ( "QBCDE", 2 );
test ( "", 0 );
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const char *s = "QBCDE";
constexpr std::experimental::basic_string_view<char> sv1 ( s, 2 );
@@ -46,7 +46,7 @@ int main () {
test ( L"QBCDE", 5 );
test ( L"QBCDE", 2 );
test ( L"", 0 );
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const wchar_t *s = L"QBCDE";
constexpr std::experimental::basic_string_view<wchar_t> sv1 ( s, 2 );
@@ -59,7 +59,7 @@ int main () {
test ( u"QBCDE", 5 );
test ( u"QBCDE", 2 );
test ( u"", 0 );
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const char16_t *s = u"QBCDE";
constexpr std::experimental::basic_string_view<char16_t> sv1 ( s, 2 );
@@ -71,7 +71,7 @@ int main () {
test ( U"QBCDE", 5 );
test ( U"QBCDE", 2 );
test ( U"", 0 );
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const char32_t *s = U"QBCDE";
constexpr std::experimental::basic_string_view<char32_t> sv1 ( s, 2 );
diff --git a/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp
index 6e6a1f55710a..fdaf8aa066f5 100644
--- a/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -66,7 +67,7 @@ int main()
test(S("abcdeabcdeabcdeabcde"), 'c', 2);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp
index 73580aed89ad..859980af2956 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -68,7 +69,7 @@ int main()
test(S("laenfsbridchgotmkqpj"), 'q', 0);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp
index de93288cc010..1f7ce3ef54d1 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -149,7 +150,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp
index cfb0029fa180..28255dd457f7 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp
index dde2f2c9f378..ffafcfc04481 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -66,7 +67,7 @@ int main()
test(S("laenfsbridchgotmkqpj"), 'e', 2);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp
index e49e82ccab11..7b37fe057213 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -149,7 +150,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp
index 1dc8d85472c7..1f7ea383a589 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp
index ed1a35e91845..307be23708b3 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -66,7 +67,7 @@ int main()
test(S("laenfsbridchgotmkqpj"), 'i', 19);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp
index e07c4f361da3..b0d3f0636b21 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -149,7 +150,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp
index 3ddf03365060..8a591ccbe44a 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp
index d28e0079561f..b949eec1b3c3 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -66,7 +67,7 @@ int main()
test(S("laenfsbridchgotmkqpj"), 'm', 15);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp
index f01e277f5ada..3755b2653d19 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -149,7 +150,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp
index a38ffa692f48..64b29ec7da6f 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp
index 5ebe414be096..bdccb2f22645 100644
--- a/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -155,7 +156,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp
index 382cbaf07934..856dc4a3a072 100644
--- a/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp
index 84132ac7a161..f25efdd02072 100644
--- a/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -148,7 +149,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp
index 9014d888d4ef..f07071101c77 100644
--- a/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp
@@ -13,6 +13,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -65,7 +66,7 @@ int main()
test(S("abcdeabcdeabcdeabcde"), 'b', 16);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp
index 0559d3121db9..7a8795be0816 100644
--- a/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp
@@ -13,6 +13,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -155,7 +156,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp
index 9116e3aa95a8..2755d2c567b6 100644
--- a/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp
@@ -13,6 +13,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -375,7 +376,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp
index 88457c662016..e77d668d79ba 100644
--- a/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -148,7 +149,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp b/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp
index 8040b81d4efe..5f28f63f8275 100644
--- a/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp
@@ -58,7 +58,7 @@ int main()
test(u32string_view{U"123"});
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr string_view sv { "123", 3 };
constexpr u16string_view u16sv {u"123", 3 };
diff --git a/test/std/experimental/string.view/string.view.iterators/end.pass.cpp b/test/std/experimental/string.view/string.view.iterators/end.pass.cpp
index 3a1091e9983c..1f22b3fbe4ba 100644
--- a/test/std/experimental/string.view/string.view.iterators/end.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/end.pass.cpp
@@ -12,6 +12,7 @@
// constexpr const_iterator end() const;
#include <experimental/string_view>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -38,9 +39,9 @@ test(S s)
assert(ce2 != s.begin());
}
- assert( e - s.begin() == s.size());
- assert(ce1 - cs.begin() == cs.size());
- assert(ce2 - s.cbegin() == s.size());
+ assert( e - s.begin() == static_cast<std::ptrdiff_t>(s.size()));
+ assert(ce1 - cs.begin() == static_cast<std::ptrdiff_t>(cs.size()));
+ assert(ce2 - s.cbegin() == static_cast<std::ptrdiff_t>(s.size()));
assert( e == ce1);
assert( e == ce2);
@@ -66,7 +67,7 @@ int main()
test(u32string_view{U"123"});
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr string_view sv { "123", 3 };
constexpr u16string_view u16sv {u"123", 3 };
diff --git a/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp b/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp
index 55e28a266948..bd24c327e090 100644
--- a/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp
@@ -12,6 +12,7 @@
// constexpr const_iterator rend() const;
#include <experimental/string_view>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -38,9 +39,9 @@ test(S s)
assert(ce2 != s.rbegin());
}
- assert( e - s.rbegin() == s.size());
- assert(ce1 - cs.rbegin() == cs.size());
- assert(ce2 - s.crbegin() == s.size());
+ assert( e - s.rbegin() == static_cast<std::ptrdiff_t>(s.size()));
+ assert(ce1 - cs.rbegin() == static_cast<std::ptrdiff_t>(cs.size()));
+ assert(ce2 - s.crbegin() == static_cast<std::ptrdiff_t>(s.size()));
assert( e == ce1);
assert( e == ce2);
diff --git a/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp
index 9a4891c8f259..00b0661d85f5 100644
--- a/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp
@@ -32,7 +32,7 @@ void test ( const CharT *s, size_t len ) {
}
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr size_t test_ce ( size_t n ) {
typedef std::experimental::basic_string_view<char> SV;
SV sv1{ "ABCDEFGHIJKL", n };
@@ -60,7 +60,7 @@ int main () {
test ( U"", 0 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert ( test_ce (5) == 0, "" );
#endif
diff --git a/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
index 4a31486afaa0..03484a0b5ebb 100644
--- a/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
@@ -39,7 +39,7 @@ void test ( const CharT *s, size_t len ) {
}
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr size_t test_ce ( size_t n, size_t k ) {
typedef std::experimental::basic_string_view<char> SV;
SV sv1{ "ABCDEFGHIJKL", n };
@@ -67,7 +67,7 @@ int main () {
test ( U"", 0 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
static_assert ( test_ce ( 5, 0 ) == 5, "" );
static_assert ( test_ce ( 5, 1 ) == 4, "" );
diff --git a/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
index 9ddc6de84bf3..6b632d0efad8 100644
--- a/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
@@ -39,7 +39,7 @@ void test ( const CharT *s, size_t len ) {
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr size_t test_ce ( size_t n, size_t k ) {
typedef std::experimental::basic_string_view<char> SV;
SV sv1{ "ABCDEFGHIJKL", n };
@@ -67,7 +67,7 @@ int main () {
test ( U"", 0 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
static_assert ( test_ce ( 5, 0 ) == 5, "" );
static_assert ( test_ce ( 5, 1 ) == 4, "" );
diff --git a/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp
index d747def8549e..2912fd8b9150 100644
--- a/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp
@@ -36,7 +36,7 @@ void test ( const CharT *s, size_t len ) {
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr size_t test_ce ( size_t n, size_t k ) {
typedef std::experimental::basic_string_view<char> SV;
SV sv1{ "ABCDEFGHIJKL", n };
@@ -66,7 +66,7 @@ int main () {
test ( U"", 0 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
static_assert ( test_ce (2, 3) == 3, "" );
static_assert ( test_ce (5, 3) == 3, "" );
diff --git a/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp b/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp
index 6ba03212d42b..202e9ced451f 100644
--- a/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp
+++ b/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp
@@ -16,7 +16,9 @@
#include <experimental/string_view>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
+#include "test_macros.h"
+
+#if TEST_STD_VER > 11
// quoted is C++14 only
bool is_skipws ( const std::istream *is ) {
diff --git a/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp
index 583395451fd4..93014ea119f9 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
@@ -112,7 +113,7 @@ int main()
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp
index 4364ab063543..ff01daaf1ce4 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
@@ -106,7 +107,7 @@ int main () {
test(U"abcdefghijklmnopqrst", U"abcdefghijklmnopqrst", 0);
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1 { "abcde", 5 };
diff --git a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp b/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
index a651010d4b27..a3a1dbf418b8 100644
--- a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
@@ -27,6 +27,7 @@ void test1 ( std::experimental::basic_string_view<CharT> sv, size_t n, size_t po
try {
std::experimental::basic_string_view<CharT> sv1 = sv.substr(pos, n);
assert(false);
+ ((void)sv1);
} catch (const std::out_of_range&) {
return;
} catch (...) {
diff --git a/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp
new file mode 100644
index 000000000000..ffce81459478
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using hasFoo = typename T::Foo;
+
+struct yesFoo {
+ using Foo = int;
+};
+
+struct noFoo {
+};
+
+
+template <typename T, typename Res>
+void test() {
+ static_assert( std::is_same<Res, typename ex::detected_or <double, hasFoo, T>::type>::value, "" );
+ static_assert( std::is_same<Res, typename ex::detected_or_t<double, hasFoo, T> >::value, "" );
+}
+
+int main () {
+ test<yesFoo, int>();
+ test<noFoo, double>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.detect/detected_t.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/detected_t.pass.cpp
new file mode 100644
index 000000000000..136fb068be3c
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/detected_t.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using callFoo = decltype(std::declval<T&>().Foo());
+
+struct yesFoo {
+ int Foo() { return 0; }
+};
+
+struct noFoo {
+};
+
+struct wrongFoo {
+ std::string Foo() { return ""; }
+};
+
+struct convertibleFoo {
+ long Foo() { return 0; }
+};
+
+
+template <typename T, typename Res>
+void test() {
+ static_assert( std::is_same<Res, typename ex::detected_t<callFoo, T>>::value, "" );
+}
+
+int main () {
+ test<yesFoo, int>();
+ test<noFoo, ex::nonesuch>(); // lookup failure returns nonesuch
+ test<wrongFoo, std::string>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.detect/is_detected.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/is_detected.pass.cpp
new file mode 100644
index 000000000000..d8528a25161e
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/is_detected.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using copy_assign_t = decltype(std::declval<T&>() = std::declval<T const &>());
+
+struct not_assignable {
+ not_assignable & operator=(const not_assignable&) = delete;
+};
+
+template <typename T, bool b>
+void test() {
+ static_assert( b == ex::is_detected <copy_assign_t, T>::value, "" );
+ static_assert( b == ex::is_detected_v<copy_assign_t, T>, "" );
+}
+
+int main () {
+ test<int, true>();
+ test<std::string, true>();
+ test<not_assignable, false>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.detect/is_detected_convertible.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/is_detected_convertible.pass.cpp
new file mode 100644
index 000000000000..8d1e0ae825d5
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/is_detected_convertible.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using callFoo = decltype(std::declval<T&>().Foo());
+
+struct yesFoo {
+ int Foo() { return 0; }
+};
+
+struct noFoo {
+};
+
+struct wrongFoo {
+ std::string Foo() { return ""; }
+};
+
+struct convertibleFoo {
+ long Foo() { return 0; }
+};
+
+
+template <typename T, bool b>
+void test() {
+ static_assert( b == ex::is_detected_convertible <int, callFoo, T>::value, "" );
+ static_assert( b == ex::is_detected_convertible_v<int, callFoo, T>, "" );
+}
+
+int main () {
+ test<yesFoo, true>();
+ test<noFoo, false>();
+ test<wrongFoo, false>();
+ test<convertibleFoo, true>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.detect/is_detected_exact.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/is_detected_exact.pass.cpp
new file mode 100644
index 000000000000..e9e5d8ce0056
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/is_detected_exact.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using callFoo = decltype(std::declval<T&>().Foo());
+
+struct yesFoo {
+ int Foo() { return 0; }
+};
+
+struct noFoo {
+};
+
+struct wrongFoo {
+ std::string Foo() { return ""; }
+};
+
+struct convertibleFoo {
+ long Foo() { return 0; }
+};
+
+template <typename T, bool b>
+void test() {
+ static_assert( b == ex::is_detected_exact <int, callFoo, T>::value, "" );
+ static_assert( b == ex::is_detected_exact_v<int, callFoo, T>, "" );
+}
+
+int main () {
+ test<yesFoo, true>();
+ test<noFoo, false>();
+ test<wrongFoo, false>();
+ test<convertibleFoo, false>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp
new file mode 100644
index 000000000000..cb8db1febd27
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+// template<class... B> struct conjunction; // C++17
+// template<class... B>
+// constexpr bool conjunction_v = conjunction<B...>::value; // C++17
+
+#include <experimental/type_traits>
+#include <cassert>
+
+namespace ex = std::experimental;
+
+struct True { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+ static_assert ( ex::conjunction<>::value, "" );
+ static_assert ( ex::conjunction<std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::false_type>::value, "" );
+
+ static_assert ( ex::conjunction_v<>, "" );
+ static_assert ( ex::conjunction_v<std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::false_type>, "" );
+
+ static_assert ( ex::conjunction<std::true_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::true_type, std::false_type>::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::false_type>::value, "" );
+
+ static_assert ( ex::conjunction_v<std::true_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::true_type, std::false_type>, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::false_type>, "" );
+
+ static_assert ( ex::conjunction<std::true_type, std::true_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::true_type, std::false_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::true_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::false_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::true_type, std::true_type, std::false_type>::value, "" );
+ static_assert (!ex::conjunction<std::true_type, std::false_type, std::false_type>::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::true_type, std::false_type>::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::false_type, std::false_type>::value, "" );
+
+ static_assert ( ex::conjunction_v<std::true_type, std::true_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::true_type, std::false_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::true_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::false_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::true_type, std::true_type, std::false_type>, "" );
+ static_assert (!ex::conjunction_v<std::true_type, std::false_type, std::false_type>, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::true_type, std::false_type>, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::false_type, std::false_type>, "" );
+
+ static_assert ( ex::conjunction<True >::value, "" );
+ static_assert (!ex::conjunction<False>::value, "" );
+
+ static_assert ( ex::conjunction_v<True >, "" );
+ static_assert (!ex::conjunction_v<False>, "" );
+}
diff --git a/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp
new file mode 100644
index 000000000000..dcdbf09fb099
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+// template<class... B> struct disjunction;
+// template<class... B>
+// constexpr bool disjunction_v = disjunction<B...>::value;
+
+#include <experimental/type_traits>
+#include <cassert>
+
+namespace ex = std::experimental;
+
+struct True { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+ static_assert (!ex::disjunction<>::value, "" );
+ static_assert ( ex::disjunction<std::true_type >::value, "" );
+ static_assert (!ex::disjunction<std::false_type>::value, "" );
+
+ static_assert (!ex::disjunction_v<>, "" );
+ static_assert ( ex::disjunction_v<std::true_type >, "" );
+ static_assert (!ex::disjunction_v<std::false_type>, "" );
+
+ static_assert ( ex::disjunction<std::true_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::true_type, std::false_type>::value, "" );
+ static_assert ( ex::disjunction<std::false_type, std::true_type >::value, "" );
+ static_assert (!ex::disjunction<std::false_type, std::false_type>::value, "" );
+
+ static_assert ( ex::disjunction_v<std::true_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::true_type, std::false_type>, "" );
+ static_assert ( ex::disjunction_v<std::false_type, std::true_type >, "" );
+ static_assert (!ex::disjunction_v<std::false_type, std::false_type>, "" );
+
+ static_assert ( ex::disjunction<std::true_type, std::true_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::true_type, std::false_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::false_type, std::true_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::false_type, std::false_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::true_type, std::true_type, std::false_type>::value, "" );
+ static_assert ( ex::disjunction<std::true_type, std::false_type, std::false_type>::value, "" );
+ static_assert ( ex::disjunction<std::false_type, std::true_type, std::false_type>::value, "" );
+ static_assert (!ex::disjunction<std::false_type, std::false_type, std::false_type>::value, "" );
+
+ static_assert ( ex::disjunction_v<std::true_type, std::true_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::true_type, std::false_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::false_type, std::true_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::false_type, std::false_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::true_type, std::true_type, std::false_type>, "" );
+ static_assert ( ex::disjunction_v<std::true_type, std::false_type, std::false_type>, "" );
+ static_assert ( ex::disjunction_v<std::false_type, std::true_type, std::false_type>, "" );
+ static_assert (!ex::disjunction_v<std::false_type, std::false_type, std::false_type>, "" );
+
+ static_assert ( ex::disjunction<True >::value, "" );
+ static_assert (!ex::disjunction<False>::value, "" );
+
+ static_assert ( ex::disjunction_v<True >, "" );
+ static_assert (!ex::disjunction_v<False>, "" );
+}
diff --git a/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp
new file mode 100644
index 000000000000..b0d43d7e5122
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+// template<class B> struct negation;
+// template<class B>
+// constexpr bool negation_v = negation<B>::value;
+
+#include <experimental/type_traits>
+#include <cassert>
+
+namespace ex = std::experimental;
+
+struct True { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+ static_assert (!ex::negation<std::true_type >::value, "" );
+ static_assert ( ex::negation<std::false_type>::value, "" );
+
+ static_assert (!ex::negation_v<std::true_type >, "" );
+ static_assert ( ex::negation_v<std::false_type>, "" );
+
+ static_assert (!ex::negation<True >::value, "" );
+ static_assert ( ex::negation<False>::value, "" );
+
+ static_assert (!ex::negation_v<True >, "" );
+ static_assert ( ex::negation_v<False>, "" );
+
+ static_assert ( ex::negation<ex::negation<std::true_type >>::value, "" );
+ static_assert (!ex::negation<ex::negation<std::false_type>>::value, "" );
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
index a5adf2d1f7f0..0e46f91cfd1e 100644
--- a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
@@ -25,4 +25,5 @@ int main() {
P p1(2);
P p2(std::move(p1));
+ assert(*p2 == 2);
}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
index 8cf670a25402..488738d32072 100644
--- a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
@@ -24,7 +24,7 @@ template <> struct hash<X>
{
typedef X first_argument_type;
- size_t operator()(const first_argument_type& x1) const
+ size_t operator()(const first_argument_type&) const
{
return 99;
}
diff --git a/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp b/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp
index f19a8211cdac..485da33cdec7 100644
--- a/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp
+++ b/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp
@@ -18,4 +18,5 @@
int main()
{
std::ratio<100> x;
+ ((void)x);
}
diff --git a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
index 314d2783f7ec..01d36637e1c3 100644
--- a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
+++ b/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
@@ -20,32 +20,32 @@
static int my_int = 42;
-template <int N> struct index {};
+template <int N> struct index_t {};
-void f(index<0>) {}
+void f(index_t<0>) {}
-int f(index<1>) { return 0; }
+int f(index_t<1>) { return 0; }
-int & f(index<2>) { return static_cast<int &>(my_int); }
-int const & f(index<3>) { return static_cast<int const &>(my_int); }
-int volatile & f(index<4>) { return static_cast<int volatile &>(my_int); }
-int const volatile & f(index<5>) { return static_cast<int const volatile &>(my_int); }
+int & f(index_t<2>) { return static_cast<int &>(my_int); }
+int const & f(index_t<3>) { return static_cast<int const &>(my_int); }
+int volatile & f(index_t<4>) { return static_cast<int volatile &>(my_int); }
+int const volatile & f(index_t<5>) { return static_cast<int const volatile &>(my_int); }
-int && f(index<6>) { return static_cast<int &&>(my_int); }
-int const && f(index<7>) { return static_cast<int const &&>(my_int); }
-int volatile && f(index<8>) { return static_cast<int volatile &&>(my_int); }
-int const volatile && f(index<9>) { return static_cast<int const volatile &&>(my_int); }
+int && f(index_t<6>) { return static_cast<int &&>(my_int); }
+int const && f(index_t<7>) { return static_cast<int const &&>(my_int); }
+int volatile && f(index_t<8>) { return static_cast<int volatile &&>(my_int); }
+int const volatile && f(index_t<9>) { return static_cast<int const volatile &&>(my_int); }
-int * f(index<10>) { return static_cast<int *>(&my_int); }
-int const * f(index<11>) { return static_cast<int const *>(&my_int); }
-int volatile * f(index<12>) { return static_cast<int volatile *>(&my_int); }
-int const volatile * f(index<13>) { return static_cast<int const volatile *>(&my_int); }
+int * f(index_t<10>) { return static_cast<int *>(&my_int); }
+int const * f(index_t<11>) { return static_cast<int const *>(&my_int); }
+int volatile * f(index_t<12>) { return static_cast<int volatile *>(&my_int); }
+int const volatile * f(index_t<13>) { return static_cast<int const volatile *>(&my_int); }
template <int Func, class Expect>
void test()
{
- using F = decltype(f(index<Func>{}));
+ using F = decltype(f(index_t<Func>{}));
static_assert(std::is_same<F, Expect>::value, "");
}
diff --git a/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp b/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp
index 51f9ab6bee18..7ac96d2502d8 100644
--- a/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp
+++ b/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp
@@ -13,5 +13,6 @@
int main()
{
- std::experimental::erased_type e;
+ std::experimental::erased_type e;
+ ((void)e);
}