[libcxx-commits] [libcxx] [libc++] Update container adaptors' type verification tests (PR #224810)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Sat Sep 19 04:42:08 PDT 2026


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

>From 881a5dd03c1567492516f27edabd605adbd4c07a Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Fri, 18 Sep 2026 10:18:31 +0300
Subject: [PATCH 1/3] [libc++] Update container adaptor tests

1. Improves the error message for LWG2566.
2. Converts compile.fail.cpp tests to verify.cpp tests.
3. Updates tests.
4. Removes redundant tests.

References:
- https://wg21.link/lwg2566
- https://wg21.link/containers.adaptors
---
 libcxx/include/__flat_map/flat_map.h          |  6 ++--
 libcxx/include/__flat_map/flat_multimap.h     |  6 ++--
 libcxx/include/__flat_set/flat_multiset.h     |  3 +-
 libcxx/include/__flat_set/flat_set.h          |  3 +-
 libcxx/include/queue                          |  6 ++--
 libcxx/include/stack                          |  3 +-
 .../flat.map/types.verify.cpp                 | 33 +++++++++++++++++
 .../flat.multimap/types.verify.cpp            | 33 +++++++++++++++++
 .../flat.multiset/types.verify.cpp            | 26 ++++++++++++++
 .../flat.set/types.verify.cpp                 | 26 ++++++++++++++
 .../priqueue.members/empty.verify.cpp         | 22 ------------
 ...ypes.compile.fail.cpp => types.verify.cpp} |  6 ++--
 .../queue/queue.defn/types.compile.fail.cpp   | 20 -----------
 .../{empty.verify.cpp => types.verify.cpp}    | 11 +++---
 .../stack/stack.defn/types.compile.fail.cpp   | 35 -------------------
 .../{empty.verify.cpp => types.verify.cpp}    | 11 +++---
 16 files changed, 146 insertions(+), 104 deletions(-)
 create mode 100644 libcxx/test/std/containers/container.adaptors/flat.map/types.verify.cpp
 create mode 100644 libcxx/test/std/containers/container.adaptors/flat.multimap/types.verify.cpp
 create mode 100644 libcxx/test/std/containers/container.adaptors/flat.multiset/types.verify.cpp
 create mode 100644 libcxx/test/std/containers/container.adaptors/flat.set/types.verify.cpp
 delete mode 100644 libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.verify.cpp
 rename libcxx/test/std/containers/container.adaptors/priority.queue/{types.compile.fail.cpp => types.verify.cpp} (74%)
 delete mode 100644 libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.compile.fail.cpp
 rename libcxx/test/std/containers/container.adaptors/queue/queue.defn/{empty.verify.cpp => types.verify.cpp} (62%)
 delete mode 100644 libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.compile.fail.cpp
 rename libcxx/test/std/containers/container.adaptors/stack/stack.defn/{empty.verify.cpp => types.verify.cpp} (62%)

diff --git a/libcxx/include/__flat_map/flat_map.h b/libcxx/include/__flat_map/flat_map.h
index 50487cada24c0..6934a1e10c421 100644
--- a/libcxx/include/__flat_map/flat_map.h
+++ b/libcxx/include/__flat_map/flat_map.h
@@ -85,8 +85,10 @@ class flat_map {
   template <class, class, class, class, class>
   friend class flat_map;
 
-  static_assert(is_same_v<_Key, typename _KeyContainer::value_type>);
-  static_assert(is_same_v<_Tp, typename _MappedContainer::value_type>);
+  static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
+                "The stored elements key type must match the underlying container's key value_type.");
+  static_assert(is_same_v<_Tp, typename _MappedContainer::value_type>,
+                "The stored elements mapped type must match the underlying container's mapped value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
   static_assert(!is_same_v<_MappedContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
diff --git a/libcxx/include/__flat_map/flat_multimap.h b/libcxx/include/__flat_map/flat_multimap.h
index bd3ec81b98b7f..6b0afb6ce5727 100644
--- a/libcxx/include/__flat_map/flat_multimap.h
+++ b/libcxx/include/__flat_map/flat_multimap.h
@@ -82,8 +82,10 @@ class flat_multimap {
   template <class, class, class, class, class>
   friend class flat_multimap;
 
-  static_assert(is_same_v<_Key, typename _KeyContainer::value_type>);
-  static_assert(is_same_v<_Tp, typename _MappedContainer::value_type>);
+  static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
+                "The stored elements key type must match the underlying container's key value_type.");
+  static_assert(is_same_v<_Tp, typename _MappedContainer::value_type>,
+                "The stored elements mapped type must match the underlying container's mapped value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
   static_assert(!is_same_v<_MappedContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
diff --git a/libcxx/include/__flat_set/flat_multiset.h b/libcxx/include/__flat_set/flat_multiset.h
index 4324645fb8445..27e37313e5301 100644
--- a/libcxx/include/__flat_set/flat_multiset.h
+++ b/libcxx/include/__flat_set/flat_multiset.h
@@ -74,7 +74,8 @@ class flat_multiset {
 
   friend __flat_set_utils;
 
-  static_assert(is_same_v<_Key, typename _KeyContainer::value_type>);
+  static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
+                "The stored elements key type must match the underlying container's key value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
 public:
diff --git a/libcxx/include/__flat_set/flat_set.h b/libcxx/include/__flat_set/flat_set.h
index 57c3926e33b68..0f448b6eea7d1 100644
--- a/libcxx/include/__flat_set/flat_set.h
+++ b/libcxx/include/__flat_set/flat_set.h
@@ -76,7 +76,8 @@ class flat_set {
 
   friend __flat_set_utils;
 
-  static_assert(is_same_v<_Key, typename _KeyContainer::value_type>);
+  static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
+                "The stored elements key type must match the underlying container's key value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
   using __key_iterator _LIBCPP_NODEBUG = typename _KeyContainer::const_iterator;
diff --git a/libcxx/include/queue b/libcxx/include/queue
index 1e46cd4e8cbb4..cd14423b407ab 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -306,7 +306,8 @@ public:
   typedef typename container_type::reference reference;
   typedef typename container_type::const_reference const_reference;
   typedef typename container_type::size_type size_type;
-  static_assert(is_same<_Tp, value_type>::value, "");
+  static_assert(is_same<_Tp, value_type>::value,
+                "The stored elements type must match the underlying container's value_type.");
 
 protected:
   container_type c;
@@ -524,7 +525,8 @@ public:
   typedef typename container_type::reference reference;
   typedef typename container_type::const_reference const_reference;
   typedef typename container_type::size_type size_type;
-  static_assert(is_same<_Tp, value_type>::value, "");
+  static_assert(is_same<_Tp, value_type>::value,
+                "The stored elements type must match the underlying container's value_type.");
 
 protected:
   container_type c;
diff --git a/libcxx/include/stack b/libcxx/include/stack
index 7b3fcf17bf624..51e2cee85ac2a 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -160,7 +160,8 @@ public:
   typedef typename container_type::reference reference;
   typedef typename container_type::const_reference const_reference;
   typedef typename container_type::size_type size_type;
-  static_assert(is_same<_Tp, value_type>::value, "");
+  static_assert(is_same<_Tp, value_type>::value,
+                "The stored elements type must match the underlying container's value_type.");
 
 protected:
   container_type c;
diff --git a/libcxx/test/std/containers/container.adaptors/flat.map/types.verify.cpp b/libcxx/test/std/containers/container.adaptors/flat.map/types.verify.cpp
new file mode 100644
index 0000000000000..4227fe5f635a1
--- /dev/null
+++ b/libcxx/test/std/containers/container.adaptors/flat.map/types.verify.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++23
+
+// <flat_map>
+
+//  template<class Key, class T, class Compare = less<Key>,
+//           class KeyContainer = vector<Key>, class MappedContainer = vector<T>>
+//    class flat_map;
+
+#include <flat_map>
+#include <functional>
+#include <vector>
+
+void test() {
+  // expected-error-re@*:* {{static assertion failed{{.*}}The stored elements key type must match the underlying container's key value_type.}}
+  std::flat_map<double, int, std::less<double>, std::vector<char>> fm1;
+
+  // expected-error-re@*:* {{static assertion failed{{.*}}The stored elements mapped type must match the underlying container's mapped value_type.}}
+  std::flat_map<int, double, std::less<int>, std::vector<int>, std::vector<char>> fm2;
+
+  // expected-error-re@*:* {{static assertion failed{{.*}}vector<bool> is not a sequence container}}
+  std::flat_map<bool, int, std::less<bool>, std::vector<bool>> fm3;
+
+  // expected-error-re@*:* {{static assertion failed{{.*}}vector<bool> is not a sequence container}}
+  std::flat_map<int, bool, std::less<int>, std::vector<int>, std::vector<bool>> fm4;
+}
diff --git a/libcxx/test/std/containers/container.adaptors/flat.multimap/types.verify.cpp b/libcxx/test/std/containers/container.adaptors/flat.multimap/types.verify.cpp
new file mode 100644
index 0000000000000..a3b73fff331b6
--- /dev/null
+++ b/libcxx/test/std/containers/container.adaptors/flat.multimap/types.verify.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++23
+
+// <flat_map>
+
+//  template<class Key, class T, class Compare = less<Key>,
+//           class KeyContainer = vector<Key>, class MappedContainer = vector<T>>
+//    class flat_multimap;
+
+#include <flat_map>
+#include <functional>
+#include <vector>
+
+void test_flat_multimap() {
+  // expected-error-re@*:* {{static assertion failed{{.*}}The stored elements key type must match the underlying container's key value_type.}}
+  std::flat_multimap<double, int, std::less<double>, std::vector<char>> fmm1;
+
+  // expected-error-re@*:* {{static assertion failed{{.*}}The stored elements mapped type must match the underlying container's mapped value_type.}}
+  std::flat_multimap<int, double, std::less<int>, std::vector<int>, std::vector<char>> fmm2;
+
+  // expected-error-re@*:* {{static assertion failed{{.*}}vector<bool> is not a sequence container}}
+  std::flat_multimap<bool, int, std::less<bool>, std::vector<bool>> fmm3;
+
+  // expected-error-re@*:* {{static assertion failed{{.*}}vector<bool> is not a sequence container}}
+  std::flat_multimap<int, bool, std::less<int>, std::vector<int>, std::vector<bool>> fmm4;
+}
diff --git a/libcxx/test/std/containers/container.adaptors/flat.multiset/types.verify.cpp b/libcxx/test/std/containers/container.adaptors/flat.multiset/types.verify.cpp
new file mode 100644
index 0000000000000..d837af3abae24
--- /dev/null
+++ b/libcxx/test/std/containers/container.adaptors/flat.multiset/types.verify.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++23
+
+// <flat_set>
+
+//  template<class Key, class Compare = less<Key>, class KeyContainer = vector<Key>>
+//    class flat_multiset;
+
+#include <flat_set>
+#include <functional>
+#include <vector>
+
+void test_flat_multiset() {
+  // expected-error-re@*:* {{static assertion failed{{.*}}The stored elements key type must match the underlying container's key value_type.}}
+  std::flat_multiset<double, std::less<double>, std::vector<int>> fms1;
+
+  // expected-error-re@*:* {{static assertion failed{{.*}}vector<bool> is not a sequence container}}
+  std::flat_multiset<bool, std::less<bool>, std::vector<bool>> fms2;
+}
diff --git a/libcxx/test/std/containers/container.adaptors/flat.set/types.verify.cpp b/libcxx/test/std/containers/container.adaptors/flat.set/types.verify.cpp
new file mode 100644
index 0000000000000..c8a58360db1ad
--- /dev/null
+++ b/libcxx/test/std/containers/container.adaptors/flat.set/types.verify.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++23
+
+// <flat_set>
+
+//  template<class Key, class Compare = less<Key>, class KeyContainer = vector<Key>>
+//    class flat_set;
+
+#include <flat_set>
+#include <functional>
+#include <vector>
+
+void test_flat_set() {
+  // expected-error-re@*:* {{static assertion failed{{.*}}The stored elements key type must match the underlying container's key value_type.}}
+  std::flat_set<double, std::less<double>, std::vector<int>> fs1;
+
+  // expected-error-re@*:* {{static assertion failed{{.*}}vector<bool> is not a sequence container}}
+  std::flat_set<bool, std::less<bool>, std::vector<bool>> fs2;
+}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.verify.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.verify.cpp
deleted file mode 100644
index 5202710846e8b..0000000000000
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.verify.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <queue>
-
-// class priority_queue
-
-// bool empty() const noexcept;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
-#include <queue>
-
-void f() {
-  std::priority_queue<int> c;
-  c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/types.verify.cpp
similarity index 74%
rename from libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp
rename to libcxx/test/std/containers/container.adaptors/priority.queue/types.verify.cpp
index 3dce083537318..ffca78965fc26 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/types.verify.cpp
@@ -13,10 +13,8 @@
 // class priority_queue
 
 #include <queue>
-#include <cassert>
-#include <type_traits>
 
 void test() {
-  //  LWG#2566 says that the first template param must match the second one's value type
-  std::priority_queue<double, std::deque<int>> t;
+  // expected-error-re@*:* {{static assertion failed{{.*}}{{(The stored elements type must match the underlying container's value_type\.)?}}}}
+  std::priority_queue<double, std::deque<int> > pq;
 }
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.compile.fail.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.compile.fail.cpp
deleted file mode 100644
index daec08ef62bc6..0000000000000
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.compile.fail.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <queue>
-
-#include <queue>
-#include <cassert>
-#include <type_traits>
-
-int main(int, char**) {
-  //  LWG#2566 says that the first template param must match the second one's value type
-  std::queue<double, std::deque<int>> t;
-
-  return 0;
-}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.verify.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.verify.cpp
similarity index 62%
rename from libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.verify.cpp
rename to libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.verify.cpp
index 27c99b0f379e9..9c149d6329e0b 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.verify.cpp
@@ -8,15 +8,12 @@
 
 // <queue>
 
+// template <class T, class Container = deque<T>>
 // class queue
 
-// bool empty() const noexcept;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
 #include <queue>
 
-void f() {
-  std::queue<int> c;
-  c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+void test() {
+  // expected-error-re@*:* {{static assertion failed{{.*}}{{(The stored elements type must match the underlying container's value_type\.)?}}}}
+  std::queue<double, std::deque<int> > qu;
 }
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.compile.fail.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.compile.fail.cpp
deleted file mode 100644
index ddccbe090afe2..0000000000000
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.compile.fail.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <queue>
-
-// template <class T, class Container = vector<T>,
-//           class Compare = less<typename Container::value_type>>
-// class priority_queue
-// {
-// public:
-//     typedef Container                                container_type;
-//     typedef typename container_type::value_type      value_type;
-//     typedef typename container_type::reference       reference;
-//     typedef typename container_type::const_reference const_reference;
-//     typedef typename container_type::size_type       size_type;
-//
-// protected:
-//     container_type c;
-//     Compare comp;
-
-#include <stack>
-#include <cassert>
-#include <type_traits>
-
-int main(int, char**) {
-  //  LWG#2566 says that the first template param must match the second one's value type
-  std::stack<double, std::deque<int>> t;
-
-  return 0;
-}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.verify.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.verify.cpp
similarity index 62%
rename from libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.verify.cpp
rename to libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.verify.cpp
index 9100bc2a03e06..a1a8ff15b40a7 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.verify.cpp
@@ -8,15 +8,12 @@
 
 // <stack>
 
+// template <class T, class Container = deque<T>>
 // class stack
 
-// bool empty() const noexcept;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
 #include <stack>
 
-void f() {
-  std::stack<int> c;
-  c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+void test() {
+  // expected-error-re@*:* {{static assertion failed{{.*}}{{(The stored elements type must match the underlying container's value_type\.)?}}}}
+  std::stack<double, std::deque<int> > st;
 }

>From e47b02d8521ff47cdee9360a2045adcbb1443a39 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <zingam at outlook.com>
Date: Sat, 19 Sep 2026 14:38:36 +0300
Subject: [PATCH 2/3] Apply batched suggestions from code review

Co-authored-by: A. Jiang <de34 at live.cn>
---
 libcxx/include/__flat_map/flat_map.h      | 4 ++--
 libcxx/include/__flat_map/flat_multimap.h | 4 ++--
 libcxx/include/__flat_set/flat_multiset.h | 2 +-
 libcxx/include/__flat_set/flat_set.h      | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libcxx/include/__flat_map/flat_map.h b/libcxx/include/__flat_map/flat_map.h
index 6934a1e10c421..6c5afd3511354 100644
--- a/libcxx/include/__flat_map/flat_map.h
+++ b/libcxx/include/__flat_map/flat_map.h
@@ -86,9 +86,9 @@ class flat_map {
   friend class flat_map;
 
   static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
-                "The stored elements key type must match the underlying container's key value_type.");
+                "The stored elements key type must match the underlying key container's value_type.");
   static_assert(is_same_v<_Tp, typename _MappedContainer::value_type>,
-                "The stored elements mapped type must match the underlying container's mapped value_type.");
+                "The stored elements mapped type must match the underlying mapped container's value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
   static_assert(!is_same_v<_MappedContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
diff --git a/libcxx/include/__flat_map/flat_multimap.h b/libcxx/include/__flat_map/flat_multimap.h
index 6b0afb6ce5727..a89aba02a824e 100644
--- a/libcxx/include/__flat_map/flat_multimap.h
+++ b/libcxx/include/__flat_map/flat_multimap.h
@@ -83,9 +83,9 @@ class flat_multimap {
   friend class flat_multimap;
 
   static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
-                "The stored elements key type must match the underlying container's key value_type.");
+                "The stored elements key type must match the underlying key container's value_type.");
   static_assert(is_same_v<_Tp, typename _MappedContainer::value_type>,
-                "The stored elements mapped type must match the underlying container's mapped value_type.");
+                "The stored elements mapped type must match the underlying mapped container's value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
   static_assert(!is_same_v<_MappedContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
diff --git a/libcxx/include/__flat_set/flat_multiset.h b/libcxx/include/__flat_set/flat_multiset.h
index 27e37313e5301..0d857fae2aece 100644
--- a/libcxx/include/__flat_set/flat_multiset.h
+++ b/libcxx/include/__flat_set/flat_multiset.h
@@ -75,7 +75,7 @@ class flat_multiset {
   friend __flat_set_utils;
 
   static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
-                "The stored elements key type must match the underlying container's key value_type.");
+                "The stored elements key type must match the underlying key container's value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
 public:
diff --git a/libcxx/include/__flat_set/flat_set.h b/libcxx/include/__flat_set/flat_set.h
index 0f448b6eea7d1..558c81aa92ef1 100644
--- a/libcxx/include/__flat_set/flat_set.h
+++ b/libcxx/include/__flat_set/flat_set.h
@@ -77,7 +77,7 @@ class flat_set {
   friend __flat_set_utils;
 
   static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
-                "The stored elements key type must match the underlying container's key value_type.");
+                "The stored elements key type must match the underlying key container's value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
   using __key_iterator _LIBCPP_NODEBUG = typename _KeyContainer::const_iterator;

>From d961b83c9113765525b5e700ce77724e219c3e41 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Sat, 19 Sep 2026 14:41:48 +0300
Subject: [PATCH 3/3] Addressed more review comments

---
 libcxx/include/__flat_map/flat_map.h                          | 4 ++--
 libcxx/include/__flat_map/flat_multimap.h                     | 4 ++--
 libcxx/include/__flat_set/flat_multiset.h                     | 2 +-
 libcxx/include/__flat_set/flat_set.h                          | 2 +-
 .../container.adaptors/flat.multimap/types.verify.cpp         | 2 +-
 .../container.adaptors/flat.multiset/types.verify.cpp         | 2 +-
 .../containers/container.adaptors/flat.set/types.verify.cpp   | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libcxx/include/__flat_map/flat_map.h b/libcxx/include/__flat_map/flat_map.h
index 6c5afd3511354..6934a1e10c421 100644
--- a/libcxx/include/__flat_map/flat_map.h
+++ b/libcxx/include/__flat_map/flat_map.h
@@ -86,9 +86,9 @@ class flat_map {
   friend class flat_map;
 
   static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
-                "The stored elements key type must match the underlying key container's value_type.");
+                "The stored elements key type must match the underlying container's key value_type.");
   static_assert(is_same_v<_Tp, typename _MappedContainer::value_type>,
-                "The stored elements mapped type must match the underlying mapped container's value_type.");
+                "The stored elements mapped type must match the underlying container's mapped value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
   static_assert(!is_same_v<_MappedContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
diff --git a/libcxx/include/__flat_map/flat_multimap.h b/libcxx/include/__flat_map/flat_multimap.h
index a89aba02a824e..6b0afb6ce5727 100644
--- a/libcxx/include/__flat_map/flat_multimap.h
+++ b/libcxx/include/__flat_map/flat_multimap.h
@@ -83,9 +83,9 @@ class flat_multimap {
   friend class flat_multimap;
 
   static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
-                "The stored elements key type must match the underlying key container's value_type.");
+                "The stored elements key type must match the underlying container's key value_type.");
   static_assert(is_same_v<_Tp, typename _MappedContainer::value_type>,
-                "The stored elements mapped type must match the underlying mapped container's value_type.");
+                "The stored elements mapped type must match the underlying container's mapped value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
   static_assert(!is_same_v<_MappedContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
diff --git a/libcxx/include/__flat_set/flat_multiset.h b/libcxx/include/__flat_set/flat_multiset.h
index 0d857fae2aece..206edf7984adf 100644
--- a/libcxx/include/__flat_set/flat_multiset.h
+++ b/libcxx/include/__flat_set/flat_multiset.h
@@ -75,7 +75,7 @@ class flat_multiset {
   friend __flat_set_utils;
 
   static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
-                "The stored elements key type must match the underlying key container's value_type.");
+                "The stored elements key type must match the underlying container's keyvalue_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
 public:
diff --git a/libcxx/include/__flat_set/flat_set.h b/libcxx/include/__flat_set/flat_set.h
index 558c81aa92ef1..0f448b6eea7d1 100644
--- a/libcxx/include/__flat_set/flat_set.h
+++ b/libcxx/include/__flat_set/flat_set.h
@@ -77,7 +77,7 @@ class flat_set {
   friend __flat_set_utils;
 
   static_assert(is_same_v<_Key, typename _KeyContainer::value_type>,
-                "The stored elements key type must match the underlying key container's value_type.");
+                "The stored elements key type must match the underlying container's key value_type.");
   static_assert(!is_same_v<_KeyContainer, std::vector<bool>>, "vector<bool> is not a sequence container");
 
   using __key_iterator _LIBCPP_NODEBUG = typename _KeyContainer::const_iterator;
diff --git a/libcxx/test/std/containers/container.adaptors/flat.multimap/types.verify.cpp b/libcxx/test/std/containers/container.adaptors/flat.multimap/types.verify.cpp
index a3b73fff331b6..dba6f6882e6b7 100644
--- a/libcxx/test/std/containers/container.adaptors/flat.multimap/types.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/flat.multimap/types.verify.cpp
@@ -18,7 +18,7 @@
 #include <functional>
 #include <vector>
 
-void test_flat_multimap() {
+void test() {
   // expected-error-re@*:* {{static assertion failed{{.*}}The stored elements key type must match the underlying container's key value_type.}}
   std::flat_multimap<double, int, std::less<double>, std::vector<char>> fmm1;
 
diff --git a/libcxx/test/std/containers/container.adaptors/flat.multiset/types.verify.cpp b/libcxx/test/std/containers/container.adaptors/flat.multiset/types.verify.cpp
index d837af3abae24..8a654ba641d7a 100644
--- a/libcxx/test/std/containers/container.adaptors/flat.multiset/types.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/flat.multiset/types.verify.cpp
@@ -17,7 +17,7 @@
 #include <functional>
 #include <vector>
 
-void test_flat_multiset() {
+void test() {
   // expected-error-re@*:* {{static assertion failed{{.*}}The stored elements key type must match the underlying container's key value_type.}}
   std::flat_multiset<double, std::less<double>, std::vector<int>> fms1;
 
diff --git a/libcxx/test/std/containers/container.adaptors/flat.set/types.verify.cpp b/libcxx/test/std/containers/container.adaptors/flat.set/types.verify.cpp
index c8a58360db1ad..c0de9ab85e0b3 100644
--- a/libcxx/test/std/containers/container.adaptors/flat.set/types.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/flat.set/types.verify.cpp
@@ -17,7 +17,7 @@
 #include <functional>
 #include <vector>
 
-void test_flat_set() {
+void test() {
   // expected-error-re@*:* {{static assertion failed{{.*}}The stored elements key type must match the underlying container's key value_type.}}
   std::flat_set<double, std::less<double>, std::vector<int>> fs1;
 



More information about the libcxx-commits mailing list