https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115581
--- Comment #3 from Barnabás Pőcze <pobrn at protonmail dot com> --- Isn't your testcase a bit different? I guess my question is, why does gcc feel the need to make a local copy of a by-value argument when calling a function with a reference to it, but seemingly only in a function generated from a lambda?