https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79133
Bug ID: 79133 Summary: lambda capture shadowing parameter & decltype confusion Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nathan at gcc dot gnu.org Target Milestone: --- Created attachment 40535 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40535&action=edit reproducer When a simple lambda capture and a lambda parameter share a name, the capture object is seen inside the lambda. Except inside decltype, which sees the parameter. The attached testcase produces (at -O2): subq $8, %rsp movl $1, %edi <-- size of lambda parm 'z' call _Z3Barj movl $4, %edi <-- size of lambda capture 'z' call _Z3Barj movl $5, %eax <-- value of lambda capture 'z' addq $8, %rsp ret Possibly related email: https://gcc.gnu.org/ml/gcc-patches/2017-01/msg01331.html