[libcxx-commits] [libcxx] [libc++] P2255R2: Add deleted tuple constructor overloads (PR #205379)
Yihan Wang via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Aug 22 04:31:35 PDT 2026
================
@@ -604,12 +604,38 @@ public:
: __base_(allocator_arg_t(), __a, __forward_args{}, __t...) {}
// tuple(U&& ...) constructors (including allocator_arg_t variants)
+ template <class... _Up>
+ struct _IsThisTuple : false_type {};
+ template <class _Up>
+ struct _IsThisTuple<_Up> : is_same<__remove_cvref_t<_Up>, tuple> {};
+
template <class... _Up>
struct _EnableUTypesCtor
- : _And<_Or<integral_constant<bool, sizeof...(_Up) != 1>,
- _IsNotSame<__remove_cvref_t<_Up...[0]>, tuple>>, // extension to allow mis-behaved user constructors
+ : _And<_Not<_IsThisTuple<_Up...> >, // extension to allow mis-behaved user constructors
is_constructible<_Tp, _Up>... > {};
+# if _LIBCPP_STD_VER >= 23
+ template <class... _Up>
+ static constexpr bool __has_danglings() {
+ if constexpr (sizeof...(_Up) == sizeof...(_Tp))
+ return (__reference_constructs_from_temporary_v<_Tp, _Up&&> || ...);
----------------
yronglin wrote:
Good catch, we expect lazy instantiation, so `_Or` is more appropriate here.
https://github.com/llvm/llvm-project/pull/205379
More information about the libcxx-commits
mailing list