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++
    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:

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to