[libcxx-commits] [libcxx] [libc++][unordered_map] Applied `[[nodiscard]]` (PR #170423)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Sun Dec 14 08:12:18 PST 2025


https://github.com/H-G-Hristov updated https://github.com/llvm/llvm-project/pull/170423

>From 5111324d65140de2c54b3a986aa76d3b33659ce3 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Wed, 3 Dec 2025 07:45:07 +0200
Subject: [PATCH 1/3] [libc++][unordered_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
- https://wg21.link/unord.multimap
---
 libcxx/include/unordered_map                  |  94 +++++++++-------
 .../unord/unord.map/at.abort.pass.cpp         |   2 +-
 .../unord/unord.map/at.const.abort.pass.cpp   |   2 +-
 .../unordered_map.nodiscard.verify.cpp        | 106 ++++++++++++++++--
 4 files changed, 150 insertions(+), 54 deletions(-)

diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 2afc8805cb4c7..1d7d9b29c2e65 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -1034,20 +1034,20 @@ public:
   _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(initializer_list<value_type> __il);
 #  endif // _LIBCPP_CXX03_LANG
 
-  _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
     return allocator_type(__table_.__node_alloc());
   }
 
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
-  _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
-  _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
 
-  _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
-  _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
-  _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
-  _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
-  _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
-  _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
 
   _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __x) { return __table_.__emplace_unique(__x); }
 
@@ -1171,10 +1171,10 @@ public:
                                         "node_type with incompatible allocator passed to unordered_map::insert()");
     return __table_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh));
   }
-  _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
     return __table_.template __node_handle_extract<node_type>(__key);
   }
-  _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
     return __table_.template __node_handle_extract<node_type>(__it.__i_);
   }
 
@@ -1208,79 +1208,91 @@ public:
     __table_.swap(__u.__table_);
   }
 
-  _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function().hash_function(); }
-  _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI hasher hash_function() const {
+    return __table_.hash_function().hash_function();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
 
-  _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
-  _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
 #  if _LIBCPP_STD_VER >= 20
   template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
-  _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
     return __table_.find(__k);
   }
   template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
-  _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
     return __table_.find(__k);
   }
 #  endif // _LIBCPP_STD_VER >= 20
 
-  _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
+    return __table_.__count_unique(__k);
+  }
 #  if _LIBCPP_STD_VER >= 20
   template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
-  _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
     return __table_.__count_unique(__k);
   }
 #  endif // _LIBCPP_STD_VER >= 20
 
 #  if _LIBCPP_STD_VER >= 20
-  _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
 
   template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
-  _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
     return find(__k) != end();
   }
 #  endif // _LIBCPP_STD_VER >= 20
 
-  _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
     return __table_.__equal_range_unique(__k);
   }
-  _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
     return __table_.__equal_range_unique(__k);
   }
 #  if _LIBCPP_STD_VER >= 20
   template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
-  _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
     return __table_.__equal_range_unique(__k);
   }
   template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
-  _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
     return __table_.__equal_range_unique(__k);
   }
 #  endif // _LIBCPP_STD_VER >= 20
 
-  _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
 #  ifndef _LIBCPP_CXX03_LANG
-  _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
 #  endif
 
-  _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
-  _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
 
-  _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
-  _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT {
+    return __table_.max_bucket_count();
+  }
 
-  _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
-  _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const {
+    return __table_.bucket_size(__n);
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
 
-  _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
-  _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
-  _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
-  _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
-  _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
-  _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const {
+    return __table_.cbegin(__n);
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const {
+    return __table_.cbegin(__n);
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
 
-  _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
-  _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
   _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
   _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_unique(__n); }
   _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_unique(__n); }
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
index bd6da6c4d69c9..58771ace284b7 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
@@ -27,6 +27,6 @@
 int main(int, char**) {
   std::signal(SIGABRT, [](int) { std::_Exit(EXIT_SUCCESS); });
   std::unordered_map<int, int> map;
-  map.at(1);
+  (void)map.at(1);
   return EXIT_FAILURE;
 }
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
index badd243dc1264..b185f837dce7f 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
@@ -27,6 +27,6 @@
 int main(int, char**) {
   std::signal(SIGABRT, [](int) { std::_Exit(EXIT_SUCCESS); });
   std::unordered_map<int, int> const map;
-  map.at(1);
+  (void)map.at(1);
   return EXIT_FAILURE;
 }
diff --git a/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
index a5d347e36d80f..36ab53134a583 100644
--- a/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
@@ -6,20 +6,104 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++03
+// REQUIRES: std-at-least-c++11
 
-// check that <unordered_map> functions are marked [[nodiscard]]
-
-// clang-format off
+// Check that functions are marked [[nodiscard]]
 
 #include <unordered_map>
+#include <utility>
 
-void unordered_map_test() {
-  std::unordered_map<int, int> unordered_map;
-  unordered_map.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-}
+#include "test_macros.h"
+
+struct TransparentKey {};
+
+struct StoredKey {
+  friend bool operator==(StoredKey const&, StoredKey const&) { return true; }
+  friend bool operator==(StoredKey const&, TransparentKey const&) { return true; }
+};
+
+struct TransparentKeyHash {
+  using is_transparent = void;
+
+  constexpr std::size_t operator()(TransparentKey const&) const { return 0; }
+  constexpr std::size_t operator()(StoredKey const&) const { return 0; }
+};
+
+void test() {
+  std::unordered_map<int, int> m;
+  const std::unordered_map<int, int> cm;
+
+  m.get_allocator(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  m.empty();    // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.size();     // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.max_size(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  m.begin();   // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.end();     // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.begin();  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.end();    // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.cbegin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.cend();   // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  int key = 0;
+
+#if TEST_STD_VER >= 17
+  m.extract(0);         // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.extract(m.begin()); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+#endif
+
+  m.hash_function(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.key_eq();        // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  m.find(key);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.find(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+#if TEST_STD_VER >= 20
+  std::unordered_map<StoredKey, int, TransparentKeyHash, std::equal_to<>> tm;
+  const std::unordered_map<StoredKey, int, TransparentKeyHash, std::equal_to<>> ctm;
+
+  TransparentKey tkey;
+
+  tm.find(tkey);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  ctm.find(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+#endif
+
+#if TEST_STD_VER >= 20
+  m.count(key);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.count(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  tm.contains(tkey);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  ctm.contains(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+#endif
+
+  m.equal_range(key);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.equal_range(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+#if TEST_STD_VER >= 20
+  tm.equal_range(tkey);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  ctm.equal_range(tkey); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+#endif
+
+  m[key];            // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m[std::move(key)]; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  m.at(key);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.at(key); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  m.bucket_count();     // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.max_bucket_count(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  int size = 0;
+
+  m.bucket_size(size); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.bucket(key);       // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  m.begin(size);   // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.end(size);     // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.begin(size);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.end(size);    // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.cbegin(size); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  cm.cend(size);   // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
 
-void unordered_multimap_test() {
-  std::unordered_multimap<int, int> unordered_multimap;
-  unordered_multimap.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.load_factor();     // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+  m.max_load_factor(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
 }

>From e1711c2ac06f02ff09159497095526f7a4e4e0fc Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hristo.goshev.hristov at gmail.com>
Date: Sun, 14 Dec 2025 18:06:27 +0200
Subject: [PATCH 2/3] Apply suggestion from @H-G-Hristov

---
 .../test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp   | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
index 36ab53134a583..e2711dc4bb8ce 100644
--- a/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// REQUIRES: std-at-least-c++11
 
 // Check that functions are marked [[nodiscard]]
 

>From c32b6e0acfd6f4ee5fbabba7ac4889a4e2a62e0b Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Sun, 14 Dec 2025 18:12:00 +0200
Subject: [PATCH 3/3] Addressed comment

---
 .../test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp   | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
index e2711dc4bb8ce..d6e15ed23b89c 100644
--- a/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 // Check that functions are marked [[nodiscard]]
 
 #include <unordered_map>



More information about the libcxx-commits mailing list