Parameter pack expansion with lambda

It was a bug that GCC doesn't expand template parameter pack that appears in a lambda-expression, which was fixed in GCC 8 eventually.

The other issue with the code as also mentioned in the comments is that every lambda in the list { []() { return N; }... } has its own distinct type, so one has to convert them into function pointers with + operator first:

#include <utility>
#include <cassert>

template<std::size_t ... N>
int f(std::index_sequence<N...>, std::size_t k) {
   static auto f_table = { +[]() { return N; }... };
   auto f = f_table.begin() + k;
   assert((*f)() == k);
   return (*f)();
}

int main() {
    f(std::make_index_sequence<3>{}, 2);
}

Demo: https://gcc.godbolt.org/z/jWrfn7d6W