This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-07
(From submission #764.)
Consider:
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{}; }
There is no protection against negative tuple_size.
Proposed resolution (approved by CWG 2025-11-04):
Change in 9.7 [dcl.struct.bind] paragraph 7:
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 integral constant expression whose value is non-negative;andthe structured binding size of E is equal tothethat valueof that expression. ...