<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132668>132668</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Non-constant tuple_size in structured binding is accepted
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
halbi2
</td>
</tr>
</table>
<pre>
```
#include <tuple>
struct A {
template<int> friend int get(A);
};
struct Conv {
constexpr operator int() { return 2; }
};
template<> struct std::tuple_size<A> {
static Conv& value; // no definition
};
template<int N> struct std::tuple_element<N, A> {
using type = int;
};
auto [a,b] = A();
```
I think this TU is invalid, because `tuple_size<A>::value` is not an _integral constant expression_.
`clang++ -std=c++20 -c` rejects.
`clang++ -std=c++23 -c` accepts.
Is this intended for [P2280](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2280r4.html)? But other compilers support P2280 too, and they all reject this `tuple_size` code.
I think #132463 could relate.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVMGO4jgQ_ZriUgI55RDgkEOAQZpLaw-755ZjV4NnjR3ZDr29X79yktlptGqthEgiv3r16j3bKiV79cwtbI-wPa_UmG8htjflekurPpiPFhqx_EQHJK3XbjSMIE95HByD_AaiSzmOOmOHsDuC6DDzfXAqM8iT9RnkN3yLlr1B6zNeOQPtO6ADyIKG3Xl-WVhOwT9-EqEOPmX-a4gYBo4qh1g4gPZAhwLCyHmMHgnkEQvTJ75PKoqEhT5lA7ID2U36X5P9uwC6gvjZNGWVrZ6EADX4UG7kiZ8uQBf0AQ2_WW-zDf6LhmXQl6-7suM7F2dOL0AnfOo-JuuvmD-G4vJ5GvfZJzXmgLA9KqBTD9vzBOtmTxbo59BE9x3zzfo_y3_C3_9Am9D6h3LWlOY9azUmRmjEfyyZNc8GNKIU-pBReXy1PvM1KjcnpHzGkhKnZIN_3cwatFP-CnQEOuJ6cuCs508SuNaFMfIP1jn9f4FcCpTWPMwF39M8UZHiDRt8C7H48hvRXsD2DLS_5TykMsSU3Pv7-yYM7Av1JsQr0OVH1hXQJWmiArhS-TJBJ6DLoAaO5YXEtDoU3lhvbvnuJqsveBwzhnzjiDrcB-s4JkzjMISYcZKBOYRisvIG840_UDm3DD2Lf3a9EaiD4c1zbkCyklQ3EnUYncHIZZdtVqaV5iAPasVttatpd6jqWqxure71vhei3pqtqA5smr7R1V7Sgd8OlVJqZVsStBWSalHXclttesVG7fuq5t6oZsdQC74r6zbOPe7FqpVNaeS2ktQ0-5VTPbs03RpEnt9xWgWiconEthSt-_GaoBbOppx-0WSbHbcvwa__3Te_xkfrl_MyRjbYW2_KUbBpSZ3NaoyufQ71avNt7Dc63IEupc_yWA8xFJuBLpO6EuQi_9HSPwEAAP__OdeGIA">