Consider this code snippet:
int main () {
auto first = [&] (auto... one) {
auto faulty = [&] () {
[[maybe_unused]] auto i = (one + ...);
return (one + ...);
};
faulty();
};
first(1);
}
See also on godbolt.
It seems that when I try to expand the implicitly captured parameter pack one
twice inside the inner lambda, gcc complains, but clang does not.
Note that when I explicitly capture, like so [&one...]
, gcc doesn't complain anymore.
To me this looks like a gcc bug, but I would like some confirmation from people who are more experienced than me, since I have already seen (different) buggy behaviour in clang with variadic captures here.