aaron.ballman added a comment.

In https://reviews.llvm.org/D52421#1288910, @lebedev.ri wrote:

> And now i'm having concerns.
>
>   struct Base {
>       void* f;
>   };
>  
>   struct Inherit : Base {
>       static void func(void* f) { // <- does 'f' *actually* shadow the 'f' in 
> the 'Base'? You can't access that non-static member variable from static 
> function.
>       }
>   };
>  
>


The diagnostic is correct here, IMO. Consider:

  struct Base {
      int* f;
  };
  
  struct Inherit : Base {
      static void func(void* f) { 
          decltype(f) ptr = 0;
      }
  };

If the parameter were originally named `frobble` (so there was no hiding), then 
the `decltype(f)` would have resulted in `int *`. When `frobble` gets 
refactored into `f`, the type of `ptr` changes to `void *`.


https://reviews.llvm.org/D52421



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

Reply via email to