Today I found this code
#include <cstdio>
auto terminal = [](auto term)
{
return [=] (auto func)
{
return terminal(func(term));
};
};
Surprisingly, GCC accepts it. Clang rejects it because it uses terminal
in its own intializer and is declared auto
.
I was expecting the error that clang gave, but is it actually ill-formed? Or must the code be accepted?