llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
26.76k stars 10.96k forks source link

Consider -Wshadow-member subgroup for derived members shadowing base members #14247

Open dwblaikie opened 11 years ago

dwblaikie commented 11 years ago
Bugzilla Link 13875
Version trunk
OS Linux
CC @DougGregor,@Trass3r

Extended Description

struct base { int i; }; struct derived: base { int i; };

We should see about warning on derived's 'i' under a subgroup of -Wshadow (possibly -Wshadow-member - suggestions welcome).

Trass3r commented 5 years ago

statics as well: https://godbolt.org/z/jL0ony

dwblaikie commented 11 years ago

This could/should also include shadowed member functions as well as member variables. (with a possible suggestion that the member function be marked virtual in the base and, in C++11, override in the derived class)