Allow the element type of arrays to be incomplete in C++.
This fixes PR5048. Also fix a bug where zero-sized arrays weren't warned about when the size was unsigned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86136 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 3608d34..779f680 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -550,6 +550,12 @@
     // A tagged type (struct/union/enum/class) is incomplete if the decl is a
     // forward declaration, but not a full definition (C99 6.2.5p22).
     return !cast<TagType>(CanonicalType)->getDecl()->isDefinition();
+  case ConstantArray:
+    // An array is incomplete if its element type is incomplete
+    // (C++ [dcl.array]p1).
+    // We don't handle variable arrays (they're not allowed in C++) or
+    // dependent-sized arrays (dependent types are never treated as incomplete).
+    return cast<ArrayType>(CanonicalType)->getElementType()->isIncompleteType();
   case IncompleteArray:
     // An array of unknown size is an incomplete type (C99 6.2.5p22).
     return true;