http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61113

--- Comment #2 from jpakkane at gmail dot com ---
In that case it would fail. But you can make it work by doing this (assuming
compilation with -fvisibility=hidden):

class __attribute__ ((visibility("default"))) Thing final {
public:
  void publicFunc() { privateFunc(); }
private:
  void __attribute__ ((visibility("default"))) privateFunc();
};

That is, explicitly specifying visibility would override whatever heuristics or
command line flags one might have. Calling private methods from public inline
methods remains possible, but takes an extra definition. (There is also the
problem that calling private methods from inline functions make those private
methods part of your ABI, albeit indirectly. You can't change their signatures
without breaking code compiled against the old version.)

I guess the issue here boils down to which is more common: calling private
functions from inline methods or the need to decorate private methods manually
with hidden attributes.

I have only had to deal with the latter case but more experienced people might
have a different opinion.

For what it's worth, GCC's documentation seems to advocate making everything
hidden by default and granting visibility only when needed.

Reply via email to