[PATCH] D52400: Improve -Wshadow warnings with enumerators

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 28 10:13:34 PDT 2018


aaron.ballman added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:16320
+    // Check for other kinds of shadowing not already handled.
+    CheckShadow(New, PrevDecl, R);
+
----------------
erik.pilkington wrote:
> I don't think we should do this for scoped enums in C++, i.e. this should be fine:
> ```
> int Foo;
> enum class X { Foo };
> ```
> 
> Can you enclose this in `if (!TheEnumDecl->isScoped())` and add a test? Other than that, LGTM!
Thanks, that's a great point! I've corrected in an updated patch.


https://reviews.llvm.org/D52400





More information about the cfe-commits mailing list