[libcxx-commits] [PATCH] D116884: [libcxx][test] optional's comparisons with optional are not portably constrained

Casey Carter via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jan 9 01:12:06 PST 2022


CaseyCarter created this revision.
CaseyCarter added a reviewer: libc++.
CaseyCarter added a project: libc++.
CaseyCarter requested review of this revision.
Herald added 1 blocking reviewer(s): libc++.

so use them as concept test cases only with libc++.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116884

Files:
  libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
  libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.pass.cpp


Index: libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.pass.cpp
===================================================================
--- libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.pass.cpp
+++ libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.pass.cpp
@@ -112,14 +112,18 @@
 static_assert(!std::totally_ordered<std::unordered_set<int> >);
 
 struct A {};
-// FIXME(cjdb): uncomment when operator<=> is implemented for each of these types.
-// static_assert(!std::totally_ordered<std::array<A, 10> >);
-// static_assert(!std::totally_ordered<std::deque<A> >);
-// static_assert(!std::totally_ordered<std::forward_list<A> >);
-// static_assert(!std::totally_ordered<std::list<A> >);
-static_assert(!std::totally_ordered<std::optional<A> >);
-// static_assert(!std::totally_ordered<std::set<A> >);
-// static_assert(!std::totally_ordered<std::vector<A> >);
+// FIXME(cjdb): Enable when operator<=> is implemented for each of these types.
+#ifndef _LIBCPP_VERSION
+static_assert(!std::totally_ordered<std::array<A, 10> >);
+static_assert(!std::totally_ordered<std::deque<A> >);
+static_assert(!std::totally_ordered<std::forward_list<A> >);
+static_assert(!std::totally_ordered<std::list<A> >);
+#endif // _LIBCPP_VERSION
+LIBCPP_STATIC_ASSERT(!std::totally_ordered<std::optional<A> >);
+#ifndef _LIBCPP_VERSION
+static_assert(!std::totally_ordered<std::set<A> >);
+static_assert(!std::totally_ordered<std::vector<A> >);
+#endif // _LIBCPP_VERSION
 } // namespace standard_types
 
 namespace types_fit_for_purpose {
Index: libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
===================================================================
--- libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
+++ libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
@@ -31,6 +31,7 @@
 #endif
 
 #include "compare_types.h"
+#include "test_macros.h"
 
 namespace fundamentals {
 static_assert(std::equality_comparable<int>);
@@ -96,12 +97,12 @@
 static_assert(!std::equality_comparable<std::lock_guard<std::mutex> >);
 static_assert(std::equality_comparable<std::map<int, void*> >);
 static_assert(!std::equality_comparable<std::mutex>);
-static_assert(
+LIBCPP_STATIC_ASSERT(
     !std::equality_comparable<std::optional<std::lock_guard<std::mutex> > >);
-static_assert(!std::equality_comparable<std::optional<std::mutex> >);
+LIBCPP_STATIC_ASSERT(!std::equality_comparable<std::optional<std::mutex> >);
 #endif
 
-static_assert(std::equality_comparable<std::optional<int> >);
+LIBCPP_STATIC_ASSERT(std::equality_comparable<std::optional<int> >);
 static_assert(std::equality_comparable<std::set<int> >);
 static_assert(std::equality_comparable<std::unordered_map<int, void*> >);
 static_assert(std::equality_comparable<std::unordered_set<int> >);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116884.398402.patch
Type: text/x-patch
Size: 2997 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220109/48de7769/attachment.bin>


More information about the libcxx-commits mailing list