Fix lifetime issue causing buildbot failures.

llvm-svn: 201012
This commit is contained in:
Richard Smith 2014-02-08 00:42:45 +00:00
parent 8f80a61914
commit f8b417c5ef
1 changed files with 2 additions and 2 deletions

View File

@ -2078,14 +2078,14 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
FunctionProtoType::ExtProtoInfo EPI;
QualType BadAllocType;
bool HasBadAllocExceptionSpec
= (Name.getCXXOverloadedOperator() == OO_New ||
Name.getCXXOverloadedOperator() == OO_Array_New);
if (HasBadAllocExceptionSpec) {
if (!getLangOpts().CPlusPlus11) {
BadAllocType = Context.getTypeDeclType(getStdBadAlloc());
assert(StdBadAlloc && "Must have std::bad_alloc declared");
QualType BadAllocType = Context.getTypeDeclType(getStdBadAlloc());
EPI.ExceptionSpecType = EST_Dynamic;
EPI.NumExceptions = 1;
EPI.Exceptions = &BadAllocType;