================ @@ -6124,7 +6124,11 @@ QualType TreeTransform<Derived>::TransformFunctionProtoType( // "pointer to cv-qualifier-seq X" between the optional cv-qualifer-seq // and the end of the function-definition, member-declarator, or // declarator. - Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext, ThisTypeQuals); + auto *RD = + dyn_cast_or_null<CXXRecordDecl>(SemaRef.getCurLexicalContext()); + Sema::CXXThisScopeRAII ThisScope( + SemaRef, ThisContext == nullptr && nullptr != RD ? RD : ThisContext, + ThisTypeQuals); ---------------- AaronBallman wrote:
```suggestion auto *RD = dyn_cast<CXXRecordDecl>(SemaRef.getCurLexicalContext()); Sema::CXXThisScopeRAII ThisScope( SemaRef, !ThisContext && RD ? RD : ThisContext, ThisTypeQuals); ``` https://github.com/llvm/llvm-project/pull/78088 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits