[clang] [Clang] Fix name lookup for dependent bases (PR #114978)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 6 11:53:47 PST 2024


================
@@ -265,8 +268,8 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context,
             BaseRecord = nullptr;
         }
       } else {
-        BaseRecord = cast<CXXRecordDecl>(
-            BaseSpec.getType()->castAs<RecordType>()->getDecl());
+        if (auto *RT = BaseSpec.getType()->getAs<RecordType>())
+          BaseRecord = cast<CXXRecordDecl>(RT->getDecl());
----------------
mizvekov wrote:

This should be equivalent to:
```suggestion
        BaseRecord = BaseSpec.getType()->getAsRecordDecl();
```

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


More information about the cfe-commits mailing list