summaryrefslogtreecommitdiff
path: root/test/std/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/utilities')
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.fail.cpp29
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.fail.cpp29
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp2
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp8
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp10
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp12
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp8
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp6
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp16
-rw-r--r--test/std/utilities/any/any.nonmembers/make_any.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/comparisons/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp18
-rw-r--r--test/std/utilities/function.objects/func.require/binary_function.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.require/unary_function.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp3
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp2
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp6
-rw-r--r--test/std/utilities/function.objects/logical.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/weak_result.pass.cpp27
-rw-r--r--test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp6
-rw-r--r--test/std/utilities/function.objects/unord.hash/pointer.pass.cpp2
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.fail.cpp51
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp10
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp18
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp8
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp12
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp8
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/incomplete_type_helper.h14
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp7
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp7
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp2
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp28
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp2
-rw-r--r--test/std/utilities/memory/pointer.conversion/to_address.pass.cpp120
-rw-r--r--test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp2
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp34
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.special/io.pass.cpp32
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp7
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp (renamed from test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp)22
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp29
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp32
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp3
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.rel/is_callable.pass.cpp160
-rw-r--r--test/std/utilities/meta/meta.rel/is_invocable.pass.cpp166
-rw-r--r--test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp115
-rw-r--r--test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp121
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.fail.cpp23
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp52
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp38
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp20
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp10
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp10
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp10
-rw-r--r--test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp25
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp10
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp12
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp12
-rw-r--r--test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp1
-rw-r--r--test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp2
-rw-r--r--test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp4
-rw-r--r--test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp9
-rw-r--r--test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp8
-rw-r--r--test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp4
-rw-r--r--test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp4
-rw-r--r--test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp4
-rw-r--r--test/std/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.general/ignore.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp1
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp7
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp9
-rw-r--r--test/std/utilities/utility/as_const/as_const.fail.cpp2
-rw-r--r--test/std/utilities/utility/as_const/as_const.pass.cpp12
-rw-r--r--test/std/utilities/utility/forward/forward.fail.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp80
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp2
-rw-r--r--test/std/utilities/utility/synopsis.pass.cpp1
-rw-r--r--test/std/utilities/variant/variant.get/get_index.pass.cpp2
-rw-r--r--test/std/utilities/variant/variant.get/get_type.pass.cpp2
-rw-r--r--test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp2
-rw-r--r--test/std/utilities/variant/variant.visit/visit.pass.cpp2
107 files changed, 1183 insertions, 500 deletions
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.fail.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.fail.cpp
new file mode 100644
index 000000000000..c5244a0d1bbd
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+// <memory>
+
+// template <class OuterAlloc, class... InnerAllocs>
+// class scoped_allocator_adaptor
+
+// pointer allocate(size_type n);
+
+#include <scoped_allocator>
+#include <cassert>
+
+#include "allocators.h"
+
+int main()
+{
+ std::scoped_allocator_adaptor<A1<int>> a;
+ a.allocate(10); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.fail.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.fail.cpp
new file mode 100644
index 000000000000..622147c9cf21
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+// <memory>
+
+// template <class OuterAlloc, class... InnerAllocs>
+// class scoped_allocator_adaptor
+
+// pointer allocate(size_type n, const_void_pointer hint);
+
+#include <scoped_allocator>
+#include <cassert>
+
+#include "allocators.h"
+
+int main()
+{
+ std::scoped_allocator_adaptor<A1<int>> a;
+ a.allocate(10, (const void*)0); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
index 8568c7380b6d..71421464df2b 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
@@ -26,7 +26,7 @@
#include "uses_alloc_types.hpp"
#include "controlled_allocators.hpp"
-// — If uses_allocator_v<T, inner_allocator_type> is false and
+// - If uses_allocator_v<T, inner_allocator_type> is false and
// is_constructible_v<T, Args...> is true, calls
// OUTERMOST_ALLOC_TRAITS(*this)::construct(
// OUTERMOST (*this), p, std::forward<Args>(args)...).
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp
index f8a9ea0f9eca..44e8709a8e30 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp
@@ -26,12 +26,12 @@ int main()
{
// sanity checks
static_assert( (std::is_same<
- std::allocator_traits<A1<int>>::is_always_equal, std::false_type>::value
- ), "" );
+ std::allocator_traits<A1<int>>::is_always_equal, std::false_type>::value
+ ), "" );
static_assert( (std::is_same<
- std::allocator_traits<min_allocator<int>>::is_always_equal, std::true_type>::value
- ), "" );
+ std::allocator_traits<min_allocator<int>>::is_always_equal, std::true_type>::value
+ ), "" );
// wrapping one allocator
static_assert(
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
index ed04a91ca406..419fd1a40cf8 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -80,7 +80,7 @@ void checkThrows(any& a)
{
#if !defined(TEST_HAS_NO_EXCEPTIONS)
try {
- any_cast<Type>(a);
+ TEST_IGNORE_NODISCARD any_cast<Type>(a);
assert(false);
} catch (bad_any_cast const &) {
// do nothing
@@ -89,7 +89,7 @@ void checkThrows(any& a)
}
try {
- any_cast<ConstT>(static_cast<any const&>(a));
+ TEST_IGNORE_NODISCARD any_cast<ConstT>(static_cast<any const&>(a));
assert(false);
} catch (bad_any_cast const &) {
// do nothing
@@ -103,7 +103,7 @@ void checkThrows(any& a)
typename std::remove_reference<Type>::type&&,
Type
>::type;
- any_cast<RefType>(static_cast<any&&>(a));
+ TEST_IGNORE_NODISCARD any_cast<RefType>(static_cast<any&&>(a));
assert(false);
} catch (bad_any_cast const &) {
// do nothing
@@ -111,13 +111,13 @@ void checkThrows(any& a)
assert(false);
}
#else
- ((void)a);
+ (TEST_IGNORE_NODISCARD a);
#endif
}
void test_cast_empty() {
// None of these operations should allocate.
- DisableAllocationGuard g; ((void)g);
+ DisableAllocationGuard g; (TEST_IGNORE_NODISCARD g);
any a;
checkThrows<int>(a);
}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
index 07578a28e82f..9638521260a9 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
@@ -25,12 +25,12 @@ using std::any_cast;
void test_const_lvalue_cast_request_non_const_lvalue()
{
const any a;
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
any_cast<TestType &>(a); // expected-note {{requested here}}
const any a2(42);
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{binding value of type 'const int' to reference to type 'int' drops 'const' qualifier}}
any_cast<int&>(a2); // expected-note {{requested here}}
}
@@ -38,22 +38,22 @@ void test_const_lvalue_cast_request_non_const_lvalue()
void test_lvalue_any_cast_request_rvalue()
{
any a;
- // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
any_cast<TestType &&>(a); // expected-note {{requested here}}
any a2(42);
- // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
any_cast<int&&>(a2); // expected-note {{requested here}}
}
void test_rvalue_any_cast_request_lvalue()
{
any a;
- // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{non-const lvalue reference to type 'TestType' cannot bind to a temporary}}
any_cast<TestType &>(std::move(a)); // expected-note {{requested here}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{non-const lvalue reference to type 'int' cannot bind to a temporary}}
any_cast<int&>(42);
}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
index 3f6955a8cbce..bad229dac886 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
@@ -29,18 +29,18 @@ int main()
any a;
// expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType &>(static_cast<any const&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{cannot cast from lvalue of type 'const TestType' to rvalue reference type 'TestType &&'; types are not compatible}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType &&>(static_cast<any const&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{binding value of type 'const TestType2' to reference to type 'TestType2' drops 'const' qualifier}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType2 &>(static_cast<any const&&>(a)); // expected-note {{requested here}}
// expected-error@any:* {{cannot cast from lvalue of type 'const TestType2' to rvalue reference type 'TestType2 &&'; types are not compatible}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
any_cast<TestType2 &&>(static_cast<any const&&>(a)); // expected-note {{requested here}}
}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
index ed4b96d644d2..2d18cf4ba090 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
@@ -42,17 +42,17 @@ struct no_move {
int main() {
any a;
- // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{static_cast from 'no_copy' to 'no_copy' uses deleted function}}
any_cast<no_copy>(static_cast<any&>(a)); // expected-note {{requested here}}
- // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{static_cast from 'const no_copy' to 'no_copy' uses deleted function}}
any_cast<no_copy>(static_cast<any const&>(a)); // expected-note {{requested here}}
any_cast<no_copy>(static_cast<any &&>(a)); // OK
- // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+ // expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
// expected-error@any:* {{static_cast from 'typename remove_reference<no_move &>::type' (aka 'no_move') to 'no_move' uses deleted function}}
any_cast<no_move>(static_cast<any &&>(a));
}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp
index bbc135051ef8..204c5c0d6af9 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp
@@ -26,29 +26,29 @@ int main()
{
any a(1);
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &>(&a); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &&>(&a); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &>(&a); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const&&>(&a); // expected-note {{requested here}}
any const& a2 = a;
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &>(&a2); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int &&>(&a2); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &>(&a2); // expected-note {{requested here}}
- // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ // expected-error-re@any:* 1 {{static_assert failed{{.*}} "_ValueType may not be a reference."}}
any_cast<int const &&>(&a2); // expected-note {{requested here}}
}
diff --git a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
index 5a4a3c3c189f..9850851fc6ed 100644
--- a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
+++ b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
@@ -115,14 +115,14 @@ void test_make_any_throws()
{
{
try {
- std::make_any<Type>(101);
+ TEST_IGNORE_NODISCARD std::make_any<Type>(101);
assert(false);
} catch (int const&) {
}
}
{
try {
- std::make_any<Type>({1, 2, 3}, 101);
+ TEST_IGNORE_NODISCARD std::make_any<Type>({1, 2, 3}, 101);
assert(false);
} catch (int const&) {
}
diff --git a/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
index b85f439ba7a0..fce826f4215d 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp
@@ -11,15 +11,15 @@
#include <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(0)) == 1;
};
diff --git a/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp b/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp
index db7168c44f8b..bcd353eba1e2 100644
--- a/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp
@@ -11,15 +11,15 @@
#include <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(0)) == 1;
};
diff --git a/test/std/utilities/function.objects/comparisons/transparent.pass.cpp b/test/std/utilities/function.objects/comparisons/transparent.pass.cpp
index f353fe7a72a6..ebae262b2423 100644
--- a/test/std/utilities/function.objects/comparisons/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/comparisons/transparent.pass.cpp
@@ -11,15 +11,15 @@
#include <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(0)) == 1;
};
diff --git a/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp b/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp
index aaac98474fcb..9c3f24262ef0 100644
--- a/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp
+++ b/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp
@@ -36,4 +36,4 @@ int main() {
#if defined(__cpp_lib_invoke)
assert(std::invoke(foo, 101) == 42);
#endif
-} \ No newline at end of file
+}
diff --git a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
index aa8eb3916db9..7601ff9d147d 100644
--- a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
+++ b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
@@ -438,26 +438,26 @@ void throws_in_constructor_test()
void call_operator_sfinae_test() {
{ // wrong number of arguments
using T = decltype(std::not_fn(returns_true));
- static_assert(std::is_callable<T()>::value, ""); // callable only with no args
- static_assert(!std::is_callable<T(bool)>::value, "");
+ static_assert(std::is_invocable<T>::value, ""); // callable only with no args
+ static_assert(!std::is_invocable<T, bool>::value, "");
}
{ // violates const correctness (member function pointer)
using T = decltype(std::not_fn(&MemFunCallable::return_value_nc));
- static_assert(std::is_callable<T(MemFunCallable&)>::value, "");
- static_assert(!std::is_callable<T(const MemFunCallable&)>::value, "");
+ static_assert(std::is_invocable<T, MemFunCallable&>::value, "");
+ static_assert(!std::is_invocable<T, const MemFunCallable&>::value, "");
}
{ // violates const correctness (call object)
using Obj = CopyCallable<bool>;
using NCT = decltype(std::not_fn(Obj{true}));
using CT = const NCT;
- static_assert(std::is_callable<NCT()>::value, "");
- static_assert(!std::is_callable<CT()>::value, "");
+ static_assert(std::is_invocable<NCT>::value, "");
+ static_assert(!std::is_invocable<CT>::value, "");
}
{ // returns bad type with no operator!
auto fn = [](auto x) { return x; };
using T = decltype(std::not_fn(fn));
- static_assert(std::is_callable<T(bool)>::value, "");
- static_assert(!std::is_callable<T(std::string)>::value, "");
+ static_assert(std::is_invocable<T, bool>::value, "");
+ static_assert(!std::is_invocable<T, std::string>::value, "");
}
}
@@ -587,7 +587,7 @@ void call_operator_noexcept_test()
}
void test_lwg2767() {
- // See http://wg21.link/LWG2767
+ // See https://cplusplus.github.io/LWG/lwg-defects.html#2767
struct Abstract { virtual void f() const = 0; };
struct Derived : public Abstract { void f() const {} };
struct F { bool operator()(Abstract&&) { return false; } };
diff --git a/test/std/utilities/function.objects/func.require/binary_function.pass.cpp b/test/std/utilities/function.objects/func.require/binary_function.pass.cpp
index fa7afb2e7b9c..93463190374e 100644
--- a/test/std/utilities/function.objects/func.require/binary_function.pass.cpp
+++ b/test/std/utilities/function.objects/func.require/binary_function.pass.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES: c++98 || c++03 || c++11 || c++14
+// binary_function was removed in C++17
// binary_function
diff --git a/test/std/utilities/function.objects/func.require/unary_function.pass.cpp b/test/std/utilities/function.objects/func.require/unary_function.pass.cpp
index f14b2d3a2ce5..40a9d480b183 100644
--- a/test/std/utilities/function.objects/func.require/unary_function.pass.cpp
+++ b/test/std/utilities/function.objects/func.require/unary_function.pass.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES: c++98 || c++03 || c++11 || c++14
+// unary_function was removed in C++17
// unary_function
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp
index 812f6fc502d9..7d3a5dec4ef6 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
-// REQUIRES: c++11 || c++14
// <functional>
@@ -25,5 +24,7 @@ struct S : public std::function<void()> { using function::function; };
int main() {
S s( [](){} );
S f1( s );
+#if TEST_STD_VER <= 14
S f2(std::allocator_arg, std::allocator<int>{}, s);
+#endif
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp
index 24f7fceb877b..b23153465168 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp
@@ -25,5 +25,5 @@ void foo(int) {}
int main()
{
- std::function<void(int)> f(std::allocator_arg, std::allocator<int>(), foo);
+ std::function<void(int)> f(std::allocator_arg, std::allocator<int>(), foo);
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
index 4c1a1ca95ff4..8a2a12e0f789 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
// <functional>
-// REQUIRES: c++98 || c++03 || c++11 ||c++14
+// REQUIRES: c++98 || c++03 || c++11 || c++14
// class function<R(ArgTypes...)>
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp
index 9967457ff821..2e4633b11693 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp
@@ -24,7 +24,7 @@
int main()
{
- typedef std::function<void(int)> F;
- F f1;
- F f2(std::allocator_arg, std::allocator<int>(), f1);
+ typedef std::function<void(int)> F;
+ F f1;
+ F f2(std::allocator_arg, std::allocator<int>(), f1);
}
diff --git a/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp b/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp
index 00e513ec546f..d64c02f97cd4 100644
--- a/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp
+++ b/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp
@@ -11,15 +11,15 @@
#include <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(0)) == 1;
};
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
index df0b55a5d060..fede2538a851 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
@@ -17,7 +17,6 @@
#include <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
index 122716a23a8b..ba3c71e48260 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
@@ -17,7 +17,6 @@
#include <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
index 721a442d4431..d9f05b4e57a9 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
@@ -17,7 +17,6 @@
#include <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
index 564a3f77433c..d0dabd2643e5 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
@@ -17,7 +17,6 @@
#include <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
diff --git a/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp b/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp
index 609094dae406..7ce4c846e923 100644
--- a/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp
@@ -16,27 +16,42 @@
#include <functional>
#include <type_traits>
+template <class Arg, class Result>
+struct my_unary_function
+{ // std::unary_function was removed in C++17
+ typedef Arg argument_type;
+ typedef Result result_type;
+};
+
+template <class Arg1, class Arg2, class Result>
+struct my_binary_function
+{ // std::binary_function was removed in C++17
+ typedef Arg1 first_argument_type;
+ typedef Arg2 second_argument_type;
+ typedef Result result_type;
+};
+
class functor1
- : public std::unary_function<int, char>
+ : public my_unary_function<int, char>
{
};
class functor2
- : public std::binary_function<char, int, double>
+ : public my_binary_function<char, int, double>
{
};
class functor3
- : public std::unary_function<char, int>,
- public std::binary_function<char, int, double>
+ : public my_unary_function<char, int>,
+ public my_binary_function<char, int, double>
{
public:
typedef float result_type;
};
class functor4
- : public std::unary_function<char, int>,
- public std::binary_function<char, int, double>
+ : public my_unary_function<char, int>,
+ public my_binary_function<char, int, double>
{
public:
};
diff --git a/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp b/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
index ed173f280d05..7b427b9ac1e4 100644
--- a/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
@@ -13,7 +13,7 @@
// Hashing a struct w/o a defined hash should *not* fail, but it should
// create a type that is not constructible and not callable.
-// See also: http://cplusplus.github.io/LWG/lwg-active.html#2543
+// See also: https://cplusplus.github.io/LWG/lwg-defects.html#2543
#include <functional>
#include <cassert>
@@ -32,7 +32,7 @@ int main()
static_assert(!std::is_copy_assignable<H>::value, "");
static_assert(!std::is_move_assignable<H>::value, "");
#if TEST_STD_VER > 14
- static_assert(!std::is_callable<H(X&)>::value, "");
- static_assert(!std::is_callable<H(X const&)>::value, "");
+ static_assert(!std::is_invocable<H, X&>::value, "");
+ static_assert(!std::is_invocable<H, X const&>::value, "");
#endif
}
diff --git a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
index 36280a38e0a7..f1c56aed78b8 100644
--- a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
@@ -41,7 +41,7 @@ test()
assert(h(&i) != h(&j));
}
-// can't hash nullptr_t until c++17
+// can't hash nullptr_t until C++17
void test_nullptr()
{
#if TEST_STD_VER > 14
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.fail.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.fail.cpp
new file mode 100644
index 000000000000..71201f0ef0d9
--- /dev/null
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.fail.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+// static pointer allocate(allocator_type& a, size_type n);
+// ...
+// };
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <memory>
+#include <cstdint>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T>
+struct A
+{
+ typedef T value_type;
+
+ value_type* allocate(std::size_t n)
+ {
+ assert(n == 12);
+ return reinterpret_cast<value_type*>(static_cast<std::uintptr_t>(0xEEADBEEF));
+ }
+ value_type* allocate(std::size_t n, const void* p)
+ {
+ assert(n == 11);
+ assert(p == 0);
+ return reinterpret_cast<value_type*>(static_cast<std::uintptr_t>(0xFEADBEEF));
+ }
+};
+
+int main()
+{
+ A<int> a;
+ std::allocator_traits<A<int> >::allocate(a, 10); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::allocator_traits<A<int> >::allocate(a, 10, nullptr); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
index ab8179c5ab4d..292d68de9786 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
@@ -20,6 +20,8 @@
#include <cstdint>
#include <cassert>
+#include "incomplete_type_helper.h"
+
template <class T>
struct A
{
@@ -34,6 +36,14 @@ struct A
int main()
{
+ {
A<int> a;
assert(std::allocator_traits<A<int> >::allocate(a, 10) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
+ }
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ assert(std::allocator_traits<Alloc >::allocate(a, 10) == reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
+ }
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
index 808284261f7d..90a9154e1840 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -52,12 +53,29 @@ struct B
}
};
+
int main()
{
#if TEST_STD_VER >= 11
+ {
A<int> a;
assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
+ }
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ assert(std::allocator_traits<Alloc >::allocate(a, 10, nullptr) == reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
+ }
#endif
+ {
B<int> b;
assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xFEADBEEF)));
+ }
+ {
+ typedef IncompleteHolder* VT;
+ typedef B<VT> Alloc;
+ Alloc b;
+ assert(std::allocator_traits<Alloc >::allocate(b, 11, nullptr) == reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xFEADBEEF)));
+ }
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
index 46075f62c6c1..e4aceffdd6b6 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
@@ -23,6 +23,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -107,6 +108,13 @@ int main()
std::allocator_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5);
assert(A2::count == 1);
}
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ std::aligned_storage<sizeof(VT)>::type store;
+ std::allocator_traits<Alloc>::construct(a, (VT*)&store, nullptr);
+ }
#if TEST_STD_VER >= 11
{
A0::count = 0;
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
index 8176d8b3767a..ecb67adb58e9 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
@@ -20,6 +20,8 @@
#include <cstdint>
#include <cassert>
+#include "incomplete_type_helper.h"
+
int called = 0;
template <class T>
@@ -37,7 +39,17 @@ struct A
int main()
{
+ {
A<int> a;
std::allocator_traits<A<int> >::deallocate(a, reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF)), 10);
assert(called == 1);
+ }
+ called = 0;
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ std::allocator_traits<Alloc >::deallocate(a, reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xDEADBEEF)), 10);
+ assert(called == 1);
+ }
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
index 2ee64b8b4a07..1a812876bf0c 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
@@ -23,6 +23,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -65,6 +66,13 @@ int main()
std::allocator_traits<A<int> >::destroy(a, (A0*)&a0);
assert(A0::count == 1);
}
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ std::aligned_storage<sizeof(VT)>::type store;
+ std::allocator_traits<Alloc>::destroy(a, (VT*)&store);
+ }
#if TEST_STD_VER >= 11
{
A0::count = 0;
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/incomplete_type_helper.h b/test/std/utilities/memory/allocator.traits/allocator.traits.members/incomplete_type_helper.h
new file mode 100644
index 000000000000..7662338d73c4
--- /dev/null
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/incomplete_type_helper.h
@@ -0,0 +1,14 @@
+#ifndef TEST_INCOMPLETE_TYPE_HELPER_H
+#define TEST_INCOMPLETE_TYPE_HELPER_H
+
+#include "min_allocator.h"
+
+namespace NS {
+ struct Incomplete;
+}
+
+template <class T> struct Holder { T value; };
+
+typedef Holder<NS::Incomplete> IncompleteHolder;
+
+#endif
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
index d2c9a9826e14..12c0d02227fa 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
@@ -22,6 +22,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -51,6 +52,12 @@ int main()
const B<int> b = {};
assert(std::allocator_traits<B<int> >::max_size(b) == 100);
}
+ {
+ typedef IncompleteHolder* VT;
+ typedef B<VT> Alloc;
+ Alloc a;
+ assert(std::allocator_traits<Alloc >::max_size(a) == 100);
+ }
#if TEST_STD_VER >= 11
{
A<int> a;
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
index 2e9703037894..8355db18276a 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
@@ -23,6 +23,7 @@
#include <cassert>
#include "test_macros.h"
+#include "incomplete_type_helper.h"
template <class T>
struct A
@@ -57,6 +58,12 @@ int main()
const A<int> a(0);
assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0);
}
+ {
+ typedef IncompleteHolder* VT;
+ typedef A<VT> Alloc;
+ Alloc a;
+ assert(std::allocator_traits<Alloc>::select_on_container_copy_construction(a).id == 0);
+ }
#if TEST_STD_VER >= 11
{
B<int> b;
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
index 31a0f171d33d..7f7b155c35c8 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
@@ -37,7 +37,7 @@ template <class T>
struct C
{
typedef T value_type;
- int not_empty_; // some random member variable
+ int not_empty_; // some random member variable
};
int main()
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp
new file mode 100644
index 000000000000..490309eddd6e
--- /dev/null
+++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ std::allocator<int> a;
+ a.allocate(3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ a.allocate(3, nullptr); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
index 768d41878437..34cbb8dc5377 100644
--- a/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
+++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
@@ -23,7 +23,7 @@ void test_max(size_t count)
{
std::allocator<T> a;
try {
- a.allocate(count);
+ TEST_IGNORE_NODISCARD a.allocate(count);
assert(false);
} catch (const std::exception &) {
}
diff --git a/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp b/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
new file mode 100644
index 000000000000..64a5c73affe1
--- /dev/null
+++ b/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
@@ -0,0 +1,120 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// template <class T> constexpr T* to_address(T* p) noexcept;
+// template <class Ptr> auto to_address(const Ptr& p) noexcept;
+
+#include <memory>
+#include <cassert>
+#include "test_macros.h"
+
+class P1
+{
+public:
+ using element_type = int;
+
+ explicit P1(int* p)
+ : p_(p) { }
+
+ int* operator->() const noexcept
+ { return p_; }
+
+private:
+ int* p_;
+};
+
+class P2
+{
+public:
+ using element_type = int;
+
+ explicit P2(int* p)
+ : p_(p) { }
+
+ P1 operator->() const noexcept
+ { return p_; }
+
+private:
+ P1 p_;
+};
+
+class P3
+{
+public:
+ explicit P3(int* p)
+ : p_(p) { }
+
+ int* get() const noexcept
+ { return p_; }
+
+private:
+ int* p_;
+};
+
+namespace std
+{
+template<>
+struct pointer_traits<::P3>
+{
+ static int* to_address(const ::P3& p) noexcept
+ { return p.get(); }
+};
+}
+
+class P4
+{
+public:
+ explicit P4(int* p)
+ : p_(p) { }
+
+ int* operator->() const noexcept
+ { return nullptr; }
+
+ int* get() const noexcept
+ { return p_; }
+
+private:
+ int* p_;
+};
+
+namespace std
+{
+template<>
+struct pointer_traits<::P4>
+{
+ static int* to_address(const ::P4& p) noexcept
+ { return p.get(); }
+};
+}
+
+int n = 0;
+static_assert(std::to_address(&n) == &n);
+
+int main()
+{
+ int i = 0;
+ ASSERT_NOEXCEPT(std::to_address(&i));
+ assert(std::to_address(&i) == &i);
+ P1 p1(&i);
+ ASSERT_NOEXCEPT(std::to_address(p1));
+ assert(std::to_address(p1) == &i);
+ P2 p2(&i);
+ ASSERT_NOEXCEPT(std::to_address(p2));
+ assert(std::to_address(p2) == &i);
+ P3 p3(&i);
+ ASSERT_NOEXCEPT(std::to_address(p3));
+ assert(std::to_address(p3) == &i);
+ P4 p4(&i);
+ ASSERT_NOEXCEPT(std::to_address(p4));
+ assert(std::to_address(p4) == &i);
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp
index 81f49eaac39b..3ff32df11338 100644
--- a/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp
@@ -19,7 +19,7 @@
int main()
{
#if TEST_STD_VER > 14
- const int *p = std::addressof<const int>(0);
+ const int *p = std::addressof<const int>(0);
#else
#error
#endif
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
index ad6a51500e36..319df229668f 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
@@ -112,4 +112,4 @@ int main()
{
test_counted();
test_value_initialized();
-} \ No newline at end of file
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
index 1829dff354d3..2f387a4cef97 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
@@ -71,7 +71,7 @@ int main()
std::uninitialized_copy(b, b+2, bp);
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
- assert(B::population_ == N + 2);
+ assert(B::population_ == N + 2);
}
{
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
index 6c535250fd1f..d914129f2a4a 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
@@ -111,4 +111,4 @@ void test_counted()
int main() {
test_counted();
test_ctor_throws();
-} \ No newline at end of file
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
index 4175c6bce688..4083bc367cf2 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
@@ -114,4 +114,4 @@ int main()
{
test_counted();
test_ctor_throws();
-} \ No newline at end of file
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp
new file mode 100644
index 000000000000..48c90f7b9661
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// Because we don't have a functioning decltype in C++03
+
+// <memory>
+
+// unique_ptr
+
+// template<class CharT, class Traits, class Y, class D>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os, const unique_ptr<Y, D>& p);
+
+// -?- Remarks: This function shall not participate in overload resolution unless os << p.get() is a valid expression.
+
+#include <memory>
+#include <sstream>
+#include <cassert>
+
+class A {};
+
+int main()
+{
+ std::unique_ptr<A> p(new A);
+ std::ostringstream os;
+ os << p;
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.pass.cpp
new file mode 100644
index 000000000000..1166a01e8198
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// Because we don't have a functioning decltype in C++03
+
+// <memory>
+
+// unique_ptr
+
+// template<class CharT, class Traits, class Y, class D>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os, const unique_ptr<Y, D>& p);
+
+#include <memory>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ std::unique_ptr<int> p(new int(3));
+ std::ostringstream os;
+ assert(os.str().empty());
+ os << p;
+ assert(!os.str().empty());
+}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
index eb0d0a955fc5..8bd8993e5bec 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
@@ -41,7 +41,7 @@ void nullDeleter(void*) {}
struct Foo : virtual public std::enable_shared_from_this<Foo>
{
- virtual ~Foo() {}
+ virtual ~Foo() {}
};
struct Bar : public Foo {
@@ -80,12 +80,11 @@ int main()
}
{
typedef std::shared_ptr<PrivateBase> APtr;
- typedef std::weak_ptr<PrivateBase> WeakAPtr;
APtr a1 = std::make_shared<PrivateBase>();
assert(a1.use_count() == 1);
}
// Test LWG issue 2529. Only reset '__weak_ptr_' when it's already expired.
- // http://cplusplus.github.io/LWG/lwg-active.html#2529.
+ // https://cplusplus.github.io/LWG/lwg-defects.html#2529
// Test two different ways:
// * Using 'weak_from_this().expired()' in C++17.
// * Using 'shared_from_this()' in all dialects.
@@ -135,7 +134,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try {
- ptr->shared_from_this();
+ TEST_IGNORE_NODISCARD ptr->shared_from_this();
assert(false);
} catch (std::bad_weak_ptr const&) {
} catch (...) { assert(false); }
diff --git a/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp
index 86da5054a708..7f304054bda0 100644
--- a/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp
@@ -7,19 +7,23 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-// <optional>
+// <memory>
-// struct nullopt_t{see below};
+// shared_ptr
-#include <optional>
+// template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);
-using std::optional;
-using std::nullopt_t;
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct S {
+private:
+ S () {}; // ctor is private
+};
int main()
{
- // I roughly interpret LWG2736 as "it shall not be possible to copy-list-initialize nullopt_t with an
- // empty braced-init-list."
- nullopt_t foo = {};
+ std::shared_ptr<S> p = std::make_shared<S>();
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp
new file mode 100644
index 000000000000..0eeeed4e88c9
--- /dev/null
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// shared_ptr
+
+// template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct S {
+protected:
+ S () {}; // ctor is protected
+};
+
+int main()
+{
+ std::shared_ptr<S> p = std::make_shared<S>(); // expected-error-re@memory:* {{static_assert failed{{.*}} "Can't construct object in make_shared"}}
+}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
index 501844a1d6ce..b7ea8d4dc6d3 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
@@ -74,14 +74,14 @@ int main()
assert(!cs(p2, p1));
assert(cs(p1 ,p3) || cs(p3, p1));
assert(cs(p3, p1) == cs(p3, p2));
- ASSERT_NOEXCEPT(cs(p1, p1));
+ ASSERT_NOEXCEPT(cs(p1, p1));
assert(!cs(p1, w2));
assert(!cs(p2, w1));
assert(cs(p1, w3) || cs(p3, w1));
assert(cs(p3, w1) == cs(p3, w2));
- ASSERT_NOEXCEPT(cs(p1, w1));
- ASSERT_NOEXCEPT(cs(w1, p1));
+ ASSERT_NOEXCEPT(cs(p1, w1));
+ ASSERT_NOEXCEPT(cs(w1, p1));
}
{
typedef std::owner_less<std::weak_ptr<int> > CS;
@@ -95,14 +95,14 @@ int main()
assert(!cs(w2, w1));
assert(cs(w1, w3) || cs(w3, w1));
assert(cs(w3, w1) == cs(w3, w2));
- ASSERT_NOEXCEPT(cs(w1, w1));
+ ASSERT_NOEXCEPT(cs(w1, w1));
assert(!cs(w1, p2));
assert(!cs(w2, p1));
assert(cs(w1, p3) || cs(w3, p1));
assert(cs(w3, p1) == cs(w3, p2));
- ASSERT_NOEXCEPT(cs(w1, p1));
- ASSERT_NOEXCEPT(cs(p1, w1));
+ ASSERT_NOEXCEPT(cs(w1, p1));
+ ASSERT_NOEXCEPT(cs(p1, w1));
}
#if TEST_STD_VER > 14
{
@@ -112,21 +112,21 @@ int main()
std::weak_ptr<int> wp1;
std::owner_less<> cmp;
- cmp(sp1, sp2);
- cmp(sp1, wp1);
- cmp(sp1, sp3);
- cmp(wp1, sp1);
- cmp(wp1, wp1);
- ASSERT_NOEXCEPT(cmp(sp1, sp1));
- ASSERT_NOEXCEPT(cmp(sp1, wp1));
- ASSERT_NOEXCEPT(cmp(wp1, sp1));
- ASSERT_NOEXCEPT(cmp(wp1, wp1));
+ assert(!cmp(sp1, sp2));
+ assert(!cmp(sp1, wp1));
+ assert(!cmp(sp1, sp3));
+ assert(!cmp(wp1, sp1));
+ assert(!cmp(wp1, wp1));
+ ASSERT_NOEXCEPT(cmp(sp1, sp1));
+ ASSERT_NOEXCEPT(cmp(sp1, wp1));
+ ASSERT_NOEXCEPT(cmp(wp1, sp1));
+ ASSERT_NOEXCEPT(cmp(wp1, wp1));
}
{
// test heterogeneous lookups
std::set<std::shared_ptr<X>, std::owner_less<>> s;
std::shared_ptr<void> vp;
- s.find(vp);
+ assert(s.find(vp) == s.end());
}
#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
index 458f8a11ed12..23df0d8e68ed 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
@@ -29,6 +29,5 @@ int main()
assert(!w2.owner_before(p1));
assert(w1.owner_before(p3) || w3.owner_before(p1));
assert(w3.owner_before(p1) == w3.owner_before(p2));
-// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted
- LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(p2));
+ ASSERT_NOEXCEPT(w1.owner_before(p2));
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
index 5cd171a53021..a38bf67c2e03 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
@@ -29,6 +29,5 @@ int main()
assert(!w2.owner_before(w1));
assert(w1.owner_before(w3) || w3.owner_before(w1));
assert(w3.owner_before(w1) == w3.owner_before(w2));
-// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted
- LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(w2));
+ ASSERT_NOEXCEPT(w1.owner_before(w2));
}
diff --git a/test/std/utilities/meta/meta.rel/is_callable.pass.cpp b/test/std/utilities/meta/meta.rel/is_callable.pass.cpp
deleted file mode 100644
index 4c85f440b0bf..000000000000
--- a/test/std/utilities/meta/meta.rel/is_callable.pass.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-
-// type_traits
-
-// is_callable
-
-// Most testing of is_callable is done within the [meta.trans.other] result_of
-// tests.
-
-#include <type_traits>
-#include <functional>
-#include <memory>
-
-#include "test_macros.h"
-
-struct Tag {};
-struct DerFromTag : Tag {};
-
-struct Implicit {
- Implicit(int) {}
-};
-
-struct Explicit {
- explicit Explicit(int) {}
-};
-
-struct NotCallableWithInt {
- int operator()(int) = delete;
- int operator()(Tag) { return 42; }
-};
-
-int main()
-{
- {
- using Fn = int(Tag::*)(int);
- using RFn = int(Tag::*)(int) &&;
- // INVOKE bullet 1, 2 and 3
- {
- // Bullet 1
- static_assert(std::is_callable<Fn(Tag&, int)>::value, "");
- static_assert(std::is_callable<Fn(DerFromTag&, int)>::value, "");
- static_assert(std::is_callable<RFn(Tag&&, int)>::value, "");
- static_assert(!std::is_callable<RFn(Tag&, int)>::value, "");
- static_assert(!std::is_callable<Fn(Tag&)>::value, "");
- static_assert(!std::is_callable<Fn(Tag const&, int)>::value, "");
- }
- {
- // Bullet 2
- using T = std::reference_wrapper<Tag>;
- using DT = std::reference_wrapper<DerFromTag>;
- using CT = std::reference_wrapper<const Tag>;
- static_assert(std::is_callable<Fn(T&, int)>::value, "");
- static_assert(std::is_callable<Fn(DT&, int)>::value, "");
- static_assert(std::is_callable<Fn(const T&, int)>::value, "");
- static_assert(std::is_callable<Fn(T&&, int)>::value, "");
- static_assert(!std::is_callable<Fn(CT&, int)>::value, "");
- static_assert(!std::is_callable<RFn(T, int)>::value, "");
- }
- {
- // Bullet 3
- using T = Tag*;
- using DT = DerFromTag*;
- using CT = const Tag*;
- using ST = std::unique_ptr<Tag>;
- static_assert(std::is_callable<Fn(T&, int)>::value, "");
- static_assert(std::is_callable<Fn(DT&, int)>::value, "");
- static_assert(std::is_callable<Fn(const T&, int)>::value, "");
- static_assert(std::is_callable<Fn(T&&, int)>::value, "");
- static_assert(std::is_callable<Fn(ST, int)>::value, "");
- static_assert(!std::is_callable<Fn(CT&, int)>::value, "");
- static_assert(!std::is_callable<RFn(T, int)>::value, "");
- }
- }
- {
- // Bullets 4, 5 and 6
- using Fn = int (Tag::*);
- static_assert(!std::is_callable<Fn()>::value, "");
- {
- // Bullet 4
- static_assert(std::is_callable<Fn(Tag&)>::value, "");
- static_assert(std::is_callable<Fn(DerFromTag&)>::value, "");
- static_assert(std::is_callable<Fn(Tag&&)>::value, "");
- static_assert(std::is_callable<Fn(Tag const&)>::value, "");
- }
- {
- // Bullet 5
- using T = std::reference_wrapper<Tag>;
- using DT = std::reference_wrapper<DerFromTag>;
- using CT = std::reference_wrapper<const Tag>;
- static_assert(std::is_callable<Fn(T&)>::value, "");
- static_assert(std::is_callable<Fn(DT&)>::value, "");
- static_assert(std::is_callable<Fn(const T&)>::value, "");
- static_assert(std::is_callable<Fn(T&&)>::value, "");
- static_assert(std::is_callable<Fn(CT&)>::value, "");
- }
- {
- // Bullet 6
- using T = Tag*;
- using DT = DerFromTag*;
- using CT = const Tag*;
- using ST = std::unique_ptr<Tag>;
- static_assert(std::is_callable<Fn(T&)>::value, "");
- static_assert(std::is_callable<Fn(DT&)>::value, "");
- static_assert(std::is_callable<Fn(const T&)>::value, "");
- static_assert(std::is_callable<Fn(T&&)>::value, "");
- static_assert(std::is_callable<Fn(ST)>::value, "");
- static_assert(std::is_callable<Fn(CT&)>::value, "");
- }
- }
- {
- // INVOKE bullet 7
- {
- // Function pointer
- using Fp = void(*)(Tag&, int);
- static_assert(std::is_callable<Fp(Tag&, int)>::value, "");
- static_assert(std::is_callable<Fp(DerFromTag&, int)>::value, "");
- static_assert(!std::is_callable<Fp(const Tag&, int)>::value, "");
- static_assert(!std::is_callable<Fp()>::value, "");
- static_assert(!std::is_callable<Fp(Tag&)>::value, "");
- }
- {
- // Function reference
- using Fp = void(&)(Tag&, int);
- static_assert(std::is_callable<Fp(Tag&, int)>::value, "");
- static_assert(std::is_callable<Fp(DerFromTag&, int)>::value, "");
- static_assert(!std::is_callable<Fp(const Tag&, int)>::value, "");
- static_assert(!std::is_callable<Fp()>::value, "");
- static_assert(!std::is_callable<Fp(Tag&)>::value, "");
- }
- {
- // Function object
- using Fn = NotCallableWithInt;
- static_assert(std::is_callable<Fn(Tag)>::value, "");
- static_assert(!std::is_callable<Fn(int)>::value, "");
- }
- }
- {
- // Check that the conversion to the return type is properly checked
- using Fn = int(*)();
- static_assert(std::is_callable<Fn(), Implicit>::value, "");
- static_assert(std::is_callable<Fn(), double>::value, "");
- static_assert(std::is_callable<Fn(), const volatile void>::value, "");
- static_assert(!std::is_callable<Fn(), Explicit>::value, "");
- }
- {
- // Check for is_callable_v
- using Fn = void(*)();
- static_assert(std::is_callable_v<Fn()>, "");
- static_assert(!std::is_callable_v<Fn(int)>, "");
- }
-}
diff --git a/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp b/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp
new file mode 100644
index 000000000000..1b2a9286f949
--- /dev/null
+++ b/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp
@@ -0,0 +1,166 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// type_traits
+
+// is_invocable
+
+// Most testing of is_invocable is done within the [meta.trans.other] result_of
+// tests.
+
+#include <type_traits>
+#include <functional>
+#include <memory>
+
+#include "test_macros.h"
+
+struct Tag {};
+struct DerFromTag : Tag {};
+
+struct Implicit {
+ Implicit(int) {}
+};
+
+struct Explicit {
+ explicit Explicit(int) {}
+};
+
+struct NotCallableWithInt {
+ int operator()(int) = delete;
+ int operator()(Tag) { return 42; }
+};
+
+int main()
+{
+ {
+ using Fn = int(Tag::*)(int);
+ using RFn = int(Tag::*)(int) &&;
+ // INVOKE bullet 1, 2 and 3
+ {
+ // Bullet 1
+ static_assert(std::is_invocable<Fn, Tag&, int>::value, "");
+ static_assert(std::is_invocable<Fn, DerFromTag&, int>::value, "");
+ static_assert(std::is_invocable<RFn, Tag&&, int>::value, "");
+ static_assert(!std::is_invocable<RFn, Tag&, int>::value, "");
+ static_assert(!std::is_invocable<Fn, Tag&>::value, "");
+ static_assert(!std::is_invocable<Fn, Tag const&, int>::value, "");
+ }
+ {
+ // Bullet 2
+ using T = std::reference_wrapper<Tag>;
+ using DT = std::reference_wrapper<DerFromTag>;
+ using CT = std::reference_wrapper<const Tag>;
+ static_assert(std::is_invocable<Fn, T&, int>::value, "");
+ static_assert(std::is_invocable<Fn, DT&, int>::value, "");
+ static_assert(std::is_invocable<Fn, const T&, int>::value, "");
+ static_assert(std::is_invocable<Fn, T&&, int>::value, "");
+ static_assert(!std::is_invocable<Fn, CT&, int>::value, "");
+ static_assert(!std::is_invocable<RFn, T, int>::value, "");
+ }
+ {
+ // Bullet 3
+ using T = Tag*;
+ using DT = DerFromTag*;
+ using CT = const Tag*;
+ using ST = std::unique_ptr<Tag>;
+ static_assert(std::is_invocable<Fn, T&, int>::value, "");
+ static_assert(std::is_invocable<Fn, DT&, int>::value, "");
+ static_assert(std::is_invocable<Fn, const T&, int>::value, "");
+ static_assert(std::is_invocable<Fn, T&&, int>::value, "");
+ static_assert(std::is_invocable<Fn, ST, int>::value, "");
+ static_assert(!std::is_invocable<Fn, CT&, int>::value, "");
+ static_assert(!std::is_invocable<RFn, T, int>::value, "");
+ }
+ }
+ {
+ // Bullets 4, 5 and 6
+ using Fn = int (Tag::*);
+ static_assert(!std::is_invocable<Fn>::value, "");
+ {
+ // Bullet 4
+ static_assert(std::is_invocable<Fn, Tag&>::value, "");
+ static_assert(std::is_invocable<Fn, DerFromTag&>::value, "");
+ static_assert(std::is_invocable<Fn, Tag&&>::value, "");
+ static_assert(std::is_invocable<Fn, Tag const&>::value, "");
+ }
+ {
+ // Bullet 5
+ using T = std::reference_wrapper<Tag>;
+ using DT = std::reference_wrapper<DerFromTag>;
+ using CT = std::reference_wrapper<const Tag>;
+ static_assert(std::is_invocable<Fn, T&>::value, "");
+ static_assert(std::is_invocable<Fn, DT&>::value, "");
+ static_assert(std::is_invocable<Fn, const T&>::value, "");
+ static_assert(std::is_invocable<Fn, T&&>::value, "");
+ static_assert(std::is_invocable<Fn, CT&>::value, "");
+ }
+ {
+ // Bullet 6
+ using T = Tag*;
+ using DT = DerFromTag*;
+ using CT = const Tag*;
+ using ST = std::unique_ptr<Tag>;
+ static_assert(std::is_invocable<Fn, T&>::value, "");
+ static_assert(std::is_invocable<Fn, DT&>::value, "");
+ static_assert(std::is_invocable<Fn, const T&>::value, "");
+ static_assert(std::is_invocable<Fn, T&&>::value, "");
+ static_assert(std::is_invocable<Fn, ST>::value, "");
+ static_assert(std::is_invocable<Fn, CT&>::value, "");
+ }
+ }
+ {
+ // INVOKE bullet 7
+ {
+ // Function pointer
+ using Fp = void(*)(Tag&, int);
+ static_assert(std::is_invocable<Fp, Tag&, int>::value, "");
+ static_assert(std::is_invocable<Fp, DerFromTag&, int>::value, "");
+ static_assert(!std::is_invocable<Fp, const Tag&, int>::value, "");
+ static_assert(!std::is_invocable<Fp>::value, "");
+ static_assert(!std::is_invocable<Fp, Tag&>::value, "");
+ }
+ {
+ // Function reference
+ using Fp = void(&)(Tag&, int);
+ static_assert(std::is_invocable<Fp, Tag&, int>::value, "");
+ static_assert(std::is_invocable<Fp, DerFromTag&, int>::value, "");
+ static_assert(!std::is_invocable<Fp, const Tag&, int>::value, "");
+ static_assert(!std::is_invocable<Fp>::value, "");
+ static_assert(!std::is_invocable<Fp, Tag&>::value, "");
+ }
+ {
+ // Function object
+ using Fn = NotCallableWithInt;
+ static_assert(std::is_invocable<Fn, Tag>::value, "");
+ static_assert(!std::is_invocable<Fn, int>::value, "");
+ }
+ }
+ {
+ // Check that the conversion to the return type is properly checked
+ using Fn = int(*)();
+ static_assert(std::is_invocable_r<Implicit, Fn>::value, "");
+ static_assert(std::is_invocable_r<double, Fn>::value, "");
+ static_assert(std::is_invocable_r<const volatile void, Fn>::value, "");
+ static_assert(!std::is_invocable_r<Explicit, Fn>::value, "");
+ }
+ {
+ // Check for is_invocable_v
+ using Fn = void(*)();
+ static_assert(std::is_invocable_v<Fn>, "");
+ static_assert(!std::is_invocable_v<Fn, int>, "");
+ }
+ {
+ // Check for is_invocable_r_v
+ using Fn = void(*)();
+ static_assert(std::is_invocable_r_v<void, Fn>, "");
+ static_assert(!std::is_invocable_r_v<int, Fn>, "");
+ }
+}
diff --git a/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp b/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
deleted file mode 100644
index eefa6d1f22b1..000000000000
--- a/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-
-// type_traits
-
-// is_nothrow_callable
-
-#include <type_traits>
-#include <functional>
-
-#include "test_macros.h"
-
-struct Tag {};
-
-struct Implicit {
- Implicit(int) noexcept {}
-};
-
-struct ThrowsImplicit {
- ThrowsImplicit(int) {}
-};
-
-struct Explicit {
- explicit Explicit(int) noexcept {}
-};
-
-template <bool IsNoexcept, class Ret, class ...Args>
-struct CallObject {
- Ret operator()(Args&&...) const noexcept(IsNoexcept);
-};
-
-template <class Fn>
-constexpr bool throws_callable() {
- return std::is_callable<Fn>::value &&
- !std::is_nothrow_callable<Fn>::value;
-}
-
-template <class Fn, class Ret>
-constexpr bool throws_callable() {
- return std::is_callable<Fn, Ret>::value &&
- !std::is_nothrow_callable<Fn, Ret>::value;
-}
-
-// FIXME(EricWF) Don't test the where noexcept is *not* part of the type system
-// once implementations have caught up.
-void test_noexcept_function_pointers()
-{
- struct Dummy { void foo() noexcept {} static void bar() noexcept {} };
-#if !defined(__cpp_noexcept_function_type)
- {
- // Check that PMF's and function pointers *work*. is_nothrow_callable will always
- // return false because 'noexcept' is not part of the function type.
- static_assert(throws_callable<decltype(&Dummy::foo)(Dummy&)>(), "");
- static_assert(throws_callable<decltype(&Dummy::bar)()>(), "");
- }
-#else
- {
- // Check that PMF's and function pointers actually work and that
- // is_nothrow_callable returns true for noexcept PMF's and function
- // pointers.
- static_assert(std::is_nothrow_callable<decltype(&Dummy::foo)(Dummy&)>::value, "");
- static_assert(std::is_nothrow_callable<decltype(&Dummy::bar)()>::value, "");
- }
-#endif
-}
-
-int main()
-{
- {
- // Check that the conversion to the return type is properly checked
- using Fn = CallObject<true, int>;
- static_assert(std::is_nothrow_callable<Fn(), Implicit>::value, "");
- static_assert(std::is_nothrow_callable<Fn(), double>::value, "");
- static_assert(std::is_nothrow_callable<Fn(), const volatile void>::value, "");
- static_assert(throws_callable<Fn(), ThrowsImplicit>(), "");
- static_assert(!std::is_nothrow_callable<Fn(), Explicit>(), "");
- }
- {
- // Check that the conversion to the parameters is properly checked
- using Fn = CallObject<true, void, const Implicit&, const ThrowsImplicit&>;
- static_assert(std::is_nothrow_callable<Fn(Implicit&, ThrowsImplicit&)>::value, "");
- static_assert(std::is_nothrow_callable<Fn(int, ThrowsImplicit&)>::value, "");
- static_assert(throws_callable<Fn(int, int)>(), "");
- static_assert(!std::is_nothrow_callable<Fn()>::value, "");
- }
- {
- // Check that the noexcept-ness of function objects is checked.
- using Fn = CallObject<true, void>;
- using Fn2 = CallObject<false, void>;
- static_assert(std::is_nothrow_callable<Fn()>::value, "");
- static_assert(throws_callable<Fn2()>(), "");
- }
- {
- // Check that PMD derefs are noexcept
- using Fn = int (Tag::*);
- static_assert(std::is_nothrow_callable<Fn(Tag&)>::value, "");
- static_assert(std::is_nothrow_callable<Fn(Tag&), Implicit>::value, "");
- static_assert(throws_callable<Fn(Tag&), ThrowsImplicit>(), "");
- }
- {
- // Check for is_nothrow_callable_v
- using Fn = CallObject<true, int>;
- static_assert(std::is_nothrow_callable_v<Fn()>, "");
- static_assert(!std::is_nothrow_callable_v<Fn(int)>, "");
- }
- test_noexcept_function_pointers();
-}
diff --git a/test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp b/test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp
new file mode 100644
index 000000000000..3be3d46f295b
--- /dev/null
+++ b/test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp
@@ -0,0 +1,121 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// type_traits
+
+// is_nothrow_invocable
+
+#include <type_traits>
+#include <functional>
+
+#include "test_macros.h"
+
+struct Tag {};
+
+struct Implicit {
+ Implicit(int) noexcept {}
+};
+
+struct ThrowsImplicit {
+ ThrowsImplicit(int) {}
+};
+
+struct Explicit {
+ explicit Explicit(int) noexcept {}
+};
+
+template <bool IsNoexcept, class Ret, class ...Args>
+struct CallObject {
+ Ret operator()(Args&&...) const noexcept(IsNoexcept);
+};
+
+template <class Fn, class ...Args>
+constexpr bool throws_invocable() {
+ return std::is_invocable<Fn, Args...>::value &&
+ !std::is_nothrow_invocable<Fn, Args...>::value;
+}
+
+template <class Ret, class Fn, class ...Args>
+constexpr bool throws_invocable_r() {
+ return std::is_invocable_r<Ret, Fn, Args...>::value &&
+ !std::is_nothrow_invocable_r<Ret, Fn, Args...>::value;
+}
+
+// FIXME(EricWF) Don't test the where noexcept is *not* part of the type system
+// once implementations have caught up.
+void test_noexcept_function_pointers()
+{
+ struct Dummy { void foo() noexcept {} static void bar() noexcept {} };
+#if !defined(__cpp_noexcept_function_type)
+ {
+ // Check that PMF's and function pointers *work*. is_nothrow_invocable will always
+ // return false because 'noexcept' is not part of the function type.
+ static_assert(throws_invocable<decltype(&Dummy::foo), Dummy&>(), "");
+ static_assert(throws_invocable<decltype(&Dummy::bar)>(), "");
+ }
+#else
+ {
+ // Check that PMF's and function pointers actually work and that
+ // is_nothrow_invocable returns true for noexcept PMF's and function
+ // pointers.
+ static_assert(std::is_nothrow_invocable<decltype(&Dummy::foo), Dummy&>::value, "");
+ static_assert(std::is_nothrow_invocable<decltype(&Dummy::bar)>::value, "");
+ }
+#endif
+}
+
+int main()
+{
+ {
+ // Check that the conversion to the return type is properly checked
+ using Fn = CallObject<true, int>;
+ static_assert(std::is_nothrow_invocable_r<Implicit, Fn>::value, "");
+ static_assert(std::is_nothrow_invocable_r<double, Fn>::value, "");
+ static_assert(std::is_nothrow_invocable_r<const volatile void, Fn>::value, "");
+ static_assert(throws_invocable_r<ThrowsImplicit, Fn>(), "");
+ static_assert(!std::is_nothrow_invocable<Fn(), Explicit>(), "");
+ }
+ {
+ // Check that the conversion to the parameters is properly checked
+ using Fn = CallObject<true, void, const Implicit&, const ThrowsImplicit&>;
+ static_assert(std::is_nothrow_invocable<Fn, Implicit&, ThrowsImplicit&>::value, "");
+ static_assert(std::is_nothrow_invocable<Fn, int, ThrowsImplicit&>::value, "");
+ static_assert(throws_invocable<Fn, int, int>(), "");
+ static_assert(!std::is_nothrow_invocable<Fn>::value, "");
+ }
+ {
+ // Check that the noexcept-ness of function objects is checked.
+ using Fn = CallObject<true, void>;
+ using Fn2 = CallObject<false, void>;
+ static_assert(std::is_nothrow_invocable<Fn>::value, "");
+ static_assert(throws_invocable<Fn2>(), "");
+ }
+ {
+ // Check that PMD derefs are noexcept
+ using Fn = int (Tag::*);
+ static_assert(std::is_nothrow_invocable<Fn, Tag&>::value, "");
+ static_assert(std::is_nothrow_invocable_r<Implicit, Fn, Tag&>::value, "");
+ static_assert(throws_invocable_r<ThrowsImplicit, Fn, Tag&>(), "");
+ }
+ {
+ // Check for is_nothrow_invocable_v
+ using Fn = CallObject<true, int>;
+ static_assert(std::is_nothrow_invocable_v<Fn>, "");
+ static_assert(!std::is_nothrow_invocable_v<Fn, int>, "");
+ }
+ {
+ // Check for is_nothrow_invocable_r_v
+ using Fn = CallObject<true, int>;
+ static_assert(std::is_nothrow_invocable_r_v<void, Fn>, "");
+ static_assert(!std::is_nothrow_invocable_r_v<int, Fn, int>, "");
+ }
+ test_noexcept_function_pointers();
+}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.fail.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.fail.cpp
new file mode 100644
index 000000000000..efee5064cf59
--- /dev/null
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// type_traits
+
+// aligned_union<size_t Len, class ...Types>
+
+#include <type_traits>
+
+class A; // Incomplete
+
+int main()
+{
+ typedef std::aligned_union<10, A>::type T1;
+}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
index 4f45a0340a91..c0aece771f0c 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
@@ -34,9 +34,9 @@ int main()
test_decay<const int[3], const int*>();
test_decay<void(), void (*)()>();
#if TEST_STD_VER > 11
- test_decay<int(int) const, int(int) const>();
- test_decay<int(int) volatile, int(int) volatile>();
- test_decay<int(int) &, int(int) &>();
- test_decay<int(int) &&, int(int) &&>();
+ test_decay<int(int) const, int(int) const>();
+ test_decay<int(int) volatile, int(int) volatile>();
+ test_decay<int(int) &, int(int) &>();
+ test_decay<int(int) &&, int(int) &&>();
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp
new file mode 100644
index 000000000000..e06229f7e975
--- /dev/null
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// type_traits
+
+// remove_cvref
+
+#include <type_traits>
+
+#include "test_macros.h"
+
+template <class T, class U>
+void test_remove_cvref()
+{
+ static_assert((std::is_same<typename std::remove_cvref<T>::type, U>::value), "");
+ static_assert((std::is_same< std::remove_cvref_t<T>, U>::value), "");
+}
+
+int main()
+{
+ test_remove_cvref<void, void>();
+ test_remove_cvref<int, int>();
+ test_remove_cvref<const int, int>();
+ test_remove_cvref<const volatile int, int>();
+ test_remove_cvref<volatile int, int>();
+
+// Doesn't decay
+ test_remove_cvref<int[3], int[3]>();
+ test_remove_cvref<int const [3], int[3]>();
+ test_remove_cvref<int volatile [3], int[3]>();
+ test_remove_cvref<int const volatile [3], int[3]>();
+ test_remove_cvref<void(), void ()>();
+
+ test_remove_cvref<int &, int>();
+ test_remove_cvref<const int &, int>();
+ test_remove_cvref<const volatile int &, int>();
+ test_remove_cvref<volatile int &, int>();
+
+ test_remove_cvref<int*, int*>();
+ test_remove_cvref<int(int) const, int(int) const>();
+ test_remove_cvref<int(int) volatile, int(int) volatile>();
+ test_remove_cvref<int(int) &, int(int) &>();
+ test_remove_cvref<int(int) &&, int(int) &&>();
+}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp
index fc01b22c36ab..24231526b2bf 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp
@@ -42,16 +42,46 @@ struct HasType : std::false_type {};
template <class T>
struct HasType<T, typename Voider<typename T::type>::type> : std::true_type {};
+#if TEST_STD_VER > 14
+template <typename T, typename U>
+struct test_invoke_result;
+
+template <typename Fn, typename ...Args, typename Ret>
+struct test_invoke_result<Fn(Args...), Ret>
+{
+ static void call()
+ {
+ static_assert(std::is_invocable<Fn, Args...>::value, "");
+ static_assert(std::is_invocable_r<Ret, Fn, Args...>::value, "");
+ static_assert((std::is_same<typename std::invoke_result<Fn, Args...>::type, Ret>::value), "");
+ }
+};
+#endif
+
template <class T, class U>
void test_result_of()
{
+ static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
#if TEST_STD_VER > 14
- static_assert(std::is_callable<T>::value, "");
- static_assert(std::is_callable<T, U>::value, "");
+ test_invoke_result<T, U>::call();
#endif
- static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
}
+#if TEST_STD_VER > 14
+template <typename T>
+struct test_invoke_no_result;
+
+template <typename Fn, typename ...Args>
+struct test_invoke_no_result<Fn(Args...)>
+{
+ static void call()
+ {
+ static_assert(std::is_invocable<Fn, Args...>::value == false, "");
+ static_assert((!HasType<std::invoke_result<Fn, Args...> >::value), "");
+ }
+};
+#endif
+
template <class T>
void test_no_result()
{
@@ -59,7 +89,7 @@ void test_no_result()
static_assert((!HasType<std::result_of<T> >::value), "");
#endif
#if TEST_STD_VER > 14
- static_assert(std::is_callable<T>::value == false, "");
+ test_invoke_no_result<T>::call();
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
index eac4e4a089fe..2b8cd709677b 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
@@ -27,6 +27,23 @@ struct wat
struct F {};
struct FD : public F {};
+#if TEST_STD_VER > 14
+template <typename T, typename U>
+struct test_invoke_result;
+
+template <typename Fn, typename ...Args, typename Ret>
+struct test_invoke_result<Fn(Args...), Ret>
+{
+ static void call()
+ {
+ static_assert(std::is_invocable<Fn, Args...>::value, "");
+ static_assert(std::is_invocable_r<Ret, Fn, Args...>::value, "");
+ static_assert((std::is_same<typename std::invoke_result<Fn, Args...>::type, Ret>::value), "");
+ static_assert((std::is_same<std::invoke_result_t<Fn, Args...>, Ret>::value), "");
+ }
+};
+#endif
+
template <class T, class U>
void test_result_of_imp()
{
@@ -35,8 +52,7 @@ void test_result_of_imp()
static_assert((std::is_same<std::result_of_t<T>, U>::value), "");
#endif
#if TEST_STD_VER > 14
- static_assert(std::is_callable<T>::value, "");
- static_assert(std::is_callable<T, U>::value, "");
+ test_invoke_result<T, U>::call();
#endif
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
index 4e875fa94520..23d5176127a1 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
@@ -77,11 +77,11 @@ typedef void (*FunctionPtr)();
int main()
{
- test_is_function<void(void)>();
- test_is_function<int(int)>();
- test_is_function<int(int, double)>();
- test_is_function<int(Abstract *)>();
- test_is_function<void(...)>();
+ test_is_function<void(void)>();
+ test_is_function<int(int)>();
+ test_is_function<int(int, double)>();
+ test_is_function<int(Abstract *)>();
+ test_is_function<void(...)>();
test_is_not_function<std::nullptr_t>();
test_is_not_function<void>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp
index f776196dd7a9..052b0b9851d6 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp
@@ -91,11 +91,11 @@ int main()
test_is_fundamental<unsigned char>();
test_is_fundamental<wchar_t>();
test_is_fundamental<double>();
- test_is_fundamental<float>();
- test_is_fundamental<double>();
- test_is_fundamental<long double>();
- test_is_fundamental<char16_t>();
- test_is_fundamental<char32_t>();
+ test_is_fundamental<float>();
+ test_is_fundamental<double>();
+ test_is_fundamental<long double>();
+ test_is_fundamental<char16_t>();
+ test_is_fundamental<char32_t>();
test_is_not_fundamental<char[3]>();
test_is_not_fundamental<char[]>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
index 3955d4bc3306..8d63a23494b9 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
@@ -81,5 +81,5 @@ int main()
test_is_not_assignable<int(), int> ();
// pointer to incomplete template type
- test_is_assignable<X<D>*&, X<D>*> ();
+ test_is_assignable<X<D>*&, X<D>*> ();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
index 9d2ec5edea58..1f7c32a8cc07 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
@@ -9,7 +9,7 @@
// type_traits
// XFAIL: apple-clang-6.0
-// The Apple-6 compiler gets is_constructible<void ()> wrong.
+// The Apple-6 compiler gets is_constructible<void ()> wrong.
// template <class T, class... Args>
// struct is_constructible;
diff --git a/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp b/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp
index f9ea7b47911f..c97bebe29c3c 100644
--- a/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp
+++ b/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp
@@ -11,17 +11,15 @@
// <optional>
// struct nullopt_t{see below};
-// constexpr nullopt_t nullopt(unspecified);
+// inline constexpr nullopt_t nullopt(unspecified);
// [optional.nullopt]/2:
-// Type nullopt_t shall not have a default constructor or an initializer-list constructor.
-// It shall not be an aggregate and shall be a literal type.
-// Constant nullopt shall be initialized with an argument of literal type.
+// Type nullopt_t shall not have a default constructor or an initializer-list
+// constructor, and shall not be an aggregate.
#include <optional>
-#include "test_macros.h"
int main()
{
- std::nullopt_t n = {};
+ std::nullopt_t n = {};
}
diff --git a/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp
index 9b752a665a83..247fce58fe97 100644
--- a/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp
+++ b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp
@@ -11,33 +11,30 @@
// <optional>
// struct nullopt_t{see below};
-// constexpr nullopt_t nullopt(unspecified);
+// inline constexpr nullopt_t nullopt(unspecified);
// [optional.nullopt]/2:
-// Type nullopt_t shall not have a default constructor or an initializer-list constructor.
-// It shall not be an aggregate and shall be a literal type.
-// Constant nullopt shall be initialized with an argument of literal type.
+// Type nullopt_t shall not have a default constructor or an initializer-list
+// constructor, and shall not be an aggregate.
#include <optional>
#include <type_traits>
-using std::optional;
using std::nullopt_t;
using std::nullopt;
-constexpr
-int
-test(const nullopt_t&)
+constexpr bool test()
{
- return 3;
+ nullopt_t foo{nullopt};
+ (void)foo;
+ return true;
}
int main()
{
- static_assert(( std::is_class<nullopt_t>::value), "");
- static_assert(( std::is_empty<nullopt_t>::value), "");
- static_assert(( std::is_literal_type<nullopt_t>::value), "");
- static_assert((!std::is_default_constructible<nullopt_t>::value), "");
+ static_assert(std::is_empty_v<nullopt_t>);
+ static_assert(!std::is_default_constructible_v<nullopt_t>);
- static_assert(test(nullopt) == 3, "");
+ static_assert(std::is_same_v<const nullopt_t, decltype(nullopt)>);
+ static_assert(test());
}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp
index 3224c1bac756..77e411b2e3b5 100644
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp
@@ -21,11 +21,11 @@
#include "test_macros.h"
struct S {
- constexpr S() : v_(0) {}
- S(int v) : v_(v) {}
- S(const S &rhs) : v_(rhs.v_) {} // make it not trivially copyable
- int v_;
- };
+ constexpr S() : v_(0) {}
+ S(int v) : v_(v) {}
+ S(const S &rhs) : v_(rhs.v_) {} // make it not trivially copyable
+ int v_;
+ };
int main()
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp
index fb2e139ad591..4e3991c18487 100644
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp
@@ -21,12 +21,12 @@
#include "test_macros.h"
struct S {
- constexpr S() : v_(0) {}
- S(int v) : v_(v) {}
- constexpr S(const S &rhs) : v_(rhs.v_) {} // not trivially moveable
- constexpr S(const S &&rhs) : v_(rhs.v_) {} // not trivially moveable
- int v_;
- };
+ constexpr S() : v_(0) {}
+ S(int v) : v_(v) {}
+ constexpr S(const S &rhs) : v_(rhs.v_) {} // not trivially moveable
+ constexpr S(const S &&rhs) : v_(rhs.v_) {} // not trivially moveable
+ int v_;
+ };
int main()
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
index 44e6e7305901..bbc70014f099 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -69,7 +69,7 @@ int main()
optional<X> opt;
try
{
- opt.value();
+ (void)opt.value();
assert(false);
}
catch (const bad_optional_access&)
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
index e2d48ec99302..c644fb9d6696 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -61,7 +61,7 @@ int main()
const optional<X> opt;
try
{
- opt.value();
+ (void)opt.value();
assert(false);
}
catch (const bad_optional_access&)
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
index 874a5441a4c2..5347d3f558bb 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
@@ -61,7 +61,7 @@ int main()
const optional<X> opt;
try
{
- std::move(opt).value();
+ (void)std::move(opt).value();
assert(false);
}
catch (const bad_optional_access&)
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
index 60cab7d27c64..1a577e68b99e 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
@@ -67,7 +67,7 @@ int main()
optional<X> opt;
try
{
- std::move(opt).value();
+ (void)std::move(opt).value();
assert(false);
}
catch (const bad_optional_access&)
diff --git a/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp b/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp
index 8a2c77af0ec1..11ddcb7c0028 100644
--- a/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp
+++ b/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp
@@ -26,22 +26,22 @@ int main()
{
using std::optional;
{
- // expected-error@optional:* 2 {{static_assert failed "instantiation of optional with a reference type is ill-formed}}
+ // expected-error-re@optional:* 2 {{static_assert failed{{.*}} "instantiation of optional with a reference type is ill-formed}}
optional<int&> opt1;
optional<int&&> opt2;
}
{
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed"}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-destructible type is ill-formed"}}
optional<X> opt3;
}
{
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-object type is undefined behavior"}}
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-object type is undefined behavior"}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-destructible type is ill-formed}}
optional<void()> opt4;
}
{
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-object type is undefined behavior"}}
- // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-object type is undefined behavior"}}
+ // expected-error-re@optional:* {{static_assert failed{{.*}} "instantiation of optional with a non-destructible type is ill-formed}}
// expected-error@optional:* 1+ {{cannot form a reference to 'void'}}
optional<const void> opt4;
}
diff --git a/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp b/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
index 687625e8b673..57903020fedb 100644
--- a/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
+++ b/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
@@ -19,4 +19,5 @@ int main()
using std::optional;
std::initializer_list<int> list;
+ (void)list;
}
diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp
index 4e2a6dfa3dd1..d747483a9d5a 100644
--- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp
+++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp
@@ -14,7 +14,7 @@
// Test unique_ptr converting move ctor
-// NOTE: unique_ptr does not provide converting constructors in c++03
+// NOTE: unique_ptr does not provide converting constructors in C++03
// UNSUPPORTED: c++98, c++03
#include <memory>
diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp
index b05fb71cdc67..50058a6208a5 100644
--- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp
+++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp
@@ -19,6 +19,6 @@
int main() {
std::unique_ptr<int[]> p(new int(3));
const std::unique_ptr<int[]>& cp = p;
- (void)(*p); // expected-error {{indirection requires pointer operand ('std::unique_ptr<int []>' invalid)}}
- (void)(*cp); // expected-error {{indirection requires pointer operand ('const std::unique_ptr<int []>' invalid)}}
+ TEST_IGNORE_NODISCARD (*p); // expected-error {{indirection requires pointer operand ('std::unique_ptr<int []>' invalid)}}
+ TEST_IGNORE_NODISCARD (*cp); // expected-error {{indirection requires pointer operand ('const std::unique_ptr<int []>' invalid)}}
}
diff --git a/test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp b/test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
index a2c9df6b4a22..20578511c8cf 100644
--- a/test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
@@ -36,11 +36,18 @@ void test_to_ullong()
std::bitset<N> v(j);
assert(j == v.to_ullong());
}
+ { // test values bigger than can fit into the bitset
+ const unsigned long long val = 0x55AAAAFFFFAAAA55ULL;
+ const bool canFit = N < sizeof(unsigned long long) * CHAR_BIT;
+ const unsigned long long mask = canFit ? (1ULL << (canFit ? N : 0)) - 1 : (unsigned long long)(-1); // avoid compiler warnings
+ std::bitset<N> v(val);
+ assert(v.to_ullong() == (val & mask)); // we shouldn't return bit patterns from outside the limits of the bitset.
+ }
}
int main()
{
- test_to_ullong<0>();
+// test_to_ullong<0>();
test_to_ullong<1>();
test_to_ullong<31>();
test_to_ullong<32>();
diff --git a/test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp b/test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
index 7cabd06e5f32..0872d77bca91 100644
--- a/test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
@@ -37,6 +37,14 @@ void test_to_ulong()
std::bitset<N> v(j);
assert(j == v.to_ulong());
}
+
+ { // test values bigger than can fit into the bitset
+ const unsigned long val = 0x5AFFFFA5UL;
+ const bool canFit = N < sizeof(unsigned long) * CHAR_BIT;
+ const unsigned long mask = canFit ? (1UL << (canFit ? N : 0)) - 1 : (unsigned long)(-1); // avoid compiler warnings
+ std::bitset<N> v(val);
+ assert(v.to_ulong() == (val & mask)); // we shouldn't return bit patterns from outside the limits of the bitset.
+ }
}
int main()
diff --git a/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
index 24847dd70f86..2f8a707bfa2f 100644
--- a/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
@@ -24,8 +24,8 @@
#include <chrono>
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
int main()
{
diff --git a/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
index cdb38dfce3f5..4458d6f213fa 100644
--- a/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
@@ -26,8 +26,8 @@
#include <chrono>
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
int main()
{
diff --git a/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
index dfc08a3bca69..deb4615fa5a1 100644
--- a/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
@@ -24,8 +24,8 @@
#include <chrono>
-template <class _Tp>
-void test(const _Tp &) {}
+template <class T>
+void test(const T &) {}
int main()
{
diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp
index 702c38d2d4a9..416a8db8ae5b 100644
--- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp
@@ -11,7 +11,7 @@
// duration
-// constexpr duration& operator++(); // constexpr in c++17
+// constexpr duration& operator++(); // constexpr in C++17
#include <chrono>
#include <cassert>
diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp
index 49b8c76ee8ee..deb4daa8d86b 100644
--- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp
@@ -11,7 +11,7 @@
// duration
-// constexpr duration operator++(int); // constexpr in c++17
+// constexpr duration operator++(int); // constexpr in C++17
#include <chrono>
#include <cassert>
diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp
index bec8effbe220..b74011a3b27b 100644
--- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp
@@ -11,7 +11,7 @@
// duration
-// constexpr duration& operator+=(const duration& d); // constexpr in c++17
+// constexpr duration& operator+=(const duration& d); // constexpr in C++17
#include <chrono>
#include <cassert>
diff --git a/test/std/utilities/tuple/tuple.general/ignore.pass.cpp b/test/std/utilities/tuple/tuple.general/ignore.pass.cpp
index 8dae3a5dcb0e..a7a0904cf492 100644
--- a/test/std/utilities/tuple/tuple.general/ignore.pass.cpp
+++ b/test/std/utilities/tuple/tuple.general/ignore.pass.cpp
@@ -48,9 +48,7 @@ int main() {
{
static_assert(test_ignore_constexpr(), "");
}
-#if defined(_LIBCPP_VERSION)
{
- static_assert(std::is_trivial<decltype(std::ignore)>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_trivial<decltype(std::ignore)>::value, "");
}
-#endif
}
diff --git a/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp b/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp
index d1b974c50753..811dfc03ba11 100644
--- a/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp
+++ b/test/std/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp
@@ -29,5 +29,5 @@ int main () {
}
// Smart pointers of type 'T[N]' are not tested here since they are not
// supported by the standard nor by libc++'s implementation.
- // See http://reviews.llvm.org/D21320 for more information.
+ // See https://reviews.llvm.org/D21320 for more information.
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
index 06284df56642..fed27aa84ff6 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
@@ -147,6 +147,7 @@ int main()
#if TEST_STD_VER > 11
{
constexpr std::tuple<Empty> t0{Empty()};
+ (void)t0;
}
{
constexpr std::tuple<A, A> t(3, 2);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp
index b262f3cacecf..bf66da1626a0 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp
@@ -102,6 +102,8 @@ int main()
using T = NonDefaultConstructible<>;
T v(42);
std::tuple<T, T> t(v, v);
+ (void)t;
std::tuple<T, T> t2(42, 42);
+ (void)t2;
}
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
index fa2f116f7718..731946608bab 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
@@ -49,6 +49,7 @@ int main()
{
{
std::tuple<> t;
+ (void)t;
}
{
std::tuple<int> t;
@@ -88,6 +89,7 @@ int main()
}
{
constexpr std::tuple<> t;
+ (void)t;
}
{
constexpr std::tuple<int> t;
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp
index 7b9c061b3ae8..85036b59186d 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp
@@ -15,10 +15,11 @@
// against libstdc++.
// XFAIL: gcc
-// <string>
+// <tuple>
-// Test that the constructors offered by std::basic_string are formulated
-// so they're compatible with implicit deduction guides.
+// Test that the constructors offered by std::tuple are formulated
+// so they're compatible with implicit deduction guides, or if that's not
+// possible that they provide explicit guides to make it work.
#include <tuple>
#include <memory>
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp
index 74e6efd983bd..af9424806752 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp
@@ -11,17 +11,18 @@
#include <tuple>
#include <string>
+#include "test_macros.h"
struct UserType {};
void test_bad_index() {
std::tuple<long, long, char, std::string, char, UserType, char> t1;
- (void)std::get<int>(t1); // expected-error@tuple:* {{type not found}}
- (void)std::get<long>(t1); // expected-note {{requested here}}
- (void)std::get<char>(t1); // expected-note {{requested here}}
+ TEST_IGNORE_NODISCARD std::get<int>(t1); // expected-error@tuple:* {{type not found}}
+ TEST_IGNORE_NODISCARD std::get<long>(t1); // expected-note {{requested here}}
+ TEST_IGNORE_NODISCARD std::get<char>(t1); // expected-note {{requested here}}
// expected-error@tuple:* 2 {{type occurs more than once}}
std::tuple<> t0;
- (void)std::get<char*>(t0); // expected-node {{requested here}}
+ TEST_IGNORE_NODISCARD std::get<char*>(t0); // expected-node {{requested here}}
// expected-error@tuple:* 1 {{type not in empty type list}}
}
diff --git a/test/std/utilities/utility/as_const/as_const.fail.cpp b/test/std/utilities/utility/as_const/as_const.fail.cpp
index 6334e1460259..c28957cfc505 100644
--- a/test/std/utilities/utility/as_const/as_const.fail.cpp
+++ b/test/std/utilities/utility/as_const/as_const.fail.cpp
@@ -18,5 +18,5 @@ struct S {int i;};
int main()
{
- std::as_const(S{});
+ std::as_const(S{});
}
diff --git a/test/std/utilities/utility/as_const/as_const.pass.cpp b/test/std/utilities/utility/as_const/as_const.pass.cpp
index 7bb5849d0bd0..268f2d1b04ee 100644
--- a/test/std/utilities/utility/as_const/as_const.pass.cpp
+++ b/test/std/utilities/utility/as_const/as_const.pass.cpp
@@ -37,10 +37,10 @@ void test(T& t)
int main()
{
- int i = 3;
- double d = 4.0;
- S s{2};
- test(i);
- test(d);
- test(s);
+ int i = 3;
+ double d = 4.0;
+ S s{2};
+ test(i);
+ test(d);
+ test(s);
}
diff --git a/test/std/utilities/utility/forward/forward.fail.cpp b/test/std/utilities/utility/forward/forward.fail.cpp
index a3bb890482ef..c845216d86dc 100644
--- a/test/std/utilities/utility/forward/forward.fail.cpp
+++ b/test/std/utilities/utility/forward/forward.fail.cpp
@@ -25,7 +25,7 @@ int main()
#if TEST_STD_VER >= 11
{
std::forward<A&>(source()); // expected-note {{requested here}}
- // expected-error@type_traits:* 1 {{static_assert failed "can not forward an rvalue as an lvalue"}}
+ // expected-error-re@type_traits:* 1 {{static_assert failed{{.*}} "can not forward an rvalue as an lvalue"}}
}
#else
{
diff --git a/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp b/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp
index 8e994126cc0d..4ca31f7debe8 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp
@@ -18,5 +18,5 @@
int main()
{
typedef std::pair<int, short> T;
- typename std::tuple_element<2, T>::type foo; // expected-error@utility:* {{Index out of bounds in std::tuple_element<std::pair<T1, T2>>}}
+ std::tuple_element<2, T>::type foo; // expected-error@utility:* {{Index out of bounds in std::tuple_element<std::pair<T1, T2>>}}
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
index ade8130d7822..715b65537761 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
@@ -71,7 +71,7 @@ int main()
P1 p1(42, 101);
P2 p2(p1);
assert(p2.first == 42);
- assert(p2.second = 101);
+ assert(p2.second == 101);
}
{
test_pair_const<AllCtors, AllCtors>(); // copy construction
diff --git a/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp
new file mode 100644
index 000000000000..7933dd99c1f4
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-deduction-guides
+
+// GCC's implementation of class template deduction is still immature and runs
+// into issues with libc++. However GCC accepts this code when compiling
+// against libstdc++.
+// XFAIL: gcc
+
+// <utility>
+
+// Test that the constructors offered by std::pair are formulated
+// so they're compatible with implicit deduction guides, or if that's not
+// possible that they provide explicit guides to make it work.
+
+#include <utility>
+#include <memory>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+
+// Overloads
+// ---------------
+// (1) pair(const T1&, const T2&) -> pair<T1, T2>
+// (2) explicit pair(const T1&, const T2&) -> pair<T1, T2>
+// (3) pair(pair const& t) -> decltype(t)
+// (4) pair(pair&& t) -> decltype(t)
+// (5) pair(pair<U1, U2> const&) -> pair<U1, U2>
+// (6) explicit pair(pair<U1, U2> const&) -> pair<U1, U2>
+// (7) pair(pair<U1, U2> &&) -> pair<U1, U2>
+// (8) explicit pair(pair<U1, U2> &&) -> pair<U1, U2>
+int main()
+{
+ using E = ExplicitTestTypes::TestType;
+ static_assert(!std::is_convertible<E const&, E>::value, "");
+ { // Testing (1)
+ int const x = 42;
+ std::pair t1("abc", x);
+ ASSERT_SAME_TYPE(decltype(t1), std::pair<const char*, int>);
+ }
+ { // Testing (2)
+ std::pair p1(E{}, 42);
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<E, int>);
+
+ const E t{};
+ std::pair p2(t, E{});
+ ASSERT_SAME_TYPE(decltype(p2), std::pair<E, E>);
+ }
+ { // Testing (3, 5)
+ std::pair<double, decltype(nullptr)> const p(0.0, nullptr);
+ std::pair p1(p);
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<double, decltype(nullptr)>);
+ }
+ { // Testing (3, 6)
+ std::pair<E, decltype(nullptr)> const p(E{}, nullptr);
+ std::pair p1(p);
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<E, decltype(nullptr)>);
+ }
+ { // Testing (4, 7)
+ std::pair<std::string, void*> p("abc", nullptr);
+ std::pair p1(std::move(p));
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<std::string, void*>);
+ }
+ { // Testing (4, 8)
+ std::pair<std::string, E> p("abc", E{});
+ std::pair p1(std::move(p));
+ ASSERT_SAME_TYPE(decltype(p1), std::pair<std::string, E>);
+ }
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
index 2856190841c0..f5d3bb621deb 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
@@ -81,7 +81,7 @@ int main()
P1 p1(42, 101);
P2 p2(std::move(p1));
assert(p2.first == 42);
- assert(p2.second = 101);
+ assert(p2.second == 101);
}
{
test_pair_rv<AllCtors, AllCtors>();
diff --git a/test/std/utilities/utility/synopsis.pass.cpp b/test/std/utilities/utility/synopsis.pass.cpp
index 5f5b4eeaad52..009b65cbbe53 100644
--- a/test/std/utilities/utility/synopsis.pass.cpp
+++ b/test/std/utilities/utility/synopsis.pass.cpp
@@ -17,5 +17,6 @@
int main()
{
std::initializer_list<int> x;
+ (void)x;
}
diff --git a/test/std/utilities/variant/variant.get/get_index.pass.cpp b/test/std/utilities/variant/variant.get/get_index.pass.cpp
index 4f04f4a399d7..f52dc5556466 100644
--- a/test/std/utilities/variant/variant.get/get_index.pass.cpp
+++ b/test/std/utilities/variant/variant.get/get_index.pass.cpp
@@ -259,7 +259,7 @@ void test_throws_for_all_value_categories() {
auto test = [](auto idx, auto &&v) {
using Idx = decltype(idx);
try {
- std::get<Idx::value>(std::forward<decltype(v)>(v));
+ TEST_IGNORE_NODISCARD std::get<Idx::value>(std::forward<decltype(v)>(v));
} catch (const std::bad_variant_access &) {
return true;
} catch (...) { /* ... */
diff --git a/test/std/utilities/variant/variant.get/get_type.pass.cpp b/test/std/utilities/variant/variant.get/get_type.pass.cpp
index 63221f69c8f8..0a2222cbf277 100644
--- a/test/std/utilities/variant/variant.get/get_type.pass.cpp
+++ b/test/std/utilities/variant/variant.get/get_type.pass.cpp
@@ -259,7 +259,7 @@ void test_throws_for_all_value_categories() {
auto test = [](auto idx, auto &&v) {
using Idx = decltype(idx);
try {
- std::get<typename Idx::type>(std::forward<decltype(v)>(v));
+ TEST_IGNORE_NODISCARD std::get<typename Idx::type>(std::forward<decltype(v)>(v));
} catch (const std::bad_variant_access &) {
return true;
} catch (...) { /* ... */
diff --git a/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp b/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp
index cbaa2a568d5b..31521dae223c 100644
--- a/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp
+++ b/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp
@@ -28,5 +28,5 @@
int main() {
using V = std::variant<int, void *, const void *, long double>;
- typename std::variant_alternative<4, V>::type foo; // expected-error@variant:* {{Index out of bounds in std::variant_alternative<>}}
+ std::variant_alternative<4, V>::type foo; // expected-error@variant:* {{Index out of bounds in std::variant_alternative<>}}
}
diff --git a/test/std/utilities/variant/variant.visit/visit.pass.cpp b/test/std/utilities/variant/variant.visit/visit.pass.cpp
index 316f2d22b01d..c0db967933b0 100644
--- a/test/std/utilities/variant/variant.visit/visit.pass.cpp
+++ b/test/std/utilities/variant/variant.visit/visit.pass.cpp
@@ -300,7 +300,7 @@ void test_exceptions() {
#endif
}
-// See http://llvm.org/PR31916
+// See https://bugs.llvm.org/show_bug.cgi?id=31916
void test_caller_accepts_nonconst() {
struct A {};
struct Visitor {