aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-09 01:45:28 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-09 01:45:28 +0000
commit3dab34a7cb5e2ad9c2311fc44b3d3b7ebb540992 (patch)
treedaae3f99f8e3c33c25c934b6747b5ae831117e4c /lib
parent3b6afbb99a1c44b4076f8e15fb7311405941b306 (diff)
Allow a declaration of an array to complete a prior, incomplete
declaration of that array in C++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaDecl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 6f04f7b162..a72ca1d01f 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -980,6 +980,13 @@ void Sema::MergeVarDecl(VarDecl *New, Decl *OldD) {
if (getLangOptions().CPlusPlus) {
if (Context.hasSameType(New->getType(), Old->getType()))
MergedT = New->getType();
+ // C++ [basic.types]p7:
+ // [...] The declared type of an array object might be an array of
+ // unknown size and therefore be incomplete at one point in a
+ // translation unit and complete later on; [...]
+ else if (Old->getType()->isIncompleteArrayType() &&
+ New->getType()->isArrayType())
+ MergedT = New->getType();
} else {
MergedT = Context.mergeTypes(New->getType(), Old->getType());
}