diff options
author | John McCall <rjmccall@apple.com> | 2012-01-11 00:14:46 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-01-11 00:14:46 +0000 |
commit | 806054db6653d29cb0d9692df3612cbcd03d0530 (patch) | |
tree | ec8e7db01c48b0b65e6170409e0390816364a734 /lib/Sema/SemaExprCXX.cpp | |
parent | 9db0a5e7e360d8048c83ee1c46a88c4172182791 (diff) |
Do placeholder conversions on array bounds in both declarators and
new-expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147900 91177308-0d34-0410-b5e6-96231b3b80d8
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(); |