Don't patch the storage class of static data members

Richard Smith richard at metafoo.co.uk
Thu Apr 4 13:24:39 PDT 2013


@@ -2898,7 +2898,8 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult
&Previous,

   // C99 6.2.2p4: Check if we have a static decl followed by a non-static.
   if (New->getStorageClass() == SC_Static &&
-      (Old->getStorageClass() == SC_None || Old->hasExternalStorage())) {
+      !New->isStaticDataMember() &&
+      isExternalLinkage(Old->getLinkage())) {

This looks backwards -- is the comment here wrong? The 'isStaticDataMember'
check looks like it might be unnecessary, since a redeclaration of a static
data member can't be marked 'static'.


On Thu, Apr 4, 2013 at 11:17 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> This is a  bit of patching that survived 178663. Without it we can
> produce better a better error message for
>
> const int a = 5;
> static const int a;
>
> Cheers,
> Rafael
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130404/55211d3e/attachment.html>


More information about the cfe-commits mailing list