summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprCXX.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-06-05 00:43:02 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-06-05 00:43:02 +0000
commit599bed75ed32f2100159257a1c1d877ea520d13f (patch)
tree52d92b83cf072bfa88074c805cb656f1d1744150 /clang/lib/CodeGen/CGExprCXX.cpp
parentad81f0f419d026a8fbc11b87fe34ee661812d65b (diff)
downloadbcm5719-llvm-599bed75ed32f2100159257a1c1d877ea520d13f.tar.gz
bcm5719-llvm-599bed75ed32f2100159257a1c1d877ea520d13f.zip
Bugfix: don't assert if someone manages to declare an operator new/delete template before the builtin operator new/delete.
llvm-svn: 210230
Diffstat (limited to 'clang/lib/CodeGen/CGExprCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 0492813f8fa..f2332bde5f6 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -1041,8 +1041,9 @@ RValue CodeGenFunction::EmitBuiltinNewDeleteCall(const FunctionProtoType *Type,
DeclarationName Name = Ctx.DeclarationNames
.getCXXOperatorName(IsDelete ? OO_Delete : OO_New);
for (auto *Decl : Ctx.getTranslationUnitDecl()->lookup(Name))
- if (Ctx.hasSameType(cast<FunctionDecl>(Decl)->getType(), QualType(Type, 0)))
- return EmitNewDeleteCall(*this, cast<FunctionDecl>(Decl), Type, Args);
+ if (auto *FD = dyn_cast<FunctionDecl>(Decl))
+ if (Ctx.hasSameType(FD->getType(), QualType(Type, 0)))
+ return EmitNewDeleteCall(*this, cast<FunctionDecl>(Decl), Type, Args);
llvm_unreachable("predeclared global operator new/delete is missing");
}
OpenPOWER on IntegriCloud