I'm writing some code which passes lambda functions to a suite of recursive functions. Some of these lambda functions are nested inside other lambda functions. I think I'm writing valid code but I'm getting a fatal error C1060: compiler is out of heap space error.
Here is a much cut down version of the code
struct Null
{
template <typename SK>
static void match(SK sk)
{
}
};
template <typename T>
struct Repetition
{
template <typename SK>
static void match(SK sk)
{ // <--------------------------------- error message points to this line
T::match([]() { match([]() {}); });
}
};
int main()
{
using Test = Repetition<Null>;
Test::match([](){});
}
Now this minimal version doesn't make much sense but it has the same compiler error. I've indicated the line with the error above.
My question is, is this a compiler bug/limitation or is my code invalid in some way?
Compiler is Visual Studio 2022 compiling C++20.
Thanks