aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Type.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-11-05 15:52:31 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-11-05 15:52:31 +0000
commit923d56d436f750bc1f29db50e641078725558a1b (patch)
tree880fa20f7e980c3b978481425084763f696ceeb3 /lib/AST/Type.cpp
parent2ac67239b4ab81c439ffcc56367574c869f87dae (diff)
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
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r--lib/AST/Type.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 3608d34c69..779f6808b6 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -550,6 +550,12 @@ bool Type::isIncompleteType() const {
// 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;