diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2007-10-03 19:38:01 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-10-03 21:38:01 +0200 |
commit | fea10e36471d91c13fde543bfc565e2625cac8ee (patch) | |
tree | 1ae0add9e43f6aca57f3c134fe96b708789803a2 /gcc/cp | |
parent | 0064fbe9b6d395c794fc021d6dc97b40f9d7ac92 (diff) | |
download | gcc-fea10e36471d91c13fde543bfc565e2625cac8ee.zip gcc-fea10e36471d91c13fde543bfc565e2625cac8ee.tar.gz gcc-fea10e36471d91c13fde543bfc565e2625cac8ee.tar.bz2 |
decl.c (duplicate_decls): Preserve linkage flags for mere redeclarations of gnu_inline definitions.
2007-10-01 Alexandre Oliva <aoliva@redhat.com>
* decl.c (duplicate_decls): Preserve linkage flags for mere
redeclarations of gnu_inline definitions.
* g++.dg/ext/gnu-inline-global-redecl.C: New.
From-SVN: r128992
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 02d549f..2efe051 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2007-10-03 Alexandre Oliva <aoliva@redhat.com> + + * decl.c (duplicate_decls): Preserve linkage flags for mere + redeclarations of gnu_inline definitions. + 2007-10-03 Jason Merrill <jason@redhat.com> PR c++/15764 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d653fc4..83195af 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1846,24 +1846,24 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) new_template = NULL_TREE; if (DECL_LANG_SPECIFIC (newdecl) && DECL_LANG_SPECIFIC (olddecl)) { - bool old_decl_gnu_inline; + bool new_redefines_gnu_inline = false; - if ((DECL_INTERFACE_KNOWN (olddecl) - && TREE_CODE (olddecl) == FUNCTION_DECL) - || (TREE_CODE (olddecl) == TEMPLATE_DECL - && TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL)) + if (new_defines_function + && ((DECL_INTERFACE_KNOWN (olddecl) + && TREE_CODE (olddecl) == FUNCTION_DECL) + || (TREE_CODE (olddecl) == TEMPLATE_DECL + && (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) + == FUNCTION_DECL)))) { tree fn = olddecl; if (TREE_CODE (fn) == TEMPLATE_DECL) fn = DECL_TEMPLATE_RESULT (olddecl); - old_decl_gnu_inline = GNU_INLINE_P (fn) && DECL_INITIAL (fn); + new_redefines_gnu_inline = GNU_INLINE_P (fn) && DECL_INITIAL (fn); } - else - old_decl_gnu_inline = false; - if (!old_decl_gnu_inline) + if (!new_redefines_gnu_inline) { DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl); DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl); |