[libcxx-commits] [libcxx] [libc++] Implement LWG4406: value_or return statement is inconsistent with Mandates (PR #189568)

William Tran-Viet via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 31 19:23:12 PDT 2026


================
@@ -89,6 +89,17 @@ constexpr int test()
       assert(!opt);
     }
 #endif
+    // LWG3424: return type is remove_cv_t<T>
+    {
+      optional<const int> opt(2);
+      ASSERT_SAME_TYPE(decltype(opt.value_or(3)), int);
----------------
smallp-o-p wrote:

I think we're missing a `optional.value_or.verify.cpp` test (or something like that) for the mandates `static_assert`s.

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


More information about the libcxx-commits mailing list