While I was looking at something else it occurred to me that
vague_linkage_p ought to return true for local statics in functions with
vague linkage. I don't know that this actually affects anything, but it
seems more correct.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit ee36858346a404ac07e05c5b25cf2c8e652c4bfa
Author: Jason Merrill <ja...@redhat.com>
Date: Tue Feb 25 15:34:29 2014 -0500
* decl2.c (vague_linkage_p): Local statics have vague linkage.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 918ea2f..7140218 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -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,