rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Looks good, thanks!

In https://reviews.llvm.org/D42498#1015419, @vsapsai wrote:

> In https://reviews.llvm.org/D42498#1007028, @rsmith wrote:
>
> > […] your approach will still go wrong if the `This` pointer is used in 
> > other ways, such as an explicit mention of `this` or a member function call.
>
>
> I wasn't able to find a failing test case. Maybe I misunderstood you but in 
> my testing functions declared in named structs had correct `This` pointer and 
> in anonymous structs functions cannot be declared.


Here's a testcase that fails today:

  struct A { int n = 0; struct { void *p = this; }; void *q = this; };
  constexpr A a = A();
  static_assert(a.p != a.q, ""); // fails today, should pass
  
  constexpr A b = A{0};
  static_assert(b.p != b.q, ""); // passes today

With the previous approach of fixing up the `This` value only in class member 
access, the above testcase would presumably still fail. I expect it to pass 
with your new approach.


https://reviews.llvm.org/D42498



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

Reply via email to