[libcxx-commits] [libcxx] [libc++] P2255R2: Add deleted tuple constructor overloads (PR #205379)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 18 01:07:28 PDT 2026


================
@@ -677,16 +714,32 @@ public:
       : __base_(allocator_arg_t(), __a, __from_tuple(), __t) {}
 
 #    if _LIBCPP_STD_VER >= 23
+  template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
+    requires __constructs_dangling_reference_from_tuple_like<const tuple<_Up...>&>
+  tuple(const tuple<_Up...>&) = delete;
----------------
frederick-vs-ja wrote:

@philnik777 I'm not convinced that `explicit` is unnecessary for all deleted overloads.

The explicitness affects the following case.

```c++
void f(Tuple1); // given the ctor for Tuple2& -> Tuple1 is deleted and explicit
void f(U); // given U is implicit convertible from Tuple2&
// ...
Tuple2 t{args...};
f(t); // there shouldn't be ambiguity
```

The situation is controversial for multi-argument cases, as discussed in cplusplus/CWG#983. Maybe it's fine not to add `explicit`.

----

I'm not sure whether we shouldn't care about "side" overloads at all (at least some LWG issues cared about them). If so, the difference between deleted and constrained-out overloads is effectively ignored.

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


More information about the libcxx-commits mailing list