Boost logo

Boost :

Subject: Re: [boost] questions regarding GCC visibility
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-04-01 09:02:11


On 1 Apr 2015 at 11:56, Andrey Semashev wrote:

> I suspect base classes may be restricting visibility of your classes. >From the
> docs[1]:
>
> A class must not have greater visibility than its non-static data member types
> and bases, and class members default to the visibility of their class.
>
> For example, basic_oarchive is marked with BOOST_ARCHIVE_OR_WARCHIVE_DECL but
> noncopyable and helper_collection which it derives from are not, and as such
> have hidden visibility.
>
> [1] https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Function-Attributes.html#Function-Attributes

That GCC doc is poorly worded.

Of course a class can have greater visibility than its base classes
or its member variables. It's just such dependencies must be both
defined and declared in full to the TU needing them.

If you think it through, if this weren't the case then no STL
container type would ever work because none of those are marked with
default visibility.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ 
http://ie.linkedin.com/in/nialldouglas/



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk