[libcxx-commits] [libcxx] [libc++] Implement Resolution of LWG 3886 (PR #155356)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 2 02:06:19 PDT 2025


================
@@ -730,7 +730,8 @@ public:
             enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
   _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
 
-  template <class _Up, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
+  template <class _Up                                                                        = remove_cv_t<_Tp>,
----------------
frederick-vs-ja wrote:

> I think there are tests for `{}` assignment, the other ones not so much--I'll get on those.

If I understand correctly, there will be semantic changes. The assignment from `{...}` used to construct a temporary `optional<_Tp>` first, but possibly constructs a `remove_cv_t<_Tp>` now.

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


More information about the libcxx-commits mailing list