We should specify that a tuple needs to decompose into 0 or more elements. It is unclear what would happen otherwise, ie in this example
namespace std {
template <typename T> struct tuple_size;
}
struct S {
int a;
};
template <> struct std::tuple_size<S> {
static constexpr int value = -1;
};
void f(auto) { auto [... a] = S{}; }
This was initially reported as a bug in clang llvm/llvm-project#159563
Proposed change:
In [dcl.struct.bind],
Otherwise, if the qualified-id std::tuple_size<E> names a complete class type with a member named value, the expression std::tuple_size<E>::value shall be a well-formed non-negative integral constant expression and the structured binding size of E is equal to the value of that expression.
We should specify that a tuple needs to decompose into 0 or more elements. It is unclear what would happen otherwise, ie in this example
This was initially reported as a bug in clang llvm/llvm-project#159563
Proposed change:
In [dcl.struct.bind],
Otherwise, if the qualified-id
std::tuple_size<E>names a complete class type with a member named value, the expressionstd::tuple_size<E>::valueshall be a well-formed non-negative integral constant expression and the structured binding size ofEis equal to the value of that expression.