[clang] [Clang][Sema] Fix a crash in lambda instantiation (PR #85565)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 04:38:15 PDT 2024


================
@@ -13714,6 +13714,12 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
 
     // Capturing 'this' is trivial.
     if (C->capturesThis()) {
+      // We need ThisType here.
+      Sema::CXXThisScopeRAII ThisScope(
+          getSema(),
+          dyn_cast_or_null<CXXRecordDecl>(
----------------
Sirraide wrote:

```suggestion
          dyn_cast_if_present<CXXRecordDecl>(
```
`cast_or_null` and friends are deprecated.

https://github.com/llvm/llvm-project/pull/85565


More information about the cfe-commits mailing list