[cfe-commits] r81317 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Douglas Gregor dgregor at apple.com
Tue Sep 8 23:04:30 PDT 2009


Author: dgregor
Date: Wed Sep  9 01:04:29 2009
New Revision: 81317

URL: http://llvm.org/viewvc/llvm-project?rev=81317&view=rev
Log:
Fix a thinko

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=81317&r1=81316&r2=81317&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Sep  9 01:04:29 2009
@@ -985,8 +985,14 @@
     //   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<ArrayType> OldArray 
+        = Context.getCanonicalType(Old->getType())->getAs<ArrayType>();
+      CanQual<ArrayType> NewArray 
+        = Context.getCanonicalType(New->getType())->getAs<ArrayType>();
+      if (OldArray->getElementType() == NewArray->getElementType())
+        MergedT = New->getType();
+    }
   } else {
     MergedT = Context.mergeTypes(New->getType(), Old->getType());
   }





More information about the cfe-commits mailing list