]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* decl2.c (vague_linkage_p): Local statics have vague linkage.
authorJason Merrill <jason@redhat.com>
Fri, 2 May 2014 20:56:41 +0000 (16:56 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 2 May 2014 20:56:41 +0000 (16:56 -0400)
From-SVN: r210019

gcc/cp/ChangeLog
gcc/cp/decl2.c

index 422e98cb980a6b708f3eca5fd77118e746d87fc0..d15fed166cf32cc4e92d9ccbc1275eeda5b2b6b6 100644 (file)
@@ -1,5 +1,7 @@
 2014-05-02  Jason Merrill  <jason@redhat.com>
 
+       * decl2.c (vague_linkage_p): Local statics have vague linkage.
+
        PR c++/60992
        * lambda.c (lambda_capture_field_type): Wrap anything dependent
        other than 'this'.
index 918ea2fc6d08d5eac4455ef9e0ba22f36669c254..71402181af6160207aa7479d4eed1291f5568fc5 100644 (file)
@@ -1804,12 +1804,19 @@ vague_linkage_p (tree decl)
   /* Unfortunately, import_export_decl has not always been called
      before the function is processed, so we cannot simply check
      DECL_COMDAT.  */
-  return (DECL_COMDAT (decl)
-         || (((TREE_CODE (decl) == FUNCTION_DECL
-               && DECL_DECLARED_INLINE_P (decl))
-              || (DECL_LANG_SPECIFIC (decl)
-                  && DECL_TEMPLATE_INSTANTIATION (decl)))
-             && TREE_PUBLIC (decl)));
+  if (DECL_COMDAT (decl)
+      || (((TREE_CODE (decl) == FUNCTION_DECL
+           && DECL_DECLARED_INLINE_P (decl))
+          || (DECL_LANG_SPECIFIC (decl)
+              && DECL_TEMPLATE_INSTANTIATION (decl)))
+         && TREE_PUBLIC (decl)))
+    return true;
+  else if (DECL_FUNCTION_SCOPE_P (decl))
+    /* A local static in an inline effectively has vague linkage.  */
+    return (TREE_STATIC (decl)
+           && vague_linkage_p (DECL_CONTEXT (decl)));
+  else
+    return false;
 }
 
 /* Determine whether or not we want to specifically import or export CTYPE,