diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 39466304f24..17cb3187353 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2007-06-14 Geoff Keating + * 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. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4d46410f6ad..61decb16637 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4d7a16a625e..08bc5ada04d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2007-06-14 Geoff Keating + * 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 index 00000000000..d841c53fb1c --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/visibility/overload-1.C @@ -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) +{ }