diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 7 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 6 |
3 files changed, 11 insertions, 13 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 2f8bf77431..ae0c2c58c1 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -995,12 +995,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, // C++ 5.3.4p6: "The expression in a direct-new-declarator shall have integral // or enumeration type with a non-negative value." if (ArraySize && !ArraySize->isTypeDependent()) { - ExprResult ConvertedSize = DefaultFunctionArrayLvalueConversion(ArraySize); - if (ConvertedSize.isInvalid()) - return ExprError(); - ArraySize = ConvertedSize.take(); - - ConvertedSize = ConvertToIntegralOrEnumerationType( + ExprResult ConvertedSize = ConvertToIntegralOrEnumerationType( StartLoc, ArraySize, PDiag(diag::err_array_size_not_integral), PDiag(diag::err_array_size_incomplete_type) diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 36b6946a03..1aa5944669 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -4801,10 +4801,17 @@ Sema::ConvertToIntegralOrEnumerationType(SourceLocation Loc, Expr *From, if (From->isTypeDependent()) return Owned(From); + // Process placeholders immediately. + if (From->hasPlaceholderType()) { + ExprResult result = CheckPlaceholderExpr(From); + if (result.isInvalid()) return result; + From = result.take(); + } + // If the expression already has integral or enumeration type, we're golden. QualType T = From->getType(); if (T->isIntegralOrEnumerationType()) - return Owned(From); + return DefaultLvalueConversion(From); // FIXME: Check for missing '()' if T is a function type? @@ -4933,7 +4940,7 @@ Sema::ConvertToIntegralOrEnumerationType(SourceLocation Loc, Expr *From, Diag(Loc, NotIntDiag) << From->getType() << From->getSourceRange(); - return Owned(From); + return DefaultLvalueConversion(From); } /// AddOverloadCandidate - Adds the given function to the set of diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 0eb8d2863c..fdcad08b5e 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -495,12 +495,8 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond, if (!Cond) return StmtError(); - CondResult = DefaultFunctionArrayLvalueConversion(Cond); - if (CondResult.isInvalid()) - return StmtError(); - CondResult - = ConvertToIntegralOrEnumerationType(SwitchLoc, CondResult.take(), + = ConvertToIntegralOrEnumerationType(SwitchLoc, Cond, PDiag(diag::err_typecheck_statement_requires_integer), PDiag(diag::err_switch_incomplete_class_type) << Cond->getSourceRange(), |