This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Visibility and C++ Classes/Templates


Geoffrey Keating wrote:

> In the traditional declaration/definition model, if you try to change
> the linkage of something you get an error...

Indeed, if you consider visibility to be an intrinsic property of the
template (like its type, say), you could argue:

(1) the template gets to specify the visibility
(2) all instantiations (explicit or implicit) always get that visibility
(3) if you want a different visibility, you must use an explicit
specialization

But, I think we all agree that's too restrictive; visibility is an
extra-linguistic instruction about a low-level detail, beyond the scope
of the language itself.  So, I think that it's reasonable to allow the
visibility specification on an explicit instantiation.

I don't think a warning about a mismatch between the visibility
specified by the template and the instantiation is particularly useful
-- but maybe what we should do is try to discourage the use of the
#pragma in favor of the attribute?  (There are no scoping problems with
attributes.)

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]