public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Christopher Sigman <c.s.sigman@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Warning message with usage of visibility hidden with wrapper class
Date: Thu, 31 May 2012 09:03:00 -0000	[thread overview]
Message-ID: <CAH6eHdRXBgeP8UyyipnVKM5MNyRCD1XB4xwBYvM-AL+g4x9K4w@mail.gmail.com> (raw)
In-Reply-To: <CALvcSj91p6t9SC03pAoRY=q0eP=Z4euWyRHXH2z9E1ML-FJ9jw@mail.gmail.com>

On 31 May 2012 02:42, Christopher Sigman <c.s.sigman@gmail.com> wrote:
> Hi everyone,
>
> Attached is some example code that exhibits the issue.  In terms of

A simpler example is

struct __attribute__ ((visibility("hidden"))) Hidden
{
  int something;
};

template <typename T>
struct Visible
{
  Hidden inner;
};

int main()
{
  Visible<int> i;
}


> GCC versions, I think we've seen it in everything from 4.1.2 on, but I
> know for a fact that I see it in 4.4.x, and 4.5.1.  I know that if I

It's still present in the latest versions.

> add -fvisibility=hidden to compilation of anything linking to the
> library resolves the warning,

That's because it gives Visible<int> hidden visibility.

> but as I said before, I'm trying to
> understand why we're getting the warning with it as it is (in our
> actual code, we can't set the default visibility to hidden on
> libraries or executables linking to those libraries at the moment).

The compiler is warning you that if you're trying to make Visible<int>
visible outside a shared library then one of its members has hidden
visibility and can't be exported. It's irrelevant that it's a private
member.

      reply	other threads:[~2012-05-31  9:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24  2:02 Christopher Sigman
2012-05-24 10:05 ` Jonathan Wakely
2012-05-31  1:42 ` Christopher Sigman
2012-05-31  9:03   ` Jonathan Wakely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH6eHdRXBgeP8UyyipnVKM5MNyRCD1XB4xwBYvM-AL+g4x9K4w@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=c.s.sigman@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).