[libcxx-commits] [libcxx] [libc++][test] Test SFINAE for `optional`'s operators in C++17 (PR #221643)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 7 07:47:34 PDT 2026


================
@@ -6,18 +6,23 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++03, c++11, c++14
+// REQUIRES: std-at-least-c++17
 // <optional>
 
 // template <class T, class U> constexpr bool operator==(const optional<T>& x, const U& v);
 // template <class T, class U> constexpr bool operator==(const U& v, const optional<T>& x);
 
 #include <optional>
+#include <type_traits>
 
 #include "test_comparisons.h"
 #include "test_macros.h"
 
 #if TEST_STD_VER >= 26
+#  define STATIC_ASSERT_OPTIONAL_CMP static_assert
+#else
+#  define STATIC_ASSERT_OPTIONAL_CMP LIBCPP_STATIC_ASSERT
+#endif
----------------
Zingam wrote:

Is there any reason not to lift these into a common header?

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


More information about the libcxx-commits mailing list