[Bug c++/55357] -Wshadow warns about lambda function parameters matching variables in outer scope

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 5 19:25:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55357

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-03-05
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-05 19:25:34 UTC ---
(In reply to comment #0)
> I can't decide if this is correct behavior for the warning. It would catch
> errors caused by people thinking they were using the outer variables by simply
> disallowing overlap, which is good.

I think it's appropriate to warn here; whether or not there is a default
capture seems like a subtle distinction that is easy to miss when reading the
code.

> I also note that gcc warns me about the first line the lambda appears on (line
> 3) and the last line (line 5).

That's a bug.



More information about the Gcc-bugs mailing list