Skip to content

Commit 1915bd8

Browse files
committed
[libc++][flat_map] Applied [[nodiscard]]
`[[nodiscard]]` should be applied to functions where discarding the return value is most likely a correctness issue. - https://libcxx.llvm.org/CodingGuidelines.html#apply-nodiscard-where-relevant
1 parent 6ec6867 commit 1915bd8

File tree

2 files changed

+148
-48
lines changed

2 files changed

+148
-48
lines changed

libcxx/include/__flat_map/flat_map.h

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -409,41 +409,45 @@ class flat_map {
409409
}
410410

411411
// iterators
412-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() noexcept {
412+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() noexcept {
413413
return iterator(__containers_.keys.begin(), __containers_.values.begin());
414414
}
415415

416-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const noexcept {
416+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const noexcept {
417417
return const_iterator(__containers_.keys.begin(), __containers_.values.begin());
418418
}
419419

420-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() noexcept {
420+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() noexcept {
421421
return iterator(__containers_.keys.end(), __containers_.values.end());
422422
}
423423

424-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const noexcept {
424+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const noexcept {
425425
return const_iterator(__containers_.keys.end(), __containers_.values.end());
426426
}
427427

428-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() noexcept {
428+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() noexcept {
429429
return reverse_iterator(end());
430430
}
431-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const noexcept {
431+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const noexcept {
432432
return const_reverse_iterator(end());
433433
}
434-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() noexcept {
434+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() noexcept {
435435
return reverse_iterator(begin());
436436
}
437-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const noexcept {
437+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const noexcept {
438438
return const_reverse_iterator(begin());
439439
}
440440

441-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const noexcept { return begin(); }
442-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const noexcept { return end(); }
443-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const noexcept {
441+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const noexcept {
442+
return begin();
443+
}
444+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const noexcept {
445+
return end();
446+
}
447+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const noexcept {
444448
return const_reverse_iterator(end());
445449
}
446-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const noexcept {
450+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const noexcept {
447451
return const_reverse_iterator(begin());
448452
}
449453

@@ -452,22 +456,22 @@ class flat_map {
452456
return __containers_.keys.empty();
453457
}
454458

455-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const noexcept {
459+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const noexcept {
456460
return __containers_.keys.size();
457461
}
458462

459-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const noexcept {
463+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const noexcept {
460464
return std::min<size_type>(__containers_.keys.max_size(), __containers_.values.max_size());
461465
}
462466

463467
// [flat.map.access], element access
464-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](const key_type& __x)
468+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](const key_type& __x)
465469
requires is_constructible_v<mapped_type>
466470
{
467471
return try_emplace(__x).first->second;
468472
}
469473

470-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](key_type&& __x)
474+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](key_type&& __x)
471475
requires is_constructible_v<mapped_type>
472476
{
473477
return try_emplace(std::move(__x)).first->second;
@@ -480,15 +484,15 @@ class flat_map {
480484
return try_emplace(std::forward<_Kp>(__x)).first->second;
481485
}
482486

483-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const key_type& __x) {
487+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const key_type& __x) {
484488
auto __it = find(__x);
485489
if (__it == end()) {
486490
std::__throw_out_of_range("flat_map::at(const key_type&): Key does not exist");
487491
}
488492
return __it->second;
489493
}
490494

491-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(const key_type& __x) const {
495+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(const key_type& __x) const {
492496
auto __it = find(__x);
493497
if (__it == end()) {
494498
std::__throw_out_of_range("flat_map::at(const key_type&) const: Key does not exist");
@@ -498,7 +502,7 @@ class flat_map {
498502

499503
template <class _Kp>
500504
requires __is_compare_transparent
501-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const _Kp& __x) {
505+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const _Kp& __x) {
502506
auto __it = find(__x);
503507
if (__it == end()) {
504508
std::__throw_out_of_range("flat_map::at(const K&): Key does not exist");
@@ -508,7 +512,7 @@ class flat_map {
508512

509513
template <class _Kp>
510514
requires __is_compare_transparent
511-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(const _Kp& __x) const {
515+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(const _Kp& __x) const {
512516
auto __it = find(__x);
513517
if (__it == end()) {
514518
std::__throw_out_of_range("flat_map::at(const K&) const: Key does not exist");
@@ -753,116 +757,121 @@ class flat_map {
753757
}
754758

755759
// observers
756-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { return __compare_; }
757-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
760+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const { return __compare_; }
761+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
758762
return value_compare(__compare_);
759763
}
760764

761-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const key_container_type& keys() const noexcept {
765+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const key_container_type& keys() const noexcept {
762766
return __containers_.keys;
763767
}
764-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_container_type& values() const noexcept {
768+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_container_type&
769+
values() const noexcept {
765770
return __containers_.values;
766771
}
767772

768773
// map operations
769-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __x) {
774+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __x) {
770775
return __find_impl(*this, __x);
771776
}
772777

773-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __x) const {
778+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __x) const {
774779
return __find_impl(*this, __x);
775780
}
776781

777782
template <class _Kp>
778783
requires __is_compare_transparent
779-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Kp& __x) {
784+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Kp& __x) {
780785
return __find_impl(*this, __x);
781786
}
782787

783788
template <class _Kp>
784789
requires __is_compare_transparent
785-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Kp& __x) const {
790+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Kp& __x) const {
786791
return __find_impl(*this, __x);
787792
}
788793

789-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __x) const {
794+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __x) const {
790795
return contains(__x) ? 1 : 0;
791796
}
792797

793798
template <class _Kp>
794799
requires __is_compare_transparent
795-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _Kp& __x) const {
800+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _Kp& __x) const {
796801
return contains(__x) ? 1 : 0;
797802
}
798803

799-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __x) const {
804+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __x) const {
800805
return find(__x) != end();
801806
}
802807

803808
template <class _Kp>
804809
requires __is_compare_transparent
805-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _Kp& __x) const {
810+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _Kp& __x) const {
806811
return find(__x) != end();
807812
}
808813

809-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __x) {
814+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __x) {
810815
return __lower_bound<iterator>(*this, __x);
811816
}
812817

813-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const key_type& __x) const {
818+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
819+
lower_bound(const key_type& __x) const {
814820
return __lower_bound<const_iterator>(*this, __x);
815821
}
816822

817823
template <class _Kp>
818824
requires __is_compare_transparent
819-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Kp& __x) {
825+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Kp& __x) {
820826
return __lower_bound<iterator>(*this, __x);
821827
}
822828

823829
template <class _Kp>
824830
requires __is_compare_transparent
825-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Kp& __x) const {
831+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Kp& __x) const {
826832
return __lower_bound<const_iterator>(*this, __x);
827833
}
828834

829-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __x) {
835+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __x) {
830836
return __upper_bound<iterator>(*this, __x);
831837
}
832838

833-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const key_type& __x) const {
839+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
840+
upper_bound(const key_type& __x) const {
834841
return __upper_bound<const_iterator>(*this, __x);
835842
}
836843

837844
template <class _Kp>
838845
requires __is_compare_transparent
839-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Kp& __x) {
846+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Kp& __x) {
840847
return __upper_bound<iterator>(*this, __x);
841848
}
842849

843850
template <class _Kp>
844851
requires __is_compare_transparent
845-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Kp& __x) const {
852+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Kp& __x) const {
846853
return __upper_bound<const_iterator>(*this, __x);
847854
}
848855

849-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __x) {
856+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
857+
equal_range(const key_type& __x) {
850858
return __equal_range_impl(*this, __x);
851859
}
852860

853-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
861+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
854862
equal_range(const key_type& __x) const {
855863
return __equal_range_impl(*this, __x);
856864
}
857865

858866
template <class _Kp>
859867
requires __is_compare_transparent
860-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _Kp& __x) {
868+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
869+
equal_range(const _Kp& __x) {
861870
return __equal_range_impl(*this, __x);
862871
}
863872
template <class _Kp>
864873
requires __is_compare_transparent
865-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
874+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
866875
equal_range(const _Kp& __x) const {
867876
return __equal_range_impl(*this, __x);
868877
}

libcxx/test/libcxx/diagnostics/flat_map.nodiscard.verify.cpp

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,106 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
9+
// REQUIRES: std-at-least-c++23
1010

1111
// <flat_map>
1212

1313
// [[nodiscard]] bool empty() const noexcept;
1414

1515
#include <flat_map>
16+
#include <utility>
1617

17-
void f() {
18-
std::flat_map<int, int> c;
19-
c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
18+
template <typename T>
19+
struct Transparent {
20+
T t;
21+
};
22+
23+
struct TransparentCompare {
24+
using is_transparent = void; // This makes the comparator transparent
25+
26+
template <typename T>
27+
constexpr bool operator()(const T& t, const Transparent<T>& transparent) const {
28+
return t < transparent.t;
29+
}
30+
31+
template <typename T>
32+
constexpr bool operator()(const Transparent<T>& transparent, const T& t) const {
33+
return transparent.t < t;
34+
}
35+
36+
template <typename T>
37+
constexpr bool operator()(const T& t1, const T& t2) const {
38+
return t1 < t2;
39+
}
40+
};
41+
42+
void test() {
43+
std::flat_map<int, int> fm;
44+
const std::flat_map<int, int> cfm{};
45+
46+
fm.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
47+
cfm.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
48+
fm.end(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
49+
cfm.end(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
50+
fm.rbegin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
51+
cfm.rbegin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
52+
fm.rend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
53+
cfm.rend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
54+
cfm.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
55+
cfm.cend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
56+
cfm.crbegin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
57+
cfm.crend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
58+
59+
fm.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
60+
fm.size(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
61+
fm.max_size(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
62+
63+
fm.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
64+
65+
int key = 0;
66+
67+
fm[key]; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
68+
fm[std::move(key)]; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
69+
70+
std::flat_map<int, int, TransparentCompare> tfm;
71+
const std::flat_map<int, int, TransparentCompare> ctfm{};
72+
Transparent<int> tkey;
73+
74+
fm.at(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
75+
cfm.at(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
76+
tfm.at(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
77+
ctfm.at(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
78+
79+
fm.key_comp(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
80+
fm.value_comp(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
81+
fm.keys(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
82+
fm.values(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
83+
84+
fm.find(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
85+
cfm.find(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
86+
tfm.find(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
87+
ctfm.find(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
88+
89+
fm.count(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
90+
tfm.count(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
91+
92+
fm.contains(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
93+
cfm.contains(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
94+
tfm.contains(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
95+
ctfm.contains(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
96+
97+
fm.lower_bound(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
98+
cfm.lower_bound(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
99+
tfm.lower_bound(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
100+
ctfm.lower_bound(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
101+
102+
fm.upper_bound(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
103+
cfm.upper_bound(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
104+
tfm.upper_bound(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
105+
ctfm.upper_bound(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
106+
107+
fm.equal_range(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
108+
cfm.equal_range(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
109+
tfm.equal_range(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
110+
ctfm.equal_range(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
20111
}

0 commit comments

Comments
 (0)