https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116116
Bug ID: 116116
Summary: -Wshadow false negative
Product: gcc
Version: 14.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
% cat test.cpp
int a[2];
struct S { int a { sizeof (a) }; };
static_assert (S().a == sizeof (int));
% g++ -Wall -Wextra -Wshadow test.cpp -c
%
I would expect a warning here. As the static_assert shows, in the
initialization of S::a, "a" refers to itself (correctly AFAIK), so it does
shadow the outer "a" already.