[PATCH] D31235: Enhance -Wshadow to warn when shadowing typedefs or type aliases
Ahmed Asadi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 28 12:56:00 PDT 2017
ahmedasadi marked 3 inline comments as done.
ahmedasadi added inline comments.
================
Comment at: test/SemaCXX/warn-shadow.cpp:65
char *data; // expected-warning {{declaration shadows a static data member of 'A'}}
+ char *a1; // expected-warning {{declaration shadows a typedef in 'A'}}
+ char *a2; // expected-warning {{declaration shadows a type alias in 'A'}}
----------------
arphaman wrote:
> It looks like previously this wouldn't have been a warning. Should we really warn about local variables that shadow typedef names?
GCC does, though I agree the warning isn't that helpful as a variable typically can't be used in place of a type (only exception I can think of is sizeof).
I'll modify the patch to only warn when typedefs / type aliases shadow each other.
https://reviews.llvm.org/D31235
More information about the cfe-commits
mailing list