diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-01-25 17:04:26 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-01-25 17:04:26 +0000 |
commit | cadf1a490f9ae802ad340da5d9e2a272c81efa87 (patch) | |
tree | 923c4561cdc455623fd48979ce62af86ba44e9d5 /lib | |
parent | b32860f4c96be739d8cdc9705470ce5b7a33648f (diff) |
Merging r292991:
------------------------------------------------------------------------
r292991 | rsmith | 2017-01-24 15:18:28 -0800 (Tue, 24 Jan 2017) | 3 lines
PR31742: Don't emit a bogus "zero size array" extwarn when initializing a
runtime-sized array from an empty list in an array new.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@293072 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 45eff5ee6b..b053c83c3f 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -1684,7 +1684,7 @@ void InitListChecker::CheckArrayType(const InitializedEntity &Entity, // If this is an incomplete array type, the actual type needs to // be calculated here. llvm::APSInt Zero(maxElements.getBitWidth(), maxElements.isUnsigned()); - if (maxElements == Zero) { + if (maxElements == Zero && !Entity.isVariableLengthArrayNew()) { // Sizing an array implicitly to zero is not allowed by ISO C, // but is supported by GNU. SemaRef.Diag(IList->getLocStart(), |