Fix regression I introduced when dynamic_cast-ing to a reference type.

llvm-svn: 91687
This commit is contained in:
Anders Carlsson 2009-12-18 14:55:04 +00:00
parent b396f43520
commit 0087bc851c
2 changed files with 9 additions and 1 deletions

View File

@ -501,7 +501,7 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
SrcTy = SrcTy->getPointeeType();
SrcTy = SrcTy.getUnqualifiedType();
if (DestTy->isPointerType())
if (DestTy->isPointerType() || DestTy->isReferenceType())
DestTy = DestTy->getPointeeType();
DestTy = DestTy.getUnqualifiedType();

View File

@ -0,0 +1,8 @@
// RUN: %clang_cc1 %s -emit-llvm-only
struct A { virtual void f(); };
struct B : A { };
const B& f(A *a) {
return dynamic_cast<const B&>(*a);
}