diff options
author | Jason Merrill <jason@redhat.com> | 2020-01-07 10:05:25 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2020-01-07 10:05:25 -0500 |
commit | bd65538abb6a48c97f9fd02d037b41e5a6397a70 (patch) | |
tree | 31186666c87d3f4b819b1ee7f2c251b168cf0b80 /gcc/cp | |
parent | 66b01cc3421055806f51ac36a8d237536970504c (diff) | |
download | gcc-bd65538abb6a48c97f9fd02d037b41e5a6397a70.zip gcc-bd65538abb6a48c97f9fd02d037b41e5a6397a70.tar.gz gcc-bd65538abb6a48c97f9fd02d037b41e5a6397a70.tar.bz2 |
PR c++/47877 - -fvisibility-inlines-hidden and member templates.
DECL_VISIBILITY_SPECIFIED is also true if an enclosing scope has explicit
visibility, and we don't want that to override -fvisibility-inlines-hidden.
So check for the attribute specifically on the function, like we already do
for template argument visibility restriction.
* decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
explicit class visibility for a template.
From-SVN: r279960
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a82b6cf..a7234b8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2020-01-07 Jason Merrill <jason@redhat.com> + + PR c++/47877 - -fvisibility-inlines-hidden and member templates. + * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats + explicit class visibility for a template. + 2020-01-07 Richard Sandiford <richard.sandiford@arm.com> * mangle.c (mangle_type_attribute_p): New function, split out from... diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9fb1d81..a641667 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2629,6 +2629,7 @@ determine_visibility (tree decl) tree attribs = (TREE_CODE (decl) == TYPE_DECL ? TYPE_ATTRIBUTES (TREE_TYPE (decl)) : DECL_ATTRIBUTES (decl)); + tree attr = lookup_attribute ("visibility", attribs); if (args != error_mark_node) { @@ -2636,7 +2637,7 @@ determine_visibility (tree decl) if (!DECL_VISIBILITY_SPECIFIED (decl)) { - if (!DECL_VISIBILITY_SPECIFIED (pattern) + if (!attr && determine_hidden_inline (decl)) DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN; else @@ -2650,7 +2651,7 @@ determine_visibility (tree decl) if (args /* Template argument visibility outweighs #pragma or namespace visibility, but not an explicit attribute. */ - && !lookup_attribute ("visibility", attribs)) + && !attr) { int depth = TMPL_ARGS_DEPTH (args); if (DECL_VISIBILITY_SPECIFIED (decl)) |