|
@@ -80,7 +80,7 @@ void checkThrows(any& a)
|
|
{
|
|
{
|
|
#if !defined(TEST_HAS_NO_EXCEPTIONS)
|
|
#if !defined(TEST_HAS_NO_EXCEPTIONS)
|
|
try {
|
|
try {
|
|
- (void)any_cast<Type>(a);
|
|
|
|
|
|
+ TEST_IGNORE_NODISCARD any_cast<Type>(a);
|
|
assert(false);
|
|
assert(false);
|
|
} catch (bad_any_cast const &) {
|
|
} catch (bad_any_cast const &) {
|
|
// do nothing
|
|
// do nothing
|
|
@@ -89,7 +89,7 @@ void checkThrows(any& a)
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
- (void)any_cast<ConstT>(static_cast<any const&>(a));
|
|
|
|
|
|
+ TEST_IGNORE_NODISCARD any_cast<ConstT>(static_cast<any const&>(a));
|
|
assert(false);
|
|
assert(false);
|
|
} catch (bad_any_cast const &) {
|
|
} catch (bad_any_cast const &) {
|
|
// do nothing
|
|
// do nothing
|
|
@@ -103,7 +103,7 @@ void checkThrows(any& a)
|
|
typename std::remove_reference<Type>::type&&,
|
|
typename std::remove_reference<Type>::type&&,
|
|
Type
|
|
Type
|
|
>::type;
|
|
>::type;
|
|
- (void)any_cast<RefType>(static_cast<any&&>(a));
|
|
|
|
|
|
+ TEST_IGNORE_NODISCARD any_cast<RefType>(static_cast<any&&>(a));
|
|
assert(false);
|
|
assert(false);
|
|
} catch (bad_any_cast const &) {
|
|
} catch (bad_any_cast const &) {
|
|
// do nothing
|
|
// do nothing
|
|
@@ -111,13 +111,13 @@ void checkThrows(any& a)
|
|
assert(false);
|
|
assert(false);
|
|
}
|
|
}
|
|
#else
|
|
#else
|
|
- ((void)a);
|
|
|
|
|
|
+ (TEST_IGNORE_NODISCARD a);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
void test_cast_empty() {
|
|
void test_cast_empty() {
|
|
// None of these operations should allocate.
|
|
// None of these operations should allocate.
|
|
- DisableAllocationGuard g; ((void)g);
|
|
|
|
|
|
+ DisableAllocationGuard g; (TEST_IGNORE_NODISCARD g);
|
|
any a;
|
|
any a;
|
|
checkThrows<int>(a);
|
|
checkThrows<int>(a);
|
|
}
|
|
}
|