arphaman added inline comments.
================ Comment at: lib/Sema/TreeTransform.h:11269 + // 'this' capture is marked as 'used'. + if (Old->isImplicitCXXThisAccess()) + getSema().CheckCXXThisCapture(Old->getMemberNameInfo().getLoc(), ---------------- efriedma wrote: > This doesn't make sense; in general, you can't tell whether an > UnresolvedMemberExpr requires a "this" capture. > > ``` > template<typename T> class C : T { > static int f(int); > int f(double); > public: > int g() { > return []{ return f(T::x); }(); > } > }; > > struct A { static int x; }; > void x(C<A> c) { c.g(); } > ``` Good point, we still emit a false positive warning for ``` template <class T> struct DummyTemplate { template <class T2> void methodTemplate(const T2 &) {} static void methodTemplate(float *) { } void ToTemplate(const int ¶m) { [this](const auto &p) { methodTemplate(p); }(param); // incorrect warning! } }; void main() { int i = 0; DummyTemplate<bool> dt; dt.ToTemplate(i); } ``` I will work on a better fix. Repository: rC Clang https://reviews.llvm.org/D44844 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits