Question for standard gurus.
Trying to respond to another question, I came to doubt about the well-formedness of a code.
As far I know, the following code is ill-formed
int main ()
{
std::tuple<> a;
std::get<0>(a);
}
std::get<I>(t)
t
std::tuple<Ts...>
I
[0, sizeof...(Ts)[
sizeof...(Ts)
[0, 0[
std::get<I>(a)
I
std::get<I>(a)
#include <tuple>
template <typename ... Args>
void bar (Args const & ...)
{ }
template <std::size_t ... I>
void foo ()
{
std::tuple<> a;
bar( std::get<I>(a) ... );
}
int main ()
{
foo<>();
}
std::get<I>(a)
sizeof...(I)
The program is ill-formed, no diagnostic required, if:
- [...]
- every valid specialization of a variadic template requires an empty template parameter pack, or
- [...]