[PATCH] D151214: [clang][Sema] `-Wshadow` warns about shadowings by static local variables

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 23 12:01:45 PDT 2023


shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: clang/test/SemaCXX/warn-shadow.cpp:33
 void foo() {
   int i; // expected-warning {{declaration shadows a variable in namespace '(anonymous)'}}
   int j; // expected-warning {{declaration shadows a variable in namespace 'one::two'}}
----------------
Note. it looks like gcc does not warn on shadowing for anonymous namespaces. I think it makes sense to warn in this case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151214/new/

https://reviews.llvm.org/D151214



More information about the cfe-commits mailing list