Skip to content

Commit 87168cd

Browse files
committed
Addressed comments
1 parent 33f9873 commit 87168cd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

libcxx/include/__flat_map/flat_map.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ class flat_map {
600600
insert(sorted_unique, __il.begin(), __il.end());
601601
}
602602

603-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 containers extract() && {
603+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 containers extract() && {
604604
auto __guard = std::__make_scope_guard([&]() noexcept { clear() /* noexcept */; });
605605
auto __ret = std::move(__containers_);
606606
return __ret;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void test() {
5353
cfm.rbegin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5454
fm.rend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5555
cfm.rend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
56-
cfm.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
56+
cfm.cbegin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5757
cfm.cend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5858
cfm.crbegin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5959
cfm.crend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -62,8 +62,6 @@ void test() {
6262
fm.size(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
6363
fm.max_size(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
6464

65-
fm.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
66-
6765
int key = 0;
6866
TransparentKey<int> tkey;
6967

@@ -77,6 +75,8 @@ void test() {
7775
fm.at(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
7876
cfm.at(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
7977

78+
std::move(fm).extract(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
79+
8080
fm.key_comp(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
8181
fm.value_comp(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
8282
fm.keys(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}

0 commit comments

Comments
 (0)