[libcxx-commits] [libcxx] [libcxx] implement LWG4148: unique_ptr::operator* should not allow dangling references (PR #128213)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 26 21:27:07 PST 2025


================
@@ -261,7 +261,10 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr {
   }
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const
-      _NOEXCEPT_(_NOEXCEPT_(*std::declval<pointer>())) {
+      _NOEXCEPT_(_NOEXCEPT_(*std::declval<pointer>()))
+    // TODO: use reference_converts_from_temporary_v once implemented.
----------------
H-G-Hristov wrote:

@elhewaty FYI made at attempt at implementing the builtin to help with this PR but I won't be usable without workarounds due to bugs and until we update the unsupported  platforms Android, Apple, etc.
https://github.com/llvm/llvm-project/pull/128649 which makes it pointless for now.

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


More information about the libcxx-commits mailing list