[PATCH] libstdc++: Implement P1789R3 - Library Support for Expansion Statements
Pilar Latiesa
pilarlatiesa@gmail.com
Mon Dec 22 19:44:55 GMT 2025
> + template <size_t _Idx, typename _Tp, _Tp... _Num>
> + struct tuple_element<_Idx, const integer_sequence<_Tp, _Num...>>
> + {
> + static_assert(_Idx < sizeof...(_Num),
> + "integer_sequence index is in range");
> + using type = _Tp;
> + };
Unfortunately, neither G++ nor Clang++ appear to like this const
specialization when it comes to constant evaluation:
```
int main() {
static constexpr auto [a, b] = std::make_index_sequence<2uz>{};
static_assert(a == 0uz); // error: the value of '<temporary>' is not
usable in a constant expression
}
```
If this specialization is removed, or tweaked so that `using type =
const _Tp`, then both compilers accept the snippet.
More information about the Libstdc++
mailing list