summaryrefslogtreecommitdiff
path: root/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
commitfa8ad04dbe2dc284309e6794b4dfcfc70342e9cf (patch)
tree1d7a70da9de4c8bca10ab0a4386cee20d949a30b /lib/CodeGen/CGExprCXX.cpp
parentc19e37e1764ce3e77c474370484e525fbc87e12b (diff)
downloadclang-fa8ad04dbe2dc284309e6794b4dfcfc70342e9cf.tar.gz
clang-fa8ad04dbe2dc284309e6794b4dfcfc70342e9cf.tar.bz2
clang-fa8ad04dbe2dc284309e6794b4dfcfc70342e9cf.tar.xz
Bugfix: don't assert if someone manages to declare an operator new/delete template before the builtin operator new/delete.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210230 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprCXX.cpp')
-rw-r--r--lib/CodeGen/CGExprCXX.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp
index 0492813f8f..f2332bde5f 100644
--- a/lib/CodeGen/CGExprCXX.cpp
+++ b/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");
}