aboutsummaryrefslogtreecommitdiff
path: root/test/libcxx
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:05:35 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:05:35 +0000
commit6012fe9abb1f01b1b5b4ca908464804c21ff8602 (patch)
treea5232179237d9aaa3a03f9c783974fc5f09716c6 /test/libcxx
parent315d10f09ee888005b1da55e7bbb57d8a79b8447 (diff)
Notes
Diffstat (limited to 'test/libcxx')
-rw-r--r--test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp4
-rw-r--r--test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp50
-rw-r--r--test/libcxx/algorithms/debug_less.pass.cpp51
-rw-r--r--test/libcxx/algorithms/half_positive.pass.cpp56
-rw-r--r--test/libcxx/containers/associative/non_const_comparator.fail.cpp3
-rw-r--r--test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp (renamed from test/libcxx/type_traits/is_floating_point.pass.cpp)26
-rw-r--r--test/libcxx/containers/sequences/vector/db_back.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_cback.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_cfront.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_cindex.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_front.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_index.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp26
-rw-r--r--test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp54
-rw-r--r--test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp57
-rw-r--r--test/libcxx/containers/unord/non_const_comparator.fail.cpp8
-rw-r--r--test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp3
-rw-r--r--test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp3
-rw-r--r--test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp3
-rw-r--r--test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp3
-rw-r--r--test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp39
-rw-r--r--test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp59
-rw-r--r--test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp22
-rw-r--r--test/libcxx/diagnostics/enable_nodiscard.fail.cpp33
-rw-r--r--test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp33
-rw-r--r--test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp31
-rw-r--r--test/libcxx/diagnostics/nodiscard.pass.cpp15
-rw-r--r--test/libcxx/diagnostics/nodiscard_aftercxx17.fail.cpp (renamed from test/libcxx/diagnostics/nodiscard.fail.cpp)1
-rw-r--r--test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp (renamed from test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp)21
-rw-r--r--test/libcxx/diagnostics/nodiscard_extensions.fail.cpp35
-rw-r--r--test/libcxx/diagnostics/nodiscard_extensions.pass.cpp29
-rw-r--r--test/libcxx/double_include.sh.cpp2
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp83
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp102
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp35
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp69
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp47
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp94
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp110
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp56
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp74
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp76
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp48
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg3
-rw-r--r--test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/diagnostics/syserr/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp7
-rw-r--r--test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp2
-rw-r--r--test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/strings/string.view/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp (renamed from test/libcxx/experimental/containers/sequences/dynarray/nothing_to_do.pass.cpp)12
-rw-r--r--test/libcxx/experimental/utilities/any/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/utilities/optional/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/utilities/ratio/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/utilities/time/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/utilities/tuple/version.pass.cpp21
-rw-r--r--test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp35
-rw-r--r--test/libcxx/language.support/cxa_deleted_virtual.pass.cpp1
-rw-r--r--test/libcxx/language.support/has_c11_features.pass.cpp3
-rw-r--r--test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp260
-rw-r--r--test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp8
-rw-r--r--test/libcxx/libcpp_alignof.pass.cpp37
-rw-r--r--test/libcxx/memory/aligned_allocation_macro.pass.cpp (renamed from test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp)32
-rw-r--r--test/libcxx/min_max_macros.sh.cpp4
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp63
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp10
-rw-r--r--test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp1
-rw-r--r--test/libcxx/utilities/optional/optional.object/triviality.abi.pass.cpp98
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp54
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp62
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp64
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp36
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp15
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp2
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp38
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp63
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp15
-rw-r--r--test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp2
-rw-r--r--test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp3
98 files changed, 1837 insertions, 905 deletions
diff --git a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
index 28a9281b49c2a..58ce689981cac 100644
--- a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
+++ b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// <memory>
+// <algorithm>
// template <class RandomAccessIterator>
// void
@@ -23,6 +23,8 @@
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
// is defined before including <algorithm>, then random_shuffle will be restored.
+// REQUIRES: verify-support
+
// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
diff --git a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
new file mode 100644
index 0000000000000..608f4f86c31f9
--- /dev/null
+++ b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template <class RandomAccessIterator>
+// void
+// random_shuffle(RandomAccessIterator first, RandomAccessIterator last);
+//
+// template <class RandomAccessIterator, class RandomNumberGenerator>
+// void
+// random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
+// RandomNumberGenerator& rand);
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+
+#include <algorithm>
+#include <cstddef>
+
+#include "test_macros.h"
+
+struct gen
+{
+ std::ptrdiff_t operator()(std::ptrdiff_t n)
+ {
+ return n-1;
+ }
+};
+
+
+int main()
+{
+ int v[1] = {1};
+ std::random_shuffle(&v[0], &v[1]); // expected-error{{'random_shuffle<int *>' is deprecated}}
+ gen r;
+ std::random_shuffle(&v[0], &v[1], r); // expected-error{{'random_shuffle<int *, gen &>' is deprecated}}
+}
diff --git a/test/libcxx/algorithms/debug_less.pass.cpp b/test/libcxx/algorithms/debug_less.pass.cpp
index e030f64e5dd9d..302c5a8376c8d 100644
--- a/test/libcxx/algorithms/debug_less.pass.cpp
+++ b/test/libcxx/algorithms/debug_less.pass.cpp
@@ -161,7 +161,58 @@ void test_failing() {
}
}
+template <int>
+struct Tag {
+ explicit Tag(int v) : value(v) {}
+ int value;
+};
+
+template <class = void>
+struct FooImp {
+ explicit FooImp(int x) : x_(x) {}
+ int x_;
+};
+
+template <class T>
+inline bool operator<(FooImp<T> const& x, Tag<0> y) {
+ return x.x_ < y.value;
+}
+
+template <class T>
+inline bool operator<(Tag<0>, FooImp<T> const&) {
+ static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated");
+}
+
+template <class T>
+inline bool operator<(Tag<1> x, FooImp<T> const& y) {
+ return x.value < y.x_;
+}
+
+template <class T>
+inline bool operator<(FooImp<T> const&, Tag<1>) {
+ static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated");
+}
+
+typedef FooImp<> Foo;
+
+// Test that we don't attempt to call the comparator with the arguments reversed
+// for upper_bound and lower_bound since the comparator or type is not required
+// to support it, nor does it require the range to have a strict weak ordering.
+// See llvm.org/PR39458
+void test_upper_and_lower_bound() {
+ Foo table[] = {Foo(1), Foo(2), Foo(3), Foo(4), Foo(5)};
+ {
+ Foo* iter = std::lower_bound(std::begin(table), std::end(table), Tag<0>(3));
+ assert(iter == (table + 2));
+ }
+ {
+ Foo* iter = std::upper_bound(std::begin(table), std::end(table), Tag<1>(3));
+ assert(iter == (table + 3));
+ }
+}
+
int main() {
test_passing();
test_failing();
+ test_upper_and_lower_bound();
}
diff --git a/test/libcxx/algorithms/half_positive.pass.cpp b/test/libcxx/algorithms/half_positive.pass.cpp
new file mode 100644
index 0000000000000..7dcfc2c92c946
--- /dev/null
+++ b/test/libcxx/algorithms/half_positive.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// __half_positive divides an integer number by 2 as unsigned number for known types.
+// It can be an important optimization for lower bound, for example.
+
+#include <algorithm>
+#include <cassert>
+#include <limits>
+#include <type_traits>
+
+#include "test_macros.h"
+#include "user_defined_integral.hpp"
+
+namespace {
+
+template <class IntType, class UnderlyingType = IntType>
+TEST_CONSTEXPR bool test(IntType max_v = IntType(std::numeric_limits<UnderlyingType>::max())) {
+ return std::__half_positive(max_v) == max_v / 2;
+}
+
+} // namespace
+
+int main()
+{
+ {
+ assert(test<char>());
+ assert(test<int>());
+ assert(test<long>());
+ assert((test<UserDefinedIntegral<int>, int>()));
+ assert(test<size_t>());
+#if !defined(_LIBCPP_HAS_NO_INT128)
+ assert(test<__int128_t>());
+#endif // !defined(_LIBCPP_HAS_NO_INT128)
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ static_assert(test<char>(), "");
+ static_assert(test<int>(), "");
+ static_assert(test<long>(), "");
+ static_assert(test<size_t>(), "");
+#if !defined(_LIBCPP_HAS_NO_INT128)
+ static_assert(test<__int128_t>(), "");
+#endif // !defined(_LIBCPP_HAS_NO_INT128)
+ }
+#endif // TEST_STD_VER >= 11
+}
diff --git a/test/libcxx/containers/associative/non_const_comparator.fail.cpp b/test/libcxx/containers/associative/non_const_comparator.fail.cpp
index ea0d9ac09328e..ddd7960893997 100644
--- a/test/libcxx/containers/associative/non_const_comparator.fail.cpp
+++ b/test/libcxx/containers/associative/non_const_comparator.fail.cpp
@@ -27,7 +27,8 @@ int main() {
static_assert(!std::__invokable<BadCompare const&, int const&, int const&>::value, "");
static_assert(std::__invokable<BadCompare&, int const&, int const&>::value, "");
- // expected-warning@__tree:* 4 {{the specified comparator type does not provide a const call operator}}
+ // expected-warning@set:* 2 {{the specified comparator type does not provide a const call operator}}
+ // expected-warning@map:* 2 {{the specified comparator type does not provide a const call operator}}
{
using C = std::set<int, BadCompare>;
C s;
diff --git a/test/libcxx/type_traits/is_floating_point.pass.cpp b/test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp
index 98452fad384ba..e4f5d0b01197b 100644
--- a/test/libcxx/type_traits/is_floating_point.pass.cpp
+++ b/test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp
@@ -6,19 +6,21 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
-// <type_traits>
-//
-// Test that is_floating_point<T>::value is true when T=__fp16 or T=_Float16.
-#include <type_traits>
+// <deque>
+
+// pop_back() more than the number of elements in a deque
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <cstdlib>
+#include <deque>
+
int main() {
-#ifdef __clang__
- static_assert(std::is_floating_point<__fp16>::value, "");
-#endif
-#ifdef __FLT16_MANT_DIG__
- static_assert(std::is_floating_point<_Float16>::value, "");
-#endif
- return 0;
+ std::deque<int> q;
+ q.push_back(0);
+ q.pop_back();
+ q.pop_back();
+ std::exit(1);
}
diff --git a/test/libcxx/containers/sequences/vector/db_back.pass.cpp b/test/libcxx/containers/sequences/vector/db_back.pass.cpp
index 05f3d07712eb5..d66ffeb67af04 100644
--- a/test/libcxx/containers/sequences/vector/db_back.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_back.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
assert(c.back() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_cback.pass.cpp b/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
index 5eb1a353e8b04..9ad0fb92969f2 100644
--- a/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -32,7 +33,7 @@ int main()
assert(c.back() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp b/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
index 5e54da1d444e9..58f57a500dd9a 100644
--- a/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -32,7 +33,7 @@ int main()
assert(c.front() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp b/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
index 133aa56528245..9a54b6cb98420 100644
--- a/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
assert(c[1] == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_front.pass.cpp b/test/libcxx/containers/sequences/vector/db_front.pass.cpp
index 388058fb31593..0acb7df0c4d9e 100644
--- a/test/libcxx/containers/sequences/vector/db_front.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_front.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
assert(c.front() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_index.pass.cpp b/test/libcxx/containers/sequences/vector/db_index.pass.cpp
index 1daf076da67c1..75ae095f2b1c1 100644
--- a/test/libcxx/containers/sequences/vector/db_index.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_index.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
assert(c[0] == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
index 2d43843067b75..d5e8c86109b7c 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
bool b = c1.begin() < c2.begin();
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
index 051d66c33394d..96a75204a7bd6 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
int i = c1.begin() - c2.begin();
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
index 4c2aa628de143..311a517cfc015 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
assert(i[1] == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
index 1b1090499c276..6df3fd459c187 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,7 +37,7 @@ int main()
i += 2;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
index 424bc939b1366..0785dd96444ca 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -35,7 +36,7 @@ int main()
--i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
index 72cdb10cbc855..11ba9f864b0c9 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -35,7 +36,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
index 7b898533197c6..0434ad5f15098 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
T j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp b/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp
new file mode 100644
index 0000000000000..388dfa4e1a833
--- /dev/null
+++ b/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// pop_back() more than the number of elements in a vector
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <cstdlib>
+#include <vector>
+
+
+int main() {
+ std::vector<int> v;
+ v.push_back(0);
+ v.pop_back();
+ v.pop_back();
+ std::exit(1);
+}
diff --git a/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
new file mode 100644
index 0000000000000..998d0b74eddff
--- /dev/null
+++ b/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// template <class InputIter> vector(InputIter first, InputIter last);
+
+#include <vector>
+#include <cassert>
+
+#include "min_allocator.h"
+
+void test_ctor_under_alloc() {
+ int arr1[] = {42};
+ int arr2[] = {1, 101, 42};
+ {
+ typedef std::vector<int, cpp03_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3);
+ assert(Alloc::construct_called);
+ }
+ }
+ {
+ typedef std::vector<int, cpp03_overload_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3);
+ assert(Alloc::construct_called);
+ }
+ }
+}
+
+int main() {
+ test_ctor_under_alloc();
+}
diff --git a/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
new file mode 100644
index 0000000000000..c4950fbe637d6
--- /dev/null
+++ b/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// template <class InputIter> vector(InputIter first, InputIter last,
+// const allocator_type& a);
+
+#include <vector>
+#include <cassert>
+
+#include "min_allocator.h"
+
+void test_ctor_under_alloc() {
+ int arr1[] = {42};
+ int arr2[] = {1, 101, 42};
+ {
+ typedef std::vector<int, cpp03_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ Alloc a;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1, a);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3, a);
+ assert(Alloc::construct_called);
+ }
+ }
+ {
+ typedef std::vector<int, cpp03_overload_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ Alloc a;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1, a);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3, a);
+ assert(Alloc::construct_called);
+ }
+ }
+}
+
+int main() {
+ test_ctor_under_alloc();
+}
diff --git a/test/libcxx/containers/unord/non_const_comparator.fail.cpp b/test/libcxx/containers/unord/non_const_comparator.fail.cpp
index 8adc67589ef88..f428ab9aca6db 100644
--- a/test/libcxx/containers/unord/non_const_comparator.fail.cpp
+++ b/test/libcxx/containers/unord/non_const_comparator.fail.cpp
@@ -11,7 +11,7 @@
// REQUIRES: diagnose-if-support, verify-support
// Test that libc++ generates a warning diagnostic when the container is
-// provided a non-const callable comparator.
+// provided a non-const callable comparator or a non-const hasher.
#include <unordered_set>
#include <unordered_map>
@@ -34,8 +34,10 @@ int main() {
static_assert(!std::__invokable<BadEqual const&, int const&, int const&>::value, "");
static_assert(std::__invokable<BadEqual&, int const&, int const&>::value, "");
- // expected-warning@__hash_table:* 4 {{the specified comparator type does not provide a const call operator}}
- // expected-warning@__hash_table:* 4 {{the specified hash functor does not provide a const call operator}}
+ // expected-warning@unordered_set:* 2 {{the specified comparator type does not provide a const call operator}}
+ // expected-warning@unordered_map:* 2 {{the specified comparator type does not provide a const call operator}}
+ // expected-warning@unordered_set:* 2 {{the specified hash functor does not provide a const call operator}}
+ // expected-warning@unordered_map:* 2 {{the specified hash functor does not provide a const call operator}}
{
using C = std::unordered_set<int, BadHash, BadEqual>;
diff --git a/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp b/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
index b8db0a35ffc3e..664cb7e86b959 100644
--- a/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
@@ -22,6 +22,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,7 +37,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp b/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
index c923dd77862e6..621d7f343e085 100644
--- a/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
@@ -22,6 +22,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
C::value_type j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp b/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
index fa1886bfff189..19794e04769d9 100644
--- a/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
@@ -22,6 +22,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp b/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
index 4b071cad7b473..1567caf9be9ef 100644
--- a/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
@@ -22,6 +22,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
C::value_type j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp b/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000000000..3ad9ae8d6f683
--- /dev/null
+++ b/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+//
+// template <class X>
+// class auto_ptr;
+//
+// class auto_ptr<void>;
+//
+// template <class X>
+// class auto_ptr_ref;
+//
+// Deprecated in C++11
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+
+#include <memory>
+#include "test_macros.h"
+
+int main()
+{
+ typedef std::auto_ptr<int> AP; // expected-error{{'auto_ptr<int>' is deprecated}}
+ typedef std::auto_ptr<void> APV; // expected-error{{'auto_ptr<void>' is deprecated}}
+ typedef std::auto_ptr_ref<int> APR; // expected-error{{'auto_ptr_ref<int>' is deprecated}}
+}
diff --git a/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp b/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000000000..88c1e21d6bb61
--- /dev/null
+++ b/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+#include <cassert>
+#include "test_macros.h"
+
+int identity(int v) { return v; }
+int sum(int a, int b) { return a + b; }
+
+struct Foo {
+ int const_zero() const { return 0; }
+ int const_identity(int v) const { return v; }
+ int zero() { return 0; }
+ int identity(int v) { return v; }
+};
+
+int main()
+{
+ typedef std::pointer_to_unary_function<int, int> PUF; // expected-error{{'pointer_to_unary_function<int, int>' is deprecated}}
+ typedef std::pointer_to_binary_function<int, int, int> PBF; // expected-error{{'pointer_to_binary_function<int, int, int>' is deprecated}}
+ std::ptr_fun<int, int>(identity); // expected-error{{'ptr_fun<int, int>' is deprecated}}
+ std::ptr_fun<int, int, int>(sum); // expected-error{{'ptr_fun<int, int, int>' is deprecated}}
+
+ typedef std::mem_fun_t<int, Foo> MFT0; // expected-error{{'mem_fun_t<int, Foo>' is deprecated}}
+ typedef std::mem_fun1_t<int, Foo, int> MFT1; // expected-error{{'mem_fun1_t<int, Foo, int>' is deprecated}}
+ typedef std::const_mem_fun_t<int, Foo> CMFT0; // expected-error{{'const_mem_fun_t<int, Foo>' is deprecated}}
+ typedef std::const_mem_fun1_t<int, Foo, int> CMFT1; // expected-error{{'const_mem_fun1_t<int, Foo, int>' is deprecated}}
+ std::mem_fun<int, Foo>(&Foo::zero); // expected-error{{'mem_fun<int, Foo>' is deprecated}}
+ std::mem_fun<int, Foo, int>(&Foo::identity); // expected-error{{'mem_fun<int, Foo, int>' is deprecated}}
+ std::mem_fun<int, Foo>(&Foo::const_zero); // expected-error{{'mem_fun<int, Foo>' is deprecated}}
+ std::mem_fun<int, Foo, int>(&Foo::const_identity); // expected-error{{'mem_fun<int, Foo, int>' is deprecated}}
+
+ typedef std::mem_fun_ref_t<int, Foo> MFR0; // expected-error{{'mem_fun_ref_t<int, Foo>' is deprecated}}
+ typedef std::mem_fun1_ref_t<int, Foo, int> MFR1; // expected-error{{'mem_fun1_ref_t<int, Foo, int>' is deprecated}}
+ typedef std::const_mem_fun_ref_t<int, Foo> CMFR0; // expected-error{{'const_mem_fun_ref_t<int, Foo>' is deprecated}}
+ typedef std::const_mem_fun1_ref_t<int, Foo, int> CMFR1; // expected-error{{'const_mem_fun1_ref_t<int, Foo, int>' is deprecated}}
+ std::mem_fun_ref<int, Foo>(&Foo::zero); // expected-error{{'mem_fun_ref<int, Foo>' is deprecated}}
+ std::mem_fun_ref<int, Foo, int>(&Foo::identity); // expected-error{{'mem_fun_ref<int, Foo, int>' is deprecated}}
+ std::mem_fun_ref<int, Foo>(&Foo::const_zero); // expected-error{{'mem_fun_ref<int, Foo>' is deprecated}}
+ std::mem_fun_ref<int, Foo, int>(&Foo::const_identity); // expected-error{{'mem_fun_ref<int, Foo, int>' is deprecated}}
+}
diff --git a/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp b/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
index 1847dac2ed00d..beb5608006122 100644
--- a/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
+++ b/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
@@ -24,15 +24,25 @@ int identity(int v) { return v; }
int sum(int a, int b) { return a + b; }
struct Foo {
- int zero() const { return 0; }
- int identity(int v) const { return v; }
- int sum(int a, int b) const { return a + b; }
+ int zero() { return 0; }
+ int zero_const() const { return 1; }
+
+ int identity(int v) const { return v; }
+ int sum(int a, int b) const { return a + b; }
};
int main()
{
typedef std::pointer_to_unary_function<int, int> PUF;
typedef std::pointer_to_binary_function<int, int, int> PBF;
+
+ static_assert(
+ (std::is_same<PUF, decltype((std::ptr_fun<int, int>(identity)))>::value),
+ "");
+ static_assert(
+ (std::is_same<PBF, decltype((std::ptr_fun<int, int, int>(sum)))>::value),
+ "");
+
assert((std::ptr_fun<int, int>(identity)(4) == 4));
assert((std::ptr_fun<int, int, int>(sum)(4, 5) == 9));
@@ -43,6 +53,12 @@ int main()
typedef std::mem_fun_ref_t<int, Foo> MFR;
typedef std::const_mem_fun_ref_t<int, Foo> CMFR;
+ static_assert(
+ (std::is_same<MFR, decltype((std::mem_fun_ref(&Foo::zero)))>::value), "");
+ static_assert((std::is_same<CMFR, decltype((std::mem_fun_ref(
+ &Foo::zero_const)))>::value),
+ "");
+
assert((std::mem_fun_ref(&Foo::zero)(f) == 0));
assert((std::mem_fun_ref(&Foo::identity)(f, 5) == 5));
}
diff --git a/test/libcxx/diagnostics/enable_nodiscard.fail.cpp b/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
new file mode 100644
index 0000000000000..e1ef17672ccb9
--- /dev/null
+++ b/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that _LIBCPP_NODISCARD_EXT and _LIBCPP_NODISCARD_AFTER_CXX17 are defined
+// to the appropriate warning-generating attribute when _LIBCPP_ENABLE_NODISCARD
+// is explicitly provided.
+
+// UNSUPPORTED: c++98, c++03
+
+// GCC 7 is the first version to introduce [[nodiscard]]
+// UNSUPPORTED: gcc-4.9, gcc-5, gcc-6
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_ENABLE_NODISCARD
+
+#include <__config>
+
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
+_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; }
+
+int main() {
+ foo(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ bar(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ (void)foo(); // OK. void casts disable the diagnostic.
+ (void)bar();
+}
diff --git a/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp b/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
new file mode 100644
index 0000000000000..2c7d899ff5a04
--- /dev/null
+++ b/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// GCC 7 is the first version to introduce [[nodiscard]]
+// UNSUPPORTED: gcc-4.9, gcc-5, gcc-6
+
+// Test that _LIBCPP_DISABLE_NODISCARD_EXT only disables _LIBCPP_NODISCARD_EXT
+// and not _LIBCPP_NODISCARD_AFTER_CXX17.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#define _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#include <__config>
+
+
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
+_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; }
+
+int main() {
+ foo(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ bar(); // OK.
+ (void)foo(); // OK.
+}
diff --git a/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp b/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
new file mode 100644
index 0000000000000..c7d080d8425ce
--- /dev/null
+++ b/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// GCC 7 is the first version to introduce [[nodiscard]]
+// UNSUPPORTED: gcc-4.9, gcc-5, gcc-6
+
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_EXT
+#define _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_DISABLE_NODISCARD_EXT
+#include <__config>
+
+
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
+_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; }
+
+int main() {
+ bar(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ foo(); // OK.
+ (void)bar(); // OK.
+}
diff --git a/test/libcxx/diagnostics/nodiscard.pass.cpp b/test/libcxx/diagnostics/nodiscard.pass.cpp
index d308248cff228..de920d459ed66 100644
--- a/test/libcxx/diagnostics/nodiscard.pass.cpp
+++ b/test/libcxx/diagnostics/nodiscard.pass.cpp
@@ -8,18 +8,13 @@
//
//===----------------------------------------------------------------------===//
-// Test that _LIBCPP_NODISCARD_AFTER_CXX17 works
-// #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
+// Test that _LIBCPP_NODISCARD_EXT is not defined to [[nodiscard]] unless
+// explicitly enabled by _LIBCPP_ENABLE_NODISCARD
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-
-// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
-#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
#include <__config>
-_LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; }
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
-int main ()
-{
- foo(); // no error here!
+int main() {
+ foo(); // OK.
}
diff --git a/test/libcxx/diagnostics/nodiscard.fail.cpp b/test/libcxx/diagnostics/nodiscard_aftercxx17.fail.cpp
index 903a24a72805a..47e560feb962f 100644
--- a/test/libcxx/diagnostics/nodiscard.fail.cpp
+++ b/test/libcxx/diagnostics/nodiscard_aftercxx17.fail.cpp
@@ -12,7 +12,6 @@
// #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
#include <__config>
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp b/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
index 48da6d885773f..4db8181723e14 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp
+++ b/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
@@ -1,3 +1,4 @@
+// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -7,22 +8,16 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11
-// dynarray.data
-
-// template <class Type, class Alloc>
-// struct uses_allocator<dynarray<Type>, Alloc> : true_type { };
-
+// Test that _LIBCPP_NODISCARD_AFTER_CXX17 is disabled whenever
+// _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17 is defined by the user.
+// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
#include <__config>
-#include <experimental/dynarray>
-#include "test_allocator.h"
+_LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; }
-using std::experimental::dynarray;
-
-int main()
+int main ()
{
- static_assert ( std::uses_allocator<dynarray<int>, test_allocator<int>>::value, "" );
+ foo(); // no error here!
}
-
diff --git a/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp b/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
new file mode 100644
index 0000000000000..d1e0a8af5c8a6
--- /dev/null
+++ b/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// GCC versions prior to 7.0 don't provide the required [[nodiscard]] attribute.
+// UNSUPPORTED: gcc-4, gcc-5, gcc-6
+
+// Test that entities declared [[nodiscard]] as at extension by libc++, are
+// only actually declared such when _LIBCPP_ENABLE_NODISCARD is specified.
+
+// All entities to which libc++ applies [[nodiscard]] as an extension should
+// be tested here and in nodiscard_extensions.pass.cpp. They should also
+// be listed in `UsingLibcxx.rst` in the documentation for the extension.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_ENABLE_NODISCARD
+
+#include <memory>
+
+#include "test_macros.h"
+
+int main() {
+ {
+ // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ std::get_temporary_buffer<int>(1);
+ }
+}
diff --git a/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp b/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp
new file mode 100644
index 0000000000000..9a09a43bae1cd
--- /dev/null
+++ b/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that entities declared [[nodiscard]] as at extension by libc++, are
+// only actually declared such when _LIBCPP_ENABLE_NODISCARD is specified.
+
+// This test intentionally leaks memory, so it is unsupported under ASAN.
+// UNSUPPORTED: asan
+
+// All entities to which libc++ applies [[nodiscard]] as an extension should
+// be tested here and in nodiscard_extensions.fail.cpp. They should also
+// be listed in `UsingLibcxx.rst` in the documentation for the extension.
+
+#include <memory>
+
+#include "test_macros.h"
+
+int main() {
+ {
+ std::get_temporary_buffer<int>(1); // intentional memory leak.
+ }
+}
diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp
index 8d08db4fd1055..5a0f2ba72dc00 100644
--- a/test/libcxx/double_include.sh.cpp
+++ b/test/libcxx/double_include.sh.cpp
@@ -27,6 +27,7 @@
#ifndef _LIBCPP_HAS_NO_THREADS
#include <atomic>
#endif
+#include <bit>
#include <bitset>
#include <cassert>
#include <ccomplex>
@@ -144,7 +145,6 @@
#include <experimental/coroutine>
#endif
#include <experimental/deque>
-#include <experimental/dynarray>
#include <experimental/filesystem>
#include <experimental/forward_list>
#include <experimental/functional>
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
deleted file mode 100644
index c6a83cc61bdcb..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// dynarray.cons
-
-// template <class Alloc>
-// dynarray(size_type c, const Alloc& alloc);
-// template <class Alloc>
-// dynarray(size_type c, const T& v, const Alloc& alloc);
-// template <class Alloc>
-// dynarray(const dynarray& d, const Alloc& alloc);
-// template <class Alloc>
-// dynarray(initializer_list<T>, const Alloc& alloc);
-
-// ~dynarray();
-
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-#include "test_allocator.h"
-
-using std::experimental::dynarray;
-
-template <class T, class Allocator>
-void check_allocator ( const dynarray<T> &dyn, const Allocator &alloc ) {
- for ( int i = 0; i < dyn.size (); ++i )
- assert ( dyn[i].get_allocator() == alloc );
-}
-
-template <class T, class Allocator>
-void test ( const std::initializer_list<T> &vals, const Allocator &alloc ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals, alloc );
- assert ( d1.size () == vals.size() );
- assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ()));
- check_allocator ( d1, alloc );
- }
-
-
-template <class T, class Allocator>
-void test ( const T &val, const Allocator &alloc1, const Allocator &alloc2 ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 4, alloc1 );
- assert ( d1.size () == 4 );
- assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } ));
- check_allocator ( d1, alloc1 );
-
- dynA d2 ( 7, val, alloc1 );
- assert ( d2.size () == 7 );
- assert ( std::all_of ( d2.begin (), d2.end (), [&val]( const T &item ){ return item == val; } ));
- check_allocator ( d2, alloc1 );
-
- dynA d3 ( d2, alloc2 );
- assert ( d3.size () == 7 );
- assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));
- check_allocator ( d3, alloc2 );
- }
-
-int main()
-{
-// This test is waiting on the resolution of LWG issue #2235
-// typedef test_allocator<char> Alloc;
-// typedef std::basic_string<char, std::char_traits<char>, Alloc> nstr;
-//
-// test ( nstr("fourteen"), Alloc(3), Alloc(4) );
-// test ( { nstr("1"), nstr("1"), nstr("2"), nstr("3"), nstr("5"), nstr("8")}, Alloc(6));
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
deleted file mode 100644
index db7484d468dad..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability=macosx10.12
-// XFAIL: availability=macosx10.11
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.7
-
-// dynarray.cons
-
-// explicit dynarray(size_type c);
-// dynarray(size_type c, const T& v);
-// dynarray(initializer_list<T>);
-// dynarray(const dynarray& d);
-
-// ~dynarray();
-
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <limits>
-#include <new>
-#include <string>
-
-#include "test_macros.h"
-
-
-using std::experimental::dynarray;
-
-template <class T>
-void testInitList( const std::initializer_list<T> &vals ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals );
- assert ( d1.size () == vals.size() );
- assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ()));
- }
-
-
-template <class T>
-void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 4 );
- assert ( d1.size () == 4 );
- if (!DefaultValueIsIndeterminate) {
- assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } ));
- }
-
- dynA d2 ( 7, val );
- assert ( d2.size () == 7 );
- assert ( std::all_of ( d2.begin (), d2.end (), [&val]( const T &item ){ return item == val; } ));
-
- dynA d3 ( d2 );
- assert ( d3.size () == 7 );
- assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));
- }
-
-#ifndef TEST_HAS_NO_EXCEPTIONS
-void test_bad_length () {
- try { dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) + 1 ); }
- catch ( std::bad_array_length & ) { return ; }
- catch (...) { assert(false); }
- assert ( false );
-}
-#endif
-
-
-int main()
-{
- test<int> ( 14, /* DefaultValueIsIndeterminate */ true ); // ints don't get default initialized
- test<long> ( 0, true);
- test<double> ( 14.0, true );
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-
- testInitList( { 1, 1, 2, 3, 5, 8 } );
- testInitList( { 1., 1., 2., 3., 5., 8. } );
- testInitList( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
- std::string("5"), std::string("8")} );
-
-// Make sure we don't pick up the Allocator version here
- dynarray<long> d1 ( 20, 3 );
- assert ( d1.size() == 20 );
- assert ( std::all_of ( d1.begin (), d1.end (), []( long item ){ return item == 3L; } ));
-
-#ifndef TEST_HAS_NO_EXCEPTIONS
- test_bad_length ();
-#endif
-}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
deleted file mode 100644
index 4009841355f9f..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: libcpp-no-exceptions
-// XFAIL: availability
-// dynarray.cons
-
-// explicit dynarray(size_type c);
-
-// UNSUPPORTED: c++98, c++03, c++11
-
-// The sanitizers replace new/delete with versions that do not throw bad_alloc.
-// UNSUPPORTED: sanitizer-new-delete
-
-
-#include <experimental/dynarray>
-#include <limits>
-#include <new>
-#include <cassert>
-
-
-using std::experimental::dynarray;
-
-int main() {
- try { dynarray<int>((std::numeric_limits<size_t>::max() / sizeof(int)) - 1); }
- catch (std::bad_alloc &) { return 0; }
- catch (...) { assert(false); }
- assert(false);
-}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
deleted file mode 100644
index 5c745e0d1eaf1..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.data
-
-// T* data() noexcept;
-// const T* data() const noexcept;
-
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test_const(const dynarray<T> &dyn, bool CheckEquals = true) {
- const T *data = dyn.data ();
- assert ( data != NULL );
- if (CheckEquals) {
- assert ( std::equal ( dyn.begin(), dyn.end(), data ));
- }
-}
-
-template <class T>
-void dyn_test( dynarray<T> &dyn, bool CheckEquals = true) {
- T *data = dyn.data ();
- assert ( data != NULL );
- if (CheckEquals) {
- assert ( std::equal ( dyn.begin(), dyn.end(), data ));
- }
-}
-
-
-
-template <class T>
-void test(const T &val, bool DefaultValueIsIndeterminate = false) {
- typedef dynarray<T> dynA;
-
- const bool CheckDefaultValues = !DefaultValueIsIndeterminate;
-
- dynA d1(4);
- dyn_test(d1, CheckDefaultValues);
- dyn_test_const(d1, CheckDefaultValues);
-
- dynA d2 (7, val);
- dyn_test ( d2 );
- dyn_test_const ( d2 );
-}
-
-int main()
-{
- test<int>(14, /* DefaultValueIsIndeterminate */ true);
- test<double>(14.0, true);
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
deleted file mode 100644
index 1ed51538f6faa..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.data
-
-// void fill(const T& v);
-// const T* data() const noexcept;
-
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void test ( const T &val ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 4 );
- d1.fill ( val );
- assert ( std::all_of ( d1.begin (), d1.end (),
- [&val]( const T &item ){ return item == val; } ));
- }
-
-int main()
-{
- test<int> ( 14 );
- test<double> ( 14.0 );
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
deleted file mode 100644
index 473313f39fc47..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// UNSUPPORTED: libcpp-no-exceptions
-// XFAIL: availability
-
-// dynarray.overview
-
-// const_reference at(size_type n) const;
-// reference at(size_type n);
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_at_fail ( dynarray<T> &dyn, size_t sz ) {
- try { dyn.at (sz); }
- catch (const std::out_of_range &) { return; }
- assert ( false );
- }
-
-template <class T>
-void dyn_at_fail_const ( const dynarray<T> &dyn, size_t sz ) {
- try { dyn.at (sz); }
- catch (const std::out_of_range &) { return; }
- assert ( false );
- }
-
-
-template <class T>
-void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
- const T *data = dyn.data ();
- auto it = vals.begin ();
- for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
- assert ( data + i == &dyn.at(i));
- assert ( *it == dyn.at(i));
- }
-
- dyn_at_fail_const ( dyn, dyn.size ());
- dyn_at_fail_const ( dyn, 2*dyn.size ());
- dyn_at_fail_const ( dyn, size_t (-1));
- }
-
-template <class T>
-void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
- T *data = dyn.data ();
- auto it = vals.begin ();
- for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
- assert ( data + i == &dyn.at(i));
- assert ( *it == dyn.at(i));
- }
-
- dyn_at_fail ( dyn, dyn.size ());
- dyn_at_fail ( dyn, 2*dyn.size ());
- dyn_at_fail ( dyn, size_t (-1));
- }
-
-
-template <class T>
-void test ( std::initializer_list<T> vals ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals );
- dyn_test ( d1, vals );
- dyn_test_const ( d1, vals );
- }
-
-int main()
-{
- test ( { 1, 1, 2, 3, 5, 8 } );
- test ( { 1., 1., 2., 3., 5., 8. } );
- test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
- std::string("5"), std::string("8")} );
-
- test<int> ( {} );
- test<std::complex<double>> ( {} );
- test<std::string> ( {} );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
deleted file mode 100644
index f0aa1e3ff6911..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.overview
-
-
-// iterator begin() noexcept;
-// const_iterator begin() const noexcept;
-// const_iterator cbegin() const noexcept;
-// iterator end() noexcept;
-// const_iterator end() const noexcept;
-// const_iterator cend() const noexcept;
-//
-// reverse_iterator rbegin() noexcept;
-// const_reverse_iterator rbegin() const noexcept;
-// const_reverse_iterator crbegin() const noexcept;
-// reverse_iterator rend() noexcept;
-// const_reverse_iterator rend() const noexcept;
-// const_reverse_iterator crend() const noexcept;
-
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cstddef>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test_const ( const dynarray<T> &dyn ) {
- const T *data = dyn.data ();
- assert ( data == &*dyn.begin ());
- assert ( data == &*dyn.cbegin ());
-
- assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
- assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
-
- std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size());
- assert (ds == std::distance ( dyn.begin(), dyn.end()));
- assert (ds == std::distance ( dyn.cbegin(), dyn.cend()));
- assert (ds == std::distance ( dyn.rbegin(), dyn.rend()));
- assert (ds == std::distance ( dyn.crbegin(), dyn.crend()));
-
- assert ( dyn.begin () == dyn.cbegin ());
- assert ( &*dyn.begin () == &*dyn.cbegin ());
- assert ( dyn.rbegin () == dyn.crbegin ());
- assert ( &*dyn.rbegin () == &*dyn.crbegin ());
- assert ( dyn.end () == dyn.cend ());
- assert ( dyn.rend () == dyn.crend ());
- }
-
-template <class T>
-void dyn_test ( dynarray<T> &dyn ) {
- T *data = dyn.data ();
- assert ( data == &*dyn.begin ());
- assert ( data == &*dyn.cbegin ());
-
- assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
- assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
-
- std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size());
- assert (ds == std::distance ( dyn.begin(), dyn.end()));
- assert (ds == std::distance ( dyn.cbegin(), dyn.cend()));
- assert (ds == std::distance ( dyn.rbegin(), dyn.rend()));
- assert (ds == std::distance ( dyn.crbegin(), dyn.crend()));
-
- assert ( dyn.begin () == dyn.cbegin ());
- assert ( &*dyn.begin () == &*dyn.cbegin ());
- assert ( dyn.rbegin () == dyn.crbegin ());
- assert ( &*dyn.rbegin () == &*dyn.crbegin ());
- assert ( dyn.end () == dyn.cend ());
- assert ( dyn.rend () == dyn.crend ());
- }
-
-
-template <class T>
-void test ( const T &val ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 4 );
- dyn_test ( d1 );
- dyn_test_const ( d1 );
-
- dynA d2 ( 7, val );
- dyn_test ( d2 );
- dyn_test_const ( d2 );
- }
-
-int main()
-{
- test<int> ( 14 );
- test<double> ( 14.0 );
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
deleted file mode 100644
index a5484296fa21b..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.overview
-
-// size_type size() const noexcept;
-// size_type max_size() const noexcept;
-// bool empty() const noexcept;
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test ( const dynarray<T> &dyn, size_t sz ) {
- assert ( dyn.size () == sz );
- assert ( dyn.max_size () == sz );
- assert ( dyn.empty () == ( sz == 0 ));
- }
-
-template <class T>
-void test ( std::initializer_list<T> vals ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals );
- dyn_test ( d1, vals.size ());
- }
-
-int main()
-{
- test ( { 1, 1, 2, 3, 5, 8 } );
- test ( { 1., 1., 2., 3., 5., 8. } );
- test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
- std::string("5"), std::string("8")} );
-
- test<int> ( {} );
- test<std::complex<double>> ( {} );
- test<std::string> ( {} );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
deleted file mode 100644
index 0ba27cf925f77..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.overview
-
-// reference front();
-// const_reference front() const;
-// reference back();
-// const_reference back() const;
-
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test_const ( const dynarray<T> &dyn, bool CheckValues = true ) {
- const T *data = dyn.data ();
- assert(data == &dyn.front());
- assert((data + dyn.size() - 1) == &dyn.back());
- if (CheckValues) {
- assert ( *data == dyn.front ());
- assert ( *(data + dyn.size() - 1 ) == dyn.back ());
- }
-}
-
-template <class T>
-void dyn_test ( dynarray<T> &dyn, bool CheckValues = true ) {
- T *data = dyn.data ();
- assert(data == &dyn.front());
- assert((data + dyn.size() - 1) == &dyn.back());
- if (CheckValues) {
- assert ( *data == dyn.front ());
- assert ( *(data + dyn.size() - 1 ) == dyn.back ());
- }
-}
-
-
-template <class T>
-void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
- typedef dynarray<T> dynA;
-
- const bool CheckDefaultValues = ! DefaultValueIsIndeterminate;
-
- dynA d1 ( 4 );
- dyn_test ( d1, CheckDefaultValues );
- dyn_test_const ( d1, CheckDefaultValues );
-
- dynA d2 ( 7, val );
- dyn_test ( d2 );
- dyn_test_const ( d2 );
-}
-
-int main()
-{
- test<int> ( 14, /* DefaultValueIsIndeterminate */ true);
- test<double> ( 14.0, true );
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
deleted file mode 100644
index 4306d1e9c1b67..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-
-// XFAIL: availability=macosx10.12
-// XFAIL: availability=macosx10.11
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.7
-
-// dynarray.overview
-
-// const_reference at(size_type n) const;
-// reference at(size_type n);
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
- const T *data = dyn.data ();
- auto it = vals.begin ();
- for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
- assert ( data + i == &dyn[i]);
- assert ( *it == dyn[i]);
- }
- }
-
-template <class T>
-void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
- T *data = dyn.data ();
- auto it = vals.begin ();
- for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
- assert ( data + i == &dyn[i]);
- assert ( *it == dyn[i]);
- }
- }
-
-
-template <class T>
-void test ( std::initializer_list<T> vals ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals );
- dyn_test ( d1, vals );
- dyn_test_const ( d1, vals );
- }
-
-int main()
-{
- test ( { 1, 1, 2, 3, 5, 8 } );
- test ( { 1., 1., 2., 3., 5., 8. } );
- test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
- std::string("5"), std::string("8")} );
-
- test<int> ( {} );
- test<std::complex<double>> ( {} );
- test<std::string> ( {} );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp
deleted file mode 100644
index ab49600350600..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-// dynarray.zero
-
-// dynarray shall provide support for the special case of construction with a size of zero.
-// In the case that the size is zero, begin() == end() == unique value.
-// The return value of data() is unspecified.
-// The effect of calling front() or back() for a zero-sized dynarray is undefined.
-
-
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void test ( ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 0 );
- assert ( d1.size() == 0 );
- assert ( d1.begin() == d1.end ());
- }
-
-int main()
-{
- test<int> ();
- test<double> ();
- test<std::complex<double>> ();
- test<std::string> ();
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg b/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg
deleted file mode 100644
index 93553b5130e39..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-if ('availability' in config.available_features
- and not 'libcpp-no-exceptions' in config.available_features):
- config.unsupported = True
diff --git a/test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp b/test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..074a9c58c6140
--- /dev/null
+++ b/test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/system_error>
+
+#include <experimental/system_error>
+
+// expected-error@experimental/system_error:* {{"<experimental/system_error> has been removed. Use <system_error> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/diagnostics/syserr/version.pass.cpp b/test/libcxx/experimental/diagnostics/syserr/version.pass.cpp
new file mode 100644
index 0000000000000..c4fb9593a9ee2
--- /dev/null
+++ b/test/libcxx/experimental/diagnostics/syserr/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/system_error>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/system_error>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
index 40bacbcbad590..b2150fcd2716b 100644
--- a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
+++ b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
@@ -106,14 +106,10 @@ struct CountCopiesAllocV2 {
int main()
{
- using PMR = ex::memory_resource*;
- using PMA = ex::polymorphic_allocator<char>;
-
{
using T = CountCopies;
using U = CountCopiesAllocV1;
using P = std::pair<T, U>;
- using TH = TestHarness<P>;
std::tuple<T> t1;
std::tuple<U> t2;
@@ -129,7 +125,6 @@ int main()
using T = CountCopiesAllocV1;
using U = CountCopiesAllocV2;
using P = std::pair<T, U>;
- using TH = TestHarness<P>;
std::tuple<T> t1;
std::tuple<U> t2;
@@ -146,7 +141,6 @@ int main()
using T = CountCopiesAllocV2;
using U = CountCopiesAllocV1;
using P = std::pair<T, U>;
- using TH = TestHarness<P>;
std::tuple<T> t1;
std::tuple<U> t2;
@@ -163,7 +157,6 @@ int main()
using T = CountCopiesAllocV2;
using U = CountCopies;
using P = std::pair<T, U>;
- using TH = TestHarness<P>;
std::tuple<T> t1;
std::tuple<U> t2;
diff --git a/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp b/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
index ccb9b710e5dcd..ffcedf0bf5319 100644
--- a/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
+++ b/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
@@ -30,7 +30,7 @@ namespace ex = std::experimental::pmr;
int main()
{
using Alloc = NullAllocator<char>;
- using R = ex::resource_adaptor<Alloc>;
+
AllocController P;
ex::resource_adaptor<Alloc> r(Alloc{P});
ex::memory_resource & m1 = r;
diff --git a/test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp b/test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..32fd0527d482b
--- /dev/null
+++ b/test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/numeric>
+
+#include <experimental/numeric>
+
+// expected-error@experimental/numeric:* {{"<experimental/numeric> has been removed. Use <numeric> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp b/test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp
new file mode 100644
index 0000000000000..37ac584a7cd4d
--- /dev/null
+++ b/test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/numeric>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/numeric>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp b/test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..64f73742099bb
--- /dev/null
+++ b/test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/string_view>
+
+#include <experimental/string_view>
+
+// expected-error@experimental/string_view:* {{"<experimental/string_view> has been removed. Use <string_view> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/strings/string.view/version.pass.cpp b/test/libcxx/experimental/strings/string.view/version.pass.cpp
new file mode 100644
index 0000000000000..417982e36696f
--- /dev/null
+++ b/test/libcxx/experimental/strings/string.view/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/string_view>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/string_view>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/nothing_to_do.pass.cpp b/test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp
index b58f5c55b643a..0bcda7056b4d0 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/nothing_to_do.pass.cpp
+++ b/test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp
@@ -7,6 +7,12 @@
//
//===----------------------------------------------------------------------===//
-int main()
-{
-}
+// REQUIRES: verify-support
+
+// <experimental/any>
+
+#include <experimental/any>
+
+// expected-error@experimental/any:* {{"<experimental/any> has been removed. Use <any> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/any/version.pass.cpp b/test/libcxx/experimental/utilities/any/version.pass.cpp
new file mode 100644
index 0000000000000..bc37d8b4dbfa5
--- /dev/null
+++ b/test/libcxx/experimental/utilities/any/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/any>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/any>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp b/test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..1711d2f03742a
--- /dev/null
+++ b/test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/optional>
+
+#include <experimental/optional>
+
+// expected-error@experimental/optional:* {{"<experimental/optional> has been removed. Use <optional> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/optional/version.pass.cpp b/test/libcxx/experimental/utilities/optional/version.pass.cpp
new file mode 100644
index 0000000000000..ef011bbe4506e
--- /dev/null
+++ b/test/libcxx/experimental/utilities/optional/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/optional>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/optional>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp b/test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..d9a01337a9367
--- /dev/null
+++ b/test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/ratio>
+
+#include <experimental/ratio>
+
+// expected-error@experimental/ratio:* {{"<experimental/ratio> has been removed. Use <ratio> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/ratio/version.pass.cpp b/test/libcxx/experimental/utilities/ratio/version.pass.cpp
new file mode 100644
index 0000000000000..8ebb347a44ba2
--- /dev/null
+++ b/test/libcxx/experimental/utilities/ratio/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/ratio>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/ratio>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp b/test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..9f3d679fc2ab5
--- /dev/null
+++ b/test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/chrono>
+
+#include <experimental/chrono>
+
+// expected-error@experimental/chrono:* {{"<experimental/chrono> has been removed. Use <chrono> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/time/version.pass.cpp b/test/libcxx/experimental/utilities/time/version.pass.cpp
new file mode 100644
index 0000000000000..5544a3f0e14b5
--- /dev/null
+++ b/test/libcxx/experimental/utilities/time/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/chrono>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/chrono>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp b/test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..520e9fbb42f09
--- /dev/null
+++ b/test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/tuple>
+
+#include <experimental/tuple>
+
+// expected-error@experimental/tuple:* {{"<experimental/tuple> has been removed. Use <tuple> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/tuple/version.pass.cpp b/test/libcxx/experimental/utilities/tuple/version.pass.cpp
new file mode 100644
index 0000000000000..c7c9e572856d1
--- /dev/null
+++ b/test/libcxx/experimental/utilities/tuple/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/tuple>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/tuple>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp
new file mode 100644
index 0000000000000..0f8defcbd97d8
--- /dev/null
+++ b/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// close();
+
+// Inspired by PR#38052 - std::fstream still good after closing and updating content
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+
+ std::fstream ofs(temp, std::ios::out | std::ios::trunc);
+ ofs << "Hello, World!\n";
+ assert( ofs.good());
+ ofs.close();
+ assert( ofs.good());
+ ofs << "Hello, World!\n";
+ assert(!ofs.good());
+
+ std::remove(temp.c_str());
+}
diff --git a/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp b/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
index ddef5d00e5da4..7e3130cf9fa98 100644
--- a/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
+++ b/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
@@ -12,6 +12,7 @@
// Test exporting the symbol: "__cxa_deleted_virtual" in macosx
// But don't expect the symbol to be exported in previous versions.
//
+// XFAIL: with_system_cxx_lib=macosx10.14
// XFAIL: with_system_cxx_lib=macosx10.13
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
diff --git a/test/libcxx/language.support/has_c11_features.pass.cpp b/test/libcxx/language.support/has_c11_features.pass.cpp
index cdccc00e21b4f..4edec534eb98b 100644
--- a/test/libcxx/language.support/has_c11_features.pass.cpp
+++ b/test/libcxx/language.support/has_c11_features.pass.cpp
@@ -14,6 +14,9 @@
// _LIBCPP_HAS_C11_FEATURES - which is defined in <__config>
// They should always be the same
+#include <__config>
+#include "test_macros.h"
+
#ifdef TEST_HAS_C11_FEATURES
# ifndef _LIBCPP_HAS_C11_FEATURES
# error "TEST_HAS_C11_FEATURES is defined, but _LIBCPP_HAS_C11_FEATURES is not"
diff --git a/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp b/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
new file mode 100644
index 0000000000000..f62e82d8e594a
--- /dev/null
+++ b/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
@@ -0,0 +1,260 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test libc++'s implementation of align_val_t, and the relevant new/delete
+// overloads in all dialects when -faligned-allocation is present.
+
+// Libc++ defers to the underlying MSVC library to provide the new/delete
+// definitions, which does not yet provide aligned allocation
+// XFAIL: LIBCXX-WINDOWS-FIXME
+
+// The dylibs shipped before macosx10.14 do not contain the aligned allocation
+// functions, so trying to force using those with -faligned-allocation results
+// in a link error.
+// XFAIL: with_system_cxx_lib=macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.10
+// XFAIL: with_system_cxx_lib=macosx10.9
+// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
+
+// The test will fail on deployment targets that do not support sized deallocation.
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
+// XFAIL: sanitizer-new-delete, ubsan
+
+// GCC doesn't support the aligned-allocation flags.
+// XFAIL: gcc
+
+// RUN: %build -faligned-allocation -fsized-deallocation
+// RUN: %run
+// RUN: %build -faligned-allocation -fno-sized-deallocation -DNO_SIZE
+// RUN: %run
+// RUN: %build -fno-aligned-allocation -fsized-deallocation -DNO_ALIGN
+// RUN: %run
+// RUN: %build -fno-aligned-allocation -fno-sized-deallocation -DNO_ALIGN -DNO_SIZE
+// RUN: %run
+
+#include <new>
+#include <typeinfo>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct alloc_stats {
+ alloc_stats() { reset(); }
+
+ int aligned_sized_called;
+ int aligned_called;
+ int sized_called;
+ int plain_called;
+ int last_size;
+ int last_align;
+
+ void reset() {
+ aligned_sized_called = aligned_called = sized_called = plain_called = 0;
+ last_align = last_size = -1;
+ }
+
+ bool expect_plain() const {
+ assert(aligned_sized_called == 0);
+ assert(aligned_called == 0);
+ assert(sized_called == 0);
+ assert(last_size == -1);
+ assert(last_align == -1);
+ return plain_called == 1;
+ }
+
+ bool expect_size(int n) const {
+ assert(plain_called == 0);
+ assert(aligned_sized_called == 0);
+ assert(aligned_called == 0);
+ assert(last_size == n);
+ assert(last_align == -1);
+ return sized_called == 1;
+ }
+
+ bool expect_align(int a) const {
+ assert(plain_called == 0);
+ assert(aligned_sized_called == 0);
+ assert(sized_called == 0);
+ assert(last_size == -1);
+ assert(last_align == a);
+ return aligned_called == 1;
+ }
+
+ bool expect_size_align(int n, int a) const {
+ assert(plain_called == 0);
+ assert(sized_called == 0);
+ assert(aligned_called == 0);
+ assert(last_size == n);
+ assert(last_align == a);
+ return aligned_sized_called == 1;
+ }
+};
+alloc_stats stats;
+
+void operator delete(void* p)TEST_NOEXCEPT {
+ ::free(p);
+ stats.plain_called++;
+ stats.last_size = stats.last_align = -1;
+}
+
+#ifndef NO_SIZE
+void operator delete(void* p, size_t n)TEST_NOEXCEPT {
+ ::free(p);
+ stats.sized_called++;
+ stats.last_size = n;
+ stats.last_align = -1;
+}
+#endif
+
+#ifndef NO_ALIGN
+void operator delete(void* p, std::align_val_t a)TEST_NOEXCEPT {
+ ::free(p);
+ stats.aligned_called++;
+ stats.last_align = static_cast<int>(a);
+ stats.last_size = -1;
+}
+
+void operator delete(void* p, size_t n, std::align_val_t a)TEST_NOEXCEPT {
+ ::free(p);
+ stats.aligned_sized_called++;
+ stats.last_align = static_cast<int>(a);
+ stats.last_size = n;
+}
+#endif
+
+void test_libcpp_dealloc() {
+ void* p = nullptr;
+ size_t over_align_val = TEST_ALIGNOF(std::max_align_t) * 2;
+ size_t under_align_val = TEST_ALIGNOF(int);
+ size_t with_size_val = 2;
+
+ {
+ std::__libcpp_deallocate_unsized(p, under_align_val);
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+
+#if defined(NO_SIZE) && defined(NO_ALIGN)
+ {
+ std::__libcpp_deallocate(p, with_size_val, over_align_val);
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+#elif defined(NO_SIZE)
+ {
+ std::__libcpp_deallocate(p, with_size_val, over_align_val);
+ assert(stats.expect_align(over_align_val));
+ }
+ stats.reset();
+#elif defined(NO_ALIGN)
+ {
+ std::__libcpp_deallocate(p, with_size_val, over_align_val);
+ assert(stats.expect_size(with_size_val));
+ }
+ stats.reset();
+#else
+ {
+ std::__libcpp_deallocate(p, with_size_val, over_align_val);
+ assert(stats.expect_size_align(with_size_val, over_align_val));
+ }
+ stats.reset();
+ {
+ std::__libcpp_deallocate_unsized(p, over_align_val);
+ assert(stats.expect_align(over_align_val));
+ }
+ stats.reset();
+ {
+ std::__libcpp_deallocate(p, with_size_val, under_align_val);
+ assert(stats.expect_size(with_size_val));
+ }
+ stats.reset();
+#endif
+}
+
+struct TEST_ALIGNAS(128) AlignedType {
+ AlignedType() : elem(0) {}
+ TEST_ALIGNAS(128) char elem;
+};
+
+void test_allocator_and_new_match() {
+ stats.reset();
+#if defined(NO_SIZE) && defined(NO_ALIGN)
+ {
+ int* x = new int(42);
+ delete x;
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+ {
+ AlignedType* a = new AlignedType();
+ delete a;
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+#elif defined(NO_SIZE)
+ stats.reset();
+#if TEST_STD_VER >= 11
+ {
+ int* x = new int(42);
+ delete x;
+ assert(stats.expect_plain());
+ }
+#endif
+ stats.reset();
+ {
+ AlignedType* a = new AlignedType();
+ delete a;
+ assert(stats.expect_align(TEST_ALIGNOF(AlignedType)));
+ }
+ stats.reset();
+#elif defined(NO_ALIGN)
+ stats.reset();
+ {
+ int* x = new int(42);
+ delete x;
+ assert(stats.expect_size(sizeof(int)));
+ }
+ stats.reset();
+ {
+ AlignedType* a = new AlignedType();
+ delete a;
+ assert(stats.expect_size(sizeof(AlignedType)));
+ }
+ stats.reset();
+#else
+ stats.reset();
+ {
+ int* x = new int(42);
+ delete x;
+ assert(stats.expect_size(sizeof(int)));
+ }
+ stats.reset();
+ {
+ AlignedType* a = new AlignedType();
+ delete a;
+ assert(stats.expect_size_align(sizeof(AlignedType),
+ TEST_ALIGNOF(AlignedType)));
+ }
+ stats.reset();
+#endif
+}
+
+int main() {
+ test_libcpp_dealloc();
+ test_allocator_and_new_match();
+}
diff --git a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
index 388fbebbd7b04..d7b4cca63aa1d 100644
--- a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
+++ b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// test libc++'s implementation of align_val_t, and the relevent new/delete
+// test libc++'s implementation of align_val_t, and the relevant new/delete
// overloads in all dialects when -faligned-allocation is present.
// Libc++ defers to the underlying MSVC library to provide the new/delete
@@ -16,12 +16,16 @@
// REQUIRES: -faligned-allocation
+// The dylibs shipped before macosx10.14 do not contain the aligned allocation
+// functions, so trying to force using those with -faligned-allocation results
+// in a link error.
+// XFAIL: with_system_cxx_lib=macosx10.13
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
// RUN: %build -faligned-allocation
// RUN: %run
diff --git a/test/libcxx/libcpp_alignof.pass.cpp b/test/libcxx/libcpp_alignof.pass.cpp
new file mode 100644
index 0000000000000..ba0df807e82dd
--- /dev/null
+++ b/test/libcxx/libcpp_alignof.pass.cpp
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that _LIBCPP_ALIGNOF acts the same as the C++11 keyword `alignof`, and
+// not as the GNU extension `__alignof`. The former returns the minimal required
+// alignment for a type, whereas the latter returns the preferred alignment.
+//
+// See llvm.org/PR39713
+
+#include <type_traits>
+#include "test_macros.h"
+
+template <class T>
+void test() {
+ static_assert(_LIBCPP_ALIGNOF(T) == std::alignment_of<T>::value, "");
+ static_assert(_LIBCPP_ALIGNOF(T) == TEST_ALIGNOF(T), "");
+#if TEST_STD_VER >= 11
+ static_assert(_LIBCPP_ALIGNOF(T) == alignof(T), "");
+#endif
+#ifdef TEST_COMPILER_CLANG
+ static_assert(_LIBCPP_ALIGNOF(T) == _Alignof(T), "");
+#endif
+}
+
+int main() {
+ test<int>();
+ test<long long>();
+ test<double>();
+ test<long double>();
+}
diff --git a/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp b/test/libcxx/memory/aligned_allocation_macro.pass.cpp
index c37d234331484..368076dee3ad8 100644
--- a/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
+++ b/test/libcxx/memory/aligned_allocation_macro.pass.cpp
@@ -7,31 +7,25 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// AppleClang <= 10 enables aligned allocation regardless of the deployment
+// target, so this test would fail.
+// UNSUPPORTED: apple-clang-9, apple-clang-10
+
+// XFAIL: availability=macosx10.13
// XFAIL: availability=macosx10.12
// XFAIL: availability=macosx10.11
// XFAIL: availability=macosx10.10
// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.7
// XFAIL: availability=macosx10.8
-
-// test bad_array_length
+// XFAIL: availability=macosx10.7
#include <new>
-#include <type_traits>
-#include <cassert>
-int main()
-{
- static_assert((std::is_base_of<std::bad_alloc, std::bad_array_length>::value),
- "std::is_base_of<std::bad_alloc, std::bad_array_length>::value");
- static_assert(std::is_polymorphic<std::bad_array_length>::value,
- "std::is_polymorphic<std::bad_array_length>::value");
- std::bad_array_length b;
- std::bad_array_length b2 = b;
- b2 = b;
- const char* w = b2.what();
- assert(w);
-}
+
+#ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+# error "libc++ should have aligned allocation in C++17 and up when targeting a platform that supports it"
+#endif
+
+int main() { }
diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp
index 087aa3645a50e..7b9202d952fb7 100644
--- a/test/libcxx/min_max_macros.sh.cpp
+++ b/test/libcxx/min_max_macros.sh.cpp
@@ -46,6 +46,8 @@ TEST_MACROS();
TEST_MACROS();
#include <cfloat>
TEST_MACROS();
+#include <charconv>
+TEST_MACROS();
#include <chrono>
TEST_MACROS();
#include <cinttypes>
@@ -239,8 +241,6 @@ TEST_MACROS();
TEST_MACROS();
#include <experimental/deque>
TEST_MACROS();
-#include <experimental/dynarray>
-TEST_MACROS();
#include <experimental/filesystem>
TEST_MACROS();
#include <experimental/forward_list>
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
index 6c2929d7f1d3a..09a6aa8a6343b 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
@@ -20,6 +20,7 @@
#include <cstdlib>
#include <exception>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -30,7 +31,7 @@ int main()
l1.erase(i);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
index d20fcd4623b7d..1ff02932bd98a 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
@@ -20,6 +20,7 @@
#include <cstdlib>
#include <exception>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -31,7 +32,7 @@ int main()
l1.erase(i);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
index 5015241ad63ea..46fa5bf434dd2 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
@@ -20,6 +20,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -30,7 +31,7 @@ int main()
std::string::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
index 6a23bf88ca5c0..3ccbfad70a6b4 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
@@ -20,6 +20,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -30,7 +31,7 @@ int main()
std::string::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
index a8443818aea5b..e493dfea9e059 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
@@ -20,6 +20,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -30,7 +31,7 @@ int main()
std::string::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
index 0549e816b44c8..918cffe733fd0 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
@@ -20,6 +20,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -29,7 +30,7 @@ int main()
std::string::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin());
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp
new file mode 100644
index 0000000000000..a3fa585e44ff5
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// __resize_default_init(size_type)
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+void write_c_str(char *buf, int size) {
+ for (int i=0; i < size; ++i) {
+ buf[i] = 'a';
+ }
+ buf[size] = '\0';
+}
+
+void test_buffer_usage()
+{
+ {
+ unsigned buff_size = 125;
+ unsigned used_size = buff_size - 16;
+ std::string s;
+ s.__resize_default_init(buff_size);
+ write_c_str(&s[0], used_size);
+ assert(s.size() == buff_size);
+ assert(strlen(s.data()) == used_size);
+ s.__resize_default_init(used_size);
+ assert(s.size() == used_size);
+ assert(s.data()[used_size] == '\0');
+ for (unsigned i=0; i < used_size; ++i) {
+ assert(s[i] == 'a');
+ }
+ }
+}
+
+void test_basic() {
+ {
+ std::string s;
+ s.__resize_default_init(3);
+ assert(s.size() == 3);
+ assert(s.data()[3] == '\0');
+ for (int i=0; i < 3; ++i)
+ s[i] = 'a' + i;
+ s.__resize_default_init(1);
+ assert(s[0] == 'a');
+ assert(s.data()[1] == '\0');
+ assert(s.size() == 1);
+ }
+}
+
+int main() {
+ test_basic();
+ test_buffer_usage();
+}
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
index 6024d9978433a..74a4657196e47 100644
--- a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
@@ -21,10 +21,20 @@
#include <mutex>
+#include "test_macros.h"
+
std::mutex m;
int foo __attribute__((guarded_by(m)));
+static void scoped() {
+#if TEST_STD_VER >= 17
+ std::scoped_lock<std::mutex> lock(m);
+ foo++;
+#endif
+}
+
int main() {
+ scoped();
std::lock_guard<std::mutex> lock(m);
foo++;
}
diff --git a/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
index b46c2cdec6cb8..3c0571bf9c223 100644
--- a/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
+++ b/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
@@ -57,7 +57,6 @@ int main()
typedef std::chrono::system_clock Clock;
typedef Clock::time_point time_point;
- typedef Clock::duration duration;
std::chrono::milliseconds ms(500);
time_point t0 = Clock::now();
std::this_thread::sleep_for(ms);
diff --git a/test/libcxx/utilities/optional/optional.object/triviality.abi.pass.cpp b/test/libcxx/utilities/optional/optional.object/triviality.abi.pass.cpp
new file mode 100644
index 0000000000000..cdfb027364bed
--- /dev/null
+++ b/test/libcxx/utilities/optional/optional.object/triviality.abi.pass.cpp
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// This test asserts the triviality of special member functions of optional<T>
+// whenever T has these special member functions trivial. The goal of this test
+// is to make sure that we do not change the triviality of those, since that
+// constitues an ABI break (small enough optionals would be passed by registers).
+//
+// constexpr optional(const optional& rhs);
+// constexpr optional(optional&& rhs) noexcept(see below);
+// constexpr optional<T>& operator=(const optional& rhs);
+// constexpr optional<T>& operator=(optional&& rhs) noexcept(see below);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "archetypes.hpp"
+
+template <class T>
+struct SpecialMemberTest {
+ using O = std::optional<T>;
+
+ static_assert(std::is_trivially_destructible_v<O> ==
+ std::is_trivially_destructible_v<T>,
+ "optional<T> is trivially destructible if and only if T is.");
+
+ static_assert(std::is_trivially_copy_constructible_v<O> ==
+ std::is_trivially_copy_constructible_v<T>,
+ "optional<T> is trivially copy constructible if and only if T is.");
+
+ static_assert(std::is_trivially_move_constructible_v<O> ==
+ std::is_trivially_move_constructible_v<T> ||
+ (!std::is_move_constructible_v<T> && std::is_trivially_copy_constructible_v<T>),
+ "optional<T> is trivially move constructible if T is trivially move constructible, "
+ "or if T is trivially copy constructible and is not move constructible.");
+
+ static_assert(std::is_trivially_copy_assignable_v<O> ==
+ (std::is_trivially_destructible_v<T> &&
+ std::is_trivially_copy_constructible_v<T> &&
+ std::is_trivially_copy_assignable_v<T>),
+ "optional<T> is trivially copy assignable if and only if T is trivially destructible, "
+ "trivially copy constructible, and trivially copy assignable.");
+
+ static_assert(std::is_trivially_move_assignable_v<O> ==
+ (std::is_trivially_destructible_v<T> &&
+ ((std::is_trivially_move_constructible_v<T> && std::is_trivially_move_assignable_v<T>) ||
+ ((!std::is_move_constructible_v<T> || !std::is_move_assignable_v<T>) &&
+ std::is_trivially_copy_constructible_v<T> && std::is_trivially_copy_assignable_v<T>))),
+ "optional<T> is trivially move assignable if T is trivially destructible, and either "
+ "(1) trivially move constructible and trivially move assignable, or "
+ "(2) not move constructible or not move assignable, and "
+ "trivially copy constructible and trivially copy assignable.");
+};
+
+template <class ...Args> static void sink(Args&&...) {}
+
+template <class ...TestTypes>
+struct DoTestsMetafunction {
+ DoTestsMetafunction() { sink(SpecialMemberTest<TestTypes>{}...); }
+};
+
+struct TrivialMoveNonTrivialCopy {
+ TrivialMoveNonTrivialCopy() = default;
+ TrivialMoveNonTrivialCopy(const TrivialMoveNonTrivialCopy&) {}
+ TrivialMoveNonTrivialCopy(TrivialMoveNonTrivialCopy&&) = default;
+ TrivialMoveNonTrivialCopy& operator=(const TrivialMoveNonTrivialCopy&) { return *this; }
+ TrivialMoveNonTrivialCopy& operator=(TrivialMoveNonTrivialCopy&&) = default;
+};
+
+struct TrivialCopyNonTrivialMove {
+ TrivialCopyNonTrivialMove() = default;
+ TrivialCopyNonTrivialMove(const TrivialCopyNonTrivialMove&) = default;
+ TrivialCopyNonTrivialMove(TrivialCopyNonTrivialMove&&) {}
+ TrivialCopyNonTrivialMove& operator=(const TrivialCopyNonTrivialMove&) = default;
+ TrivialCopyNonTrivialMove& operator=(TrivialCopyNonTrivialMove&&) { return *this; }
+};
+
+int main()
+{
+ sink(
+ ImplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ ExplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonLiteralTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonTrivialTypes::ApplyTypes<DoTestsMetafunction>{},
+ DoTestsMetafunction<TrivialMoveNonTrivialCopy, TrivialCopyNonTrivialMove>{}
+ );
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
new file mode 100644
index 0000000000000..6a3e613e9dcba
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template<class U, class V> pair(U&& x, V&& y);
+
+#include <utility>
+
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ExplicitNothrowT {
+ explicit ExplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+struct ImplicitNothrowT {
+ ImplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+int main() {
+ { // explicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>, int, int>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>, int, int>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>, int, int>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>, int, int>::value, "");
+ }
+ { // implicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>, int, int>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>, int, int>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>, int, int>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>, int, int>::value, "");
+ }
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp
new file mode 100644
index 0000000000000..6a2401223755b
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// pair(const T1& x, const T2& y);
+
+#include <utility>
+
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ constexpr ImplicitT(ImplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ExplicitNothrowT {
+ explicit ExplicitNothrowT(ExplicitNothrowT const&) noexcept {}
+};
+
+struct ImplicitNothrowT {
+ ImplicitNothrowT(ImplicitNothrowT const&) noexcept {}
+};
+
+int main() {
+ { // explicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>,
+ ExplicitT const&, ExplicitT const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>,
+ ExplicitNothrowT const&, ExplicitT const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>,
+ ExplicitT const&, ExplicitNothrowT const&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>,
+ ExplicitNothrowT const&, ExplicitNothrowT const&>::value, "");
+ }
+ { // implicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>,
+ ImplicitT const&, ImplicitT const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>,
+ ImplicitNothrowT const&, ImplicitT const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>,
+ ImplicitT const&, ImplicitNothrowT const&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>,
+ ImplicitNothrowT const&, ImplicitNothrowT const&>::value, "");
+ }
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
new file mode 100644
index 0000000000000..edb3bbf64afb0
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template <class U, class V> EXPLICIT constexpr pair(const pair<U, V>& p);
+
+#include <utility>
+
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ constexpr ImplicitT(ImplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ExplicitNothrowT {
+ explicit ExplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+struct ImplicitNothrowT {
+ ImplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+int main() {
+ { // explicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>,
+ std::pair<int, int> const&>::value, "");
+ }
+ { // implicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>,
+ std::pair<int, int> const&>::value, "");
+ }
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp
new file mode 100644
index 0000000000000..2dbf5511dd160
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// constexpr pair();
+
+#include <utility>
+#include <type_traits>
+
+
+struct ThrowingDefault {
+ ThrowingDefault() { }
+};
+
+struct NonThrowingDefault {
+ NonThrowingDefault() noexcept { }
+};
+
+int main() {
+
+ static_assert(!std::is_nothrow_default_constructible<std::pair<ThrowingDefault, ThrowingDefault>>::value, "");
+ static_assert(!std::is_nothrow_default_constructible<std::pair<NonThrowingDefault, ThrowingDefault>>::value, "");
+ static_assert(!std::is_nothrow_default_constructible<std::pair<ThrowingDefault, NonThrowingDefault>>::value, "");
+ static_assert( std::is_nothrow_default_constructible<std::pair<NonThrowingDefault, NonThrowingDefault>>::value, "");
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
index 8b5969d5198c0..58ea6ecde9923 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
@@ -30,6 +30,7 @@
#include <utility>
#include <type_traits>
#include <cstdlib>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -86,7 +87,7 @@ static_assert(!HasNonTrivialABI<Trivial>::value, "");
#endif
-int main()
+void test_trivial()
{
{
typedef std::pair<int, short> P;
@@ -150,3 +151,15 @@ int main()
}
#endif
}
+
+void test_layout() {
+ typedef std::pair<std::pair<char, char>, char> PairT;
+ static_assert(sizeof(PairT) == 3, "");
+ static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
+ static_assert(offsetof(PairT, first) == 0, "");
+}
+
+int main() {
+ test_trivial();
+ test_layout();
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
index 2a92240a63d22..8bfeeea5d2a6c 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
@@ -20,6 +20,6 @@ int main()
{
typedef std::pair<int, double> P;
std::tuple_element<2, P>::type foo; // expected-note {{requested here}}
- // expected-error@utility:* {{static_assert failed "Index out of bounds in std::tuple_element<std::pair<T1, T2>>"}}
+ // expected-error-re@utility:* {{static_assert failed{{( due to requirement '2U[L]{0,2} < 2')?}} "Index out of bounds in std::tuple_element<std::pair<T1, T2>>"}}
}
}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
new file mode 100644
index 0000000000000..81dad3bc2ffa1
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template <class... Args1, class... Args2>
+// pair(piecewise_construct_t, tuple<Args1...> first_args,
+// tuple<Args2...> second_args);
+
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "archetypes.hpp"
+
+
+int main() {
+ using NonThrowingConvert = NonThrowingTypes::ConvertingType;
+ using ThrowingConvert = NonTrivialTypes::ConvertingType;
+ static_assert(!std::is_nothrow_constructible<std::pair<ThrowingConvert, ThrowingConvert>,
+ std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<NonThrowingConvert, ThrowingConvert>,
+ std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ThrowingConvert, NonThrowingConvert>,
+ std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<NonThrowingConvert, NonThrowingConvert>,
+ std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
new file mode 100644
index 0000000000000..5d8d36262f17c
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template <class U, class V> pair(pair<U, V>&& p);
+
+#include <type_traits>
+#include <utility>
+
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ExplicitNothrowT {
+ explicit ExplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+struct ImplicitNothrowT {
+ ImplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+int main() {
+ { // explicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>,
+ std::pair<int, int>&&>::value, "");
+ }
+ { // implicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>,
+ std::pair<int, int>&&>::value, "");
+ }
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
index ec9cc7ec3e020..7346233887798 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
@@ -25,6 +25,7 @@
#include <utility>
#include <type_traits>
#include <cstdlib>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -81,7 +82,7 @@ static_assert(HasTrivialABI<Trivial>::value, "");
#endif
-int main()
+void test_trivial()
{
{
typedef std::pair<int, short> P;
@@ -145,3 +146,15 @@ int main()
}
#endif
}
+
+void test_layout() {
+ typedef std::pair<std::pair<char, char>, char> PairT;
+ static_assert(sizeof(PairT) == 3, "");
+ static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
+ static_assert(offsetof(PairT, first) == 0, "");
+}
+
+int main() {
+ test_trivial();
+ test_layout();
+}
diff --git a/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp b/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
index f39a445b98afd..c4522682c4b88 100644
--- a/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
+++ b/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
@@ -31,6 +31,6 @@ int main()
{
typedef std::variant<int, double> T;
std::variant_alternative<2, T>::type foo; // expected-note {{requested here}}
- // expected-error@variant:* {{static_assert failed "Index out of bounds in std::variant_alternative<>"}}
+ // expected-error-re@variant:* {{static_assert failed{{( due to requirement '2U[L]{0,2} < sizeof...\(_Types\)')?}} "Index out of bounds in std::variant_alternative<>"}}
}
}
diff --git a/test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp
index a836ef5169ef1..c309aaaaea180 100644
--- a/test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp
+++ b/test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp
@@ -24,7 +24,8 @@ struct make_variant_imp;
template <size_t ...Indices>
struct make_variant_imp<std::integer_sequence<size_t, Indices...>> {
- using type = std::variant<decltype((Indices, char(0)))...>;
+ template <size_t> using AlwaysChar = char;
+ using type = std::variant<AlwaysChar<Indices>...>;
};
template <size_t N>