https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67273
Bug ID: 67273
Summary: Incorrect -Wshadow warning with generic lambdas
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vittorio.romeo at outlook dot com
Target Milestone: ---
The `-Wshadow` flag fires an incorrect warning using generic lambdas with
`auto` type deduction.
Minimal example:
http://melpon.org/wandbox/permlink/ynGNXTYN8rY40BgY
---
Code (copy-pasted from example):
// `auto i` -> incorrect warning
auto autol0()
{
return [](auto i){ std::cout << i; };
}
auto autol1()
{
return [](auto i){ autol0()(i); };
}
// `int i` -> no warnings
auto intl0()
{
return [](int i){ std::cout << i; };
}
auto intl1()
{
return [](int i){ intl0()(i); };
}
---
Warning (copy-pasted from example):
prog.cc:5:21: warning: declaration of 'int i' shadows a parameter [-Wshadow]
return [](auto i){ std::cout << i; };
^
prog.cc:10:20: note: shadowed declaration is here
return [](auto i){ autol0()(i); };
^