1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: (c++11 || c++14 || c++17) && !stdlib=libc++
12 // Make sure the various node handles mark their .empty() method with
13 // [[nodiscard]] starting with C++20
17 #include <unordered_map>
18 #include <unordered_set>
20 #include "test_macros.h"
23 #if TEST_STD_VER >= 17
25 std::map
<int, int>::node_type node
;
26 node
.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
29 std::multimap
<int, int>::node_type node
;
30 node
.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
32 #endif // TEST_STD_VER >= 17
35 node
.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
38 std::multiset
<int> node
;
39 node
.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
42 std::unordered_map
<int, int> node
;
43 node
.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
46 std::unordered_multimap
<int, int> node
;
47 node
.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
50 std::unordered_set
<int> node
;
51 node
.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
54 std::unordered_multiset
<int> node
;
55 node
.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}