[clang] [clang]use correct this scope to evaluate noexcept expr (PR #77416)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 23:31:38 PST 2024


================
@@ -6192,6 +6192,12 @@ bool TreeTransform<Derived>::TransformExceptionSpec(
 
   // Instantiate a dynamic noexcept expression, if any.
   if (isComputedNoexcept(ESI.Type)) {
+    // Update this scrope because ContextDecl in Sema will be used in TransformExpr.
+    auto *Method = dyn_cast_or_null<CXXMethodDecl>(ESI.SourceTemplate);
----------------
tbaederr wrote:

```suggestion
    auto *Method = dyn_cast_if_present<CXXMethodDecl>(ESI.SourceTemplate);
```

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


More information about the cfe-commits mailing list