[PATCH] D18271: Avoid -Wshadow warnings about constructor parameters named after fields

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 11:15:35 PDT 2016


alexfh added a comment.

In http://reviews.llvm.org/D18271#378196, @dblaikie wrote:

> It's not just modifications of shadowed variables that are a problem - one of the one's I'm concerned we should catch is:
>
>   struct foo {
>     std::unique_ptr<int> p;
>     foo(std::unique_ptr<int> p) : p(std::move(p)) {
>       f(*p);
>     }
>   };


This seems totally out of scope for -Wshadow, and seeing a -Wshadow warning on this wouldn't help (imagine a few tens of lines before the `*p` is used).


http://reviews.llvm.org/D18271





More information about the cfe-commits mailing list