[llvm-bugs] [Bug 31222] New: Produce warning when a derived class shadows a field of the base class with `-Wshadow`
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Dec 1 02:49:35 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=31222
Bug ID: 31222
Summary: Produce warning when a derived class shadows a field
of the base class with `-Wshadow`
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: vittorio.romeo at outlook.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
struct Base { int a; };
struct Derived : Base { int a; };
int main() { }
The code snippet above produces no warnings with `-Wshadow` enabled.
This seems like an unusual situation that could lead to unexpected behavior.
I suggest producing a warning when `-Wshadow` is enabled, to alert that
`Derived::a` is shadowing `Base::a`.
Related SO question:
https://stackoverflow.com/questions/40908402
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161201/4ab12512/attachment.html>
More information about the llvm-bugs
mailing list