[libcxx][test] Silence nodiscard warnings (#154622)
MSVC's STL marks `std::make_shared`, `std::allocate_shared`, `std::bitset::to_ulong`, and `std::bitset::to_ullong` as `[[nodiscard]]`, which causes these libcxx tests to emit righteous warnings. They should use the traditional `(void)` cast technique to ignore the return values.
This commit is contained in:
parent
b69fd34e76
commit
f60ff00939
@ -20,11 +20,11 @@
|
||||
#include <memory>
|
||||
|
||||
int main(int, char**) {
|
||||
std::allocate_shared<int[]>(std::allocator<int>{}, 10);
|
||||
std::make_shared<int[]>(10);
|
||||
(void)std::allocate_shared<int[]>(std::allocator<int>{}, 10);
|
||||
(void)std::make_shared<int[]>(10);
|
||||
|
||||
std::allocate_shared<int[10]>(std::allocator<int>{});
|
||||
std::make_shared<int[10]>();
|
||||
(void)std::allocate_shared<int[10]>(std::allocator<int>{});
|
||||
(void)std::make_shared<int[10]>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ TEST_CONSTEXPR_CXX23 bool test() {
|
||||
std::bitset<std::numeric_limits<unsigned long long>::digits + 1> q(0);
|
||||
q.flip();
|
||||
try {
|
||||
q.to_ullong(); // throws
|
||||
(void)q.to_ullong(); // throws
|
||||
assert(false);
|
||||
} catch (const std::overflow_error&) {
|
||||
// expected
|
||||
|
@ -64,7 +64,7 @@ TEST_CONSTEXPR_CXX23 bool test() {
|
||||
std::bitset<std::numeric_limits<unsigned long>::digits + 1> q(0);
|
||||
q.flip();
|
||||
try {
|
||||
q.to_ulong(); // throws
|
||||
(void)q.to_ulong(); // throws
|
||||
assert(false);
|
||||
} catch (const std::overflow_error&) {
|
||||
// expected
|
||||
|
Loading…
x
Reference in New Issue
Block a user