this is the final bugfix, i've tested with the test cases in the test
directory, and this doesnt changed the result, so it doesnt break any other
stuff :)


Index: Sema/SemaDecl.cpp
===================================================================
--- Sema/SemaDecl.cpp   (revision 46258)
+++ Sema/SemaDecl.cpp   (working copy)
@@ -296,8 +296,8 @@
   if (hasUndefinedLength(NewAT) || hasUndefinedLength(OldAT)) {
     if (NewAT->getIndexTypeQualifier() != OldAT->getIndexTypeQualifier())
       return false;
-    NewQType = NewAT->getElementType();
-    OldQType = OldAT->getElementType();
+    NewQType = NewAT->getElementType().getCanonicalType();
+    OldQType = OldAT->getElementType().getCanonicalType();
   }

   return NewQType == OldQType;
@@ -338,10 +338,14 @@
     return New;
   }
   // We've verified the types match, now check if Old is "extern".
-  if (Old->getStorageClass() != VarDecl::Extern) {
+  if (Old->getStorageClass() != VarDecl::Extern && New->getStorageClass()
!= VarDecl::Extern) {
     Diag(New->getLocation(), diag::err_redefinition, New->getName());
     Diag(Old->getLocation(), diag::err_previous_definition);
   }
+  // Use non "extern" decl if available
+  if (New->getStorageClass() == VarDecl::Extern) {
+    return Old;
+  }
   return New;
 }

cheers,
Csaba
_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Reply via email to