[PATCH] D52400: Improve -Wshadow warnings with enumerators

Stephan Bergmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 16 03:38:41 PDT 2018


sberg added a comment.

doesnt this make -Wshadow more aggressive for enumerators than for other entities?

  ~ cat test17.cc
  struct S1;
  struct S2;
  struct S3 {
    void S1();
    enum { S2 };
  };
  
  ~ llvm/inst/bin/clang++ -fsyntax-only -Wshadow test17.cc 
  test17.cc:5:10: warning: declaration shadows a variable in the global namespace
        [-Wshadow]
    enum { S2 };
           ^
  test17.cc:2:8: note: previous declaration is here
  struct S2;
         ^
  1 warning generated.

warns about enumerator S2 but not about similar function S1

(ran into such a new -Wshadow while compiling LibreOffice)


https://reviews.llvm.org/D52400





More information about the cfe-commits mailing list