aaron.ballman added a comment.

In https://reviews.llvm.org/D52400#1266307, @sberg wrote:

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


It does, but whether that's an issue with the enumerator shadow diagnosing or 
with the other entities not diagnosing, I'm less clear. Consider this slight 
modification to your code:

  struct S1;
  struct S2;
  struct S3 {
    void S1();
    enum { S2 };
  
    void f(S2 s);
  };

On the one hand, the warning is telling you about a problem before you hit it. 
However, this code will err on the declaration of `S::f()` anyway because `S2` 
is not a type, so the warning doesn't get us all *that* much benefit.

Then again, this is a case where you don't get any error but you do get a 
silent behavioral ambiguity without the current enumerator shadow diagnostic:

  struct S1;
  struct S2;
  struct S3 {
    void S1();
    enum { S2 };
  
    void f(decltype(S2) s);
  };

So there are cases where this behavior can be somewhat useful.

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

Was it a frequent/annoying occurrence?


https://reviews.llvm.org/D52400



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to