From 8dfb7ec475ae0f3bdb631b426d981b328b38e470 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 9 Sep 2009 06:04:29 +0000 Subject: [PATCH] Fix a thinko git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81317 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index a72ca1d01f..8074ab94bf 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -985,8 +985,14 @@ void Sema::MergeVarDecl(VarDecl *New, Decl *OldD) { // 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(); + New->getType()->isArrayType()) { + CanQual OldArray + = Context.getCanonicalType(Old->getType())->getAs(); + CanQual NewArray + = Context.getCanonicalType(New->getType())->getAs(); + if (OldArray->getElementType() == NewArray->getElementType()) + MergedT = New->getType(); + } } else { MergedT = Context.mergeTypes(New->getType(), Old->getType()); } -- 2.40.0