[libcxx-commits] [libcxx] [libc++] constexpr flat_map (PR #137453)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 20 11:09:43 PDT 2025


================
@@ -145,23 +89,26 @@ int main(int, char**) {
     ASSERT_SAME_TYPE(decltype(m.insert(m.begin(), Evil())), M::iterator);
     ASSERT_SAME_TYPE(decltype(m.insert(m.begin(), m.end())), void);
   }
-  {
-    auto insert_func = [](auto& m, auto key_arg, auto value_arg) {
-      using FlatMap    = std::decay_t<decltype(m)>;
-      using tuple_type = std::tuple<typename FlatMap::key_type, typename FlatMap::mapped_type>;
-      tuple_type t(key_arg, value_arg);
-      m.insert(t);
-    };
-    test_emplace_exception_guarantee(insert_func);
-  }
-  {
-    auto insert_func_iter = [](auto& m, auto key_arg, auto value_arg) {
-      using FlatMap    = std::decay_t<decltype(m)>;
-      using tuple_type = std::tuple<typename FlatMap::key_type, typename FlatMap::mapped_type>;
-      tuple_type t(key_arg, value_arg);
-      m.insert(m.begin(), t);
-    };
-    test_emplace_exception_guarantee(insert_func_iter);
+
+  if (!std::is_constant_evaluated()) {
----------------
ldionne wrote:

We should use `TEST_IS_CONSTANT_EVALUATED` here. Can you check the whole patch?

https://github.com/llvm/llvm-project/pull/137453


More information about the libcxx-commits mailing list