66//
77// ===----------------------------------------------------------------------===//
88
9- // UNSUPPORTED: c++03
10-
119// <bitset>
1210
1311// Check that functions are marked [[nodiscard]]
1816#include " test_allocator.h"
1917
2018void test () {
21- std::bitset<10 > bs;
22- const std::bitset<10 > cbs;
19+ std::bitset<11 > bs;
20+ const std::bitset<11 > cbs;
2321
2422 // std::bitset<>::reference operator~() const noexcept;
2523 ~bs[0 ]; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -34,7 +32,7 @@ void test() {
3432 struct CharTraits : public std ::char_traits<char > {};
3533
3634 // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}}
37- bs.to_string <char , CharTraits, test_allocator<char >>();
35+ bs.to_string <char , CharTraits, test_allocator<char > >();
3836 // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}}
3937 bs.to_string <char , CharTraits>();
4038#if !defined(TEST_HAS_NO_WIDE_CHARACTERS)
@@ -52,4 +50,12 @@ void test() {
5250 bs.none (); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5351 bs << 1 ; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5452 bs >> 1 ; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
53+
54+ bs & bs; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
55+ bs | bs; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
56+ bs ^ bs; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
57+
58+ std::hash<std::bitset<11 > > hash;
59+
60+ hash (bs); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5561}
0 commit comments