Just for completeness, if upgrading to C++23 is an option and the lambda is non-capturing, you can make it static:
#include <future>#include <array>int main(){ auto func = []<int n>() static { std::array<double, n> arr; }; func.operator()<5>(); // This compiles. std::async(func.operator()<5>); // This also compiles.}