diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2024-03-21 20:50:26 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-06 20:14:31 +0000 |
commit | 49a6e426df84eff1ae54905a02f66910a6a177d3 (patch) | |
tree | 9ce2893a0a0c04f15412e58516f7575590669140 | |
parent | ce4f1f49e036fd806b534decfe38020dae32a384 (diff) | |
download | src-49a6e426df84eff1ae54905a02f66910a6a177d3.tar.gz src-49a6e426df84eff1ae54905a02f66910a6a177d3.zip |
-rw-r--r-- | contrib/llvm-project/clang/lib/Sema/TreeTransform.h | 10 |
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); |