https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119239

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
IIUC this code is valid -- an lvalue-to-rvalue conversion in implied in the
return, and so the constant variable 'i' isn't actually odr-used and doesn't
need to be captured.

Note that Clang also accepts the testcase if we turn 'f' into a non-template,
or give the lambda a concrete 'int' return type.. seems like a bug in Clang to
me if anything.

Feel free to reopen if you disagree :)

Reply via email to