[cfe-dev] bugfix(1908): http://llvm.org/bugs/show_bug.cgi?id=1908
Csaba Hruska
csaba.hruska at gmail.com
Tue Jan 22 14:51:26 PST 2008
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080122/28ced116/attachment.html>
More information about the cfe-dev
mailing list