decl2.c (determine_visibility): Ensure that functions with hidden types as parameters...
authorGeoffrey Keating <geoffk@apple.com>
Thu, 14 Jun 2007 21:04:10 +0000 (21:04 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Thu, 14 Jun 2007 21:04:10 +0000 (21:04 +0000)
* decl2.c (determine_visibility): Ensure that functions with
hidden types as parameters are hidden.

From-SVN: r125722

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/visibility/overload-1.C [new file with mode: 0644]

index 3946630..17cb318 100644 (file)
@@ -1,5 +1,8 @@
 2007-06-14  Geoff Keating  <geoffk@apple.com>
 
+       * decl2.c (determine_visibility): Ensure that functions with
+       hidden types as parameters are hidden.
+
        PR 31093
        * decl2.c (determine_visibility): Remove duplicate code for
        handling type info.
index 4d46410..61decb1 100644 (file)
@@ -1783,7 +1783,8 @@ determine_visibility (tree decl)
     {
       /* Propagate anonymity from type to decl.  */
       int tvis = type_visibility (TREE_TYPE (decl));
-      if (tvis == VISIBILITY_ANON)
+      if (tvis == VISIBILITY_ANON
+         || ! DECL_VISIBILITY_SPECIFIED (decl))
        constrain_visibility (decl, tvis);
     }
 }
index 4d7a16a..08bc5ad 100644 (file)
@@ -1,5 +1,7 @@
 2007-06-14  Geoff Keating  <geoffk@apple.com>
 
+       * g++.dg/ext/visibility/overload-1.C: New.
+
        PR 31093
        * g++.dg/ext/visibility/anon4.C: New.
 
diff --git a/gcc/testsuite/g++.dg/ext/visibility/overload-1.C b/gcc/testsuite/g++.dg/ext/visibility/overload-1.C
new file mode 100644 (file)
index 0000000..d841c53
--- /dev/null
@@ -0,0 +1,9 @@
+/* Test that visibility of function parameters propagates to an undecorated
+   function. */
+/* { dg-require-visibility "" }
+/* { dg-final { scan-hidden "_Z3fooP8a_struct" } } */
+
+struct __attribute__((visibility("hidden"))) a_struct;
+
+void foo(a_struct * p) 
+{ }