[libcxx-commits] [libcxx] [libc++] Disable mistakenly enabled `optional<T&>` constructors for `optional<T>` (PR #194446)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 28 03:42:35 PDT 2026
================
@@ -893,6 +893,10 @@ private:
template <class _Up>
constexpr static bool __libcpp_opt_ref_ctor_deleted =
is_lvalue_reference_v<_Tp> && reference_constructs_from_temporary_v<_Tp, _Up>;
+
+ template <class _Up>
+ constexpr static bool __libcpp_enable_opt_ref_ctor =
----------------
frederick-vs-ja wrote:
I don't think we need the `__libcpp` prefix. IIUC, the `__libcpp` prefix is used for avoid conflict with built-ins, standard (including POSIX) names, and some common extensions. In `optional`, perhaps we can just use `__ref_ctor_enabled`.
(Same for `__libcpp_opt_ref_ctor_deleted`, but that's pre-existing and possibly should be changed in another PR.)
https://github.com/llvm/llvm-project/pull/194446
More information about the libcxx-commits
mailing list