diff options
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 5e7fb33d05..d4efa78b23 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1010,10 +1010,13 @@ 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()) { + // Eliminate placeholders. + ExprResult ConvertedSize = CheckPlaceholderExpr(ArraySize); + if (ConvertedSize.isInvalid()) + return ExprError(); + ArraySize = ConvertedSize.take(); - QualType SizeType = ArraySize->getType(); - - ExprResult ConvertedSize = ConvertToIntegralOrEnumerationType( + ConvertedSize = ConvertToIntegralOrEnumerationType( StartLoc, ArraySize, PDiag(diag::err_array_size_not_integral), PDiag(diag::err_array_size_incomplete_type) @@ -1029,7 +1032,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, return ExprError(); ArraySize = ConvertedSize.take(); - SizeType = ArraySize->getType(); + QualType SizeType = ArraySize->getType(); if (!SizeType->isIntegralOrUnscopedEnumerationType()) return ExprError(); |