diff options
author | Jason Merrill <jason@redhat.com> | 2014-07-30 13:27:14 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-07-30 13:27:14 -0400 |
commit | d5d0ed2d89a56273efe30331c3e94651134615e7 (patch) | |
tree | 043925ba81282b0a865db1992b86c852a51fdf2f /gcc/cp/decl.c | |
parent | ea3e455ac77a67e96a916c4c64249be8e20124cd (diff) | |
download | gcc-d5d0ed2d89a56273efe30331c3e94651134615e7.zip gcc-d5d0ed2d89a56273efe30331c3e94651134615e7.tar.gz gcc-d5d0ed2d89a56273efe30331c3e94651134615e7.tar.bz2 |
re PR lto/53808 (Undefined symbol when building a library with lto)
PR lto/53808
PR c++/61659
* pt.c (push_template_decl_real): Set DECL_COMDAT on templates.
(check_explicit_specialization): Clear it on specializations.
* decl.c (duplicate_decls, start_decl): Likewise.
(grokmethod, grokfndecl): Set DECL_COMDAT on inlines.
* method.c (implicitly_declare_fn): Set DECL_COMDAT. Determine
linkage after setting the appropriate flags.
* tree.c (decl_linkage): Don't check DECL_COMDAT.
* decl2.c (mark_needed): Mark clones.
(import_export_decl): Not here.
From-SVN: r213307
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index aafb917..fd5e2e5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2197,6 +2197,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) olddecl); SET_DECL_TEMPLATE_SPECIALIZATION (olddecl); + DECL_COMDAT (newdecl) = DECL_DECLARED_INLINE_P (olddecl); /* Don't propagate visibility from the template to the specialization here. We'll do that in determine_visibility if @@ -4683,6 +4684,10 @@ start_decl (const cp_declarator *declarator, if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl)) { SET_DECL_TEMPLATE_SPECIALIZATION (decl); + if (TREE_CODE (decl) == FUNCTION_DECL) + DECL_COMDAT (decl) = DECL_DECLARED_INLINE_P (decl); + else + DECL_COMDAT (decl) = false; /* [temp.expl.spec] An explicit specialization of a static data member of a template is a definition if the declaration @@ -7663,7 +7668,10 @@ grokfndecl (tree ctype, /* If the declaration was declared inline, mark it as such. */ if (inlinep) - DECL_DECLARED_INLINE_P (decl) = 1; + { + DECL_DECLARED_INLINE_P (decl) = 1; + DECL_COMDAT (decl) = 1; + } if (inlinep & 2) DECL_DECLARED_CONSTEXPR_P (decl) = true; @@ -14223,6 +14231,7 @@ grokmethod (cp_decl_specifier_seq *declspecs, check_template_shadow (fndecl); + DECL_COMDAT (fndecl) = 1; DECL_DECLARED_INLINE_P (fndecl) = 1; DECL_NO_INLINE_WARNING_P (fndecl) = 1; |