diff options
author | Jason Merrill <jason@redhat.com> | 2014-05-02 16:56:41 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-05-02 16:56:41 -0400 |
commit | c4fa3572228b695728835f9f52186f9c584040ab (patch) | |
tree | d025eeb8b5f6b4c915d12540ab9934ea27a3aae3 | |
parent | 43b781fac7673ac9f11105048ccc2a75c8a9f0c3 (diff) | |
download | gcc-c4fa3572228b695728835f9f52186f9c584040ab.zip gcc-c4fa3572228b695728835f9f52186f9c584040ab.tar.gz gcc-c4fa3572228b695728835f9f52186f9c584040ab.tar.bz2 |
* decl2.c (vague_linkage_p): Local statics have vague linkage.
From-SVN: r210019
-rw-r--r-- | gcc/cp/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 422e98c..d15fed1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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'. 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, |