aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r--lib/Sema/SemaExprCXX.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index c05d29d7d4..df09b4bcae 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -1118,9 +1118,7 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
HaveCompleteInit = true;
// C++11 [decl.spec.auto]p6. Deduce the type which 'auto' stands in for.
- AutoType *AT = 0;
- if (TypeMayContainAuto &&
- (AT = AllocType->getContainedAutoType()) && !AT->isDeduced()) {
+ if (TypeMayContainAuto && AllocType->isUndeducedType()) {
if (initStyle == CXXNewExpr::NoInit || NumInits == 0)
return ExprError(Diag(StartLoc, diag::err_auto_new_requires_ctor_arg)
<< AllocType << TypeRange);
@@ -2279,6 +2277,9 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
ExprResult Sema::CheckConditionVariable(VarDecl *ConditionVar,
SourceLocation StmtLoc,
bool ConvertToBoolean) {
+ if (ConditionVar->isInvalidDecl())
+ return ExprError();
+
QualType T = ConditionVar->getType();
// C++ [stmt.select]p2: