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

            Bug ID: 67951
           Summary: Wshadow for type inferenced (auto) lambda parameters
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.auer at cgi dot com
  Target Milestone: ---

int f()
{
    auto l = [](int i) {};

    int i=0;
    l(i);

    return i;
}

void h()
{
    auto l = [](auto i) {};

    int i=0;
    l(i);
}

If compiled with "g++ -std=c++1y -Wshadow", I get a warning in h:
shadow.cpp:15:23: warning: declaration of ā€˜i’ shadows a previous local
[-Wshadow]
     auto l = [](auto i) {};
                       ^
shadow.cpp:17:9: note: shadowed declaration is here
     int i=0;

I think this is wrong. If it is not wrong, it is inconsistent because there is
no warning in f().

Reply via email to