[PATCH] D44844: [PR36880] Avoid -Wunused-lambda-capture false positive for explicit this capture used in an unresolved member in a generic lambda

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 23 14:09:45 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Sema/TreeTransform.h:11269
+    // 'this' capture is marked as 'used'.
+    if (Old->isImplicitCXXThisAccess())
+      getSema().CheckCXXThisCapture(Old->getMemberNameInfo().getLoc(),
----------------
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(); }
```


Repository:
  rC Clang

https://reviews.llvm.org/D44844





More information about the cfe-commits mailing list