[libcxx-commits] [libcxx] [libc++] Correct `optional<T&>` implementation (PR #174537)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 7 10:46:18 PST 2026


================
@@ -1050,32 +1104,56 @@ public:
     }
   }
 
-  _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp const> operator->() const noexcept {
+  _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp const> operator->() const noexcept
+#    if _LIBCPP_STD_VER >= 26
+    requires(!is_lvalue_reference_v<_Tp>)
----------------
frederick-vs-ja wrote:

Not strictly requested. Would it be clearer to replace all occurrences of `!is_lvalue_reference_v` with `is_object_v`?

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


More information about the libcxx-commits mailing list