aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c14
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7f23f0f..b9a0638 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-08 Matt Austern <austern@apple.com>
+
+ PR c/13134
+ * decl.c (duplicate_decls): Copy visibility flag when appropriate.
+
2003-12-09 Giovanni Bajo <giovannibajo@gcc.gnu.org>
* init.c (build_new_1): Deal with an OVERLOAD set when
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9c6379f..f205f74 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1854,9 +1854,21 @@ duplicate_decls (tree newdecl, tree olddecl)
TREE_ADDRESSABLE (newdecl) = TREE_ADDRESSABLE (olddecl);
TREE_ASM_WRITTEN (newdecl) = TREE_ASM_WRITTEN (olddecl);
DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
- DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
+ /* If either declaration has a nondefault visibility, use it. */
+ if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT)
+ {
+ if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT
+ && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
+ {
+ warning ("%J'%D': visibility attribute ignored because it",
+ newdecl, newdecl);
+ warning ("%Jconflicts with previous declaration here", olddecl);
+ }
+ DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
+ }
+
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
int function_size;