This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR c++/77306 - Unable to specify visibility for explicit template instantiations
- From: Jason Merrill <jason at redhat dot com>
- To: James Abbatiello <abbeyj at gmail dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 24 May 2017 15:20:54 -0400
- Subject: Re: [PATCH] PR c++/77306 - Unable to specify visibility for explicit template instantiations
- Authentication-results: sourceware.org; auth=none
- References: <20170422204640.47837-1-abbeyj@gmail.com>
On Sat, Apr 22, 2017 at 4:46 PM, James Abbatiello <abbeyj@gmail.com> wrote:
> PR c++/77306
> * attribs.c (decl_attributes): Allow visibility attributes on explicit
> template instantiations.
> * gcc-family/c-attribs.c (handle_visibility_attribute): Likewise.
This doesn't seem sufficient; any members that have already been
instantiated will still have the default visibility. If you want to
go this way, you'll need to call reset_type_linkage when changing the
visibility of a type that's already defined.
Is there a reason you can't declare the visibility before the first
use of A<double>, e.g.
extern template struct __attribute ((visibility("hidden"))) A<double>;
followed later by
template class A<double>;
?
Jason