The standard can specify that it is not captured. I don't think it's good to pin hopes of optimization on implementations.

On Sat, Oct 1, 2022 at 9:31 PM Jason McKesson via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On Sat, Oct 1, 2022 at 8:41 AM blacktea hamburger via Std-Proposals
<std-proposals@lists.isocpp.org> wrote:
>
> You have a point.
>
> But for non-generic lambdas, there should be no additional capture. Such as:
>
> const int n = 1;
> [=] {int arr[n];};

Where is the "additional capture"?

Your lambda asked to capture everything if it is mentioned. I see `n`
being mentioned in the lambda body. It is not at all unreasonable for
a lambda to capture it. And a compiler can always optimize it away,
but there's no problem with having `n` be captured.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals