https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71386
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
Slightly simpler
template<class...XS>
auto List(XS...xs)
{
return [=](auto processList){return processList(xs...);};
};
auto l1 = List(42);
auto foo = [](auto... xs1)
{
return [=]()
{
return l1([=](auto)
{
return __builtin_printf("%d",xs1...);
});
};
};
int main()
{
auto concat = l1(foo);
concat();
__builtin_printf("\n");
}
If I make xs1 non-variadic (just erase '...' in 2 places), things work. The
main difference seems to be in <lambda(auto:2 ...)> [with auto:2 = {int}] (we
write to some place in the stack then re-read the value from another place) but
it isn't clear what is going wrong there.