[libcxx-commits] [libcxx] eab1a1d - [libc++][test] Improve test coverage for flat_set (lack of) SCARY iterators (#139649)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 12 10:15:43 PDT 2025


Author: halbi2
Date: 2025-06-12T13:15:41-04:00
New Revision: eab1a1d4914a51de8383b818bf595125fb830c51

URL: https://github.com/llvm/llvm-project/commit/eab1a1d4914a51de8383b818bf595125fb830c51
DIFF: https://github.com/llvm/llvm-project/commit/eab1a1d4914a51de8383b818bf595125fb830c51.diff

LOG: [libc++][test] Improve test coverage for flat_set (lack of) SCARY iterators (#139649)

Missing from 5e94e26a7afb8db00cc123e5fc5471c1125596e3.

Added: 
    libcxx/test/libcxx/containers/container.adaptors/flat.set/scary.compile.pass.cpp

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/containers/container.adaptors/flat.set/scary.compile.pass.cpp b/libcxx/test/libcxx/containers/container.adaptors/flat.set/scary.compile.pass.cpp
new file mode 100644
index 0000000000000..99e93fc3b08b9
--- /dev/null
+++ b/libcxx/test/libcxx/containers/container.adaptors/flat.set/scary.compile.pass.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <flat_set>
+
+// class flat_set
+// class flat_multiset
+
+// Extension: SCARY/N2913 iterator compatibility between flat_set and flat_multiset
+// Test for the absence of this feature
+
+#include <flat_set>
+#include <type_traits>
+
+#include "test_macros.h"
+
+void test() {
+  typedef std::flat_set<int, int> M1;
+  typedef std::flat_multiset<int, int> M2;
+
+  static_assert(!std::is_convertible_v<M1::iterator, M2::iterator>);
+  static_assert(!std::is_convertible_v<M2::iterator, M1::iterator>);
+
+  static_assert(!std::is_convertible_v<M1::const_iterator, M2::const_iterator>);
+  static_assert(!std::is_convertible_v<M2::const_iterator, M1::const_iterator>);
+}


        


More information about the libcxx-commits mailing list