Slight refactoring; catch yet another case where we were missing an lvalue-to-rvalue conversion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149003 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 2f8bf77..ae0c2c5 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -995,12 +995,7 @@
// 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 36b6946..1aa5944 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -4801,10 +4801,17 @@
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 @@
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 0eb8d28..fdcad08 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -495,12 +495,8 @@
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(),