Replace a cast with a dyn_cast as suggested by Doug.

llvm-svn: 72624
This commit is contained in:
Anders Carlsson 2009-05-30 17:26:39 +00:00
parent 8e2c4f4716
commit 36b75a4619
2 changed files with 16 additions and 7 deletions

View File

@ -195,14 +195,15 @@ bool Sema::LookupInBases(CXXRecordDecl *Class,
Paths.ScratchPath.Decls =
BaseRecord->lookup(Context, Criteria.Method->getDeclName());
while (Paths.ScratchPath.Decls.first != Paths.ScratchPath.Decls.second) {
CXXMethodDecl *MD =
cast<CXXMethodDecl>(*Paths.ScratchPath.Decls.first);
if (CXXMethodDecl *MD =
dyn_cast<CXXMethodDecl>(*Paths.ScratchPath.Decls.first)) {
OverloadedFunctionDecl::function_iterator MatchedDecl;
if (MD->isVirtual() && !IsOverload(Criteria.Method, MD, MatchedDecl)) {
if (MD->isVirtual() &&
!IsOverload(Criteria.Method, MD, MatchedDecl)) {
FoundPathToThisBase = true;
break;
}
}
++Paths.ScratchPath.Decls.first;
}

View File

@ -118,3 +118,11 @@ void foo(void)
B b;
}
struct K {
int f;
virtual ~K();
};
struct L : public K {
void f();
};