rsmith added a comment. In https://reviews.llvm.org/D35941#823524, @alexfh wrote:
> IIUC, most cases where -Wshadow warnings are issued is when a declaration > from an enclosing scope would be accessible if there was no declaration that > shadows it. In this case the the local variable of a function would not be > accessible inside the local class anyway That's not strictly true; the variable can be accessed in unevaluated operands, and in code doing so, a `-Wshadow` warning might (theoretically) be useful: void f(SomeComplexType val) { struct A { decltype(val) &ref; void g(int val) { decltype(val) *p = &ref; } } a = {val}; } That said, suppressing the warning seems like a good thing in the common case. We've discussed the idea of deferring some `-Wshadow` warnings until we see a use; if someone cares about this case, we could consider warning only if the shadowed variable is actually used in an unevaluated operand. Repository: rL LLVM https://reviews.llvm.org/D35941 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits