aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/llvm-project/clang/lib/Sema/TreeTransform.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/llvm-project/clang/lib/Sema/TreeTransform.h b/contrib/llvm-project/clang/lib/Sema/TreeTransform.h
index e55e752b9cc3..2f012cade6b9 100644
--- a/contrib/llvm-project/clang/lib/Sema/TreeTransform.h
+++ b/contrib/llvm-project/clang/lib/Sema/TreeTransform.h
@@ -13516,6 +13516,16 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
// Capturing 'this' is trivial.
if (C->capturesThis()) {
+ // If this is a lambda that is part of a default member initialiser
+ // and which we're instantiating outside the class that 'this' is
+ // supposed to refer to, adjust the type of 'this' accordingly.
+ //
+ // Otherwise, leave the type of 'this' as-is.
+ Sema::CXXThisScopeRAII ThisScope(
+ getSema(),
+ dyn_cast_if_present<CXXRecordDecl>(
+ getSema().getFunctionLevelDeclContext()),
+ Qualifiers());
getSema().CheckCXXThisCapture(C->getLocation(), C->isExplicit(),
/*BuildAndDiagnose*/ true, nullptr,
C->getCaptureKind() == LCK_StarThis);