struct "declared with greater visibility than the type of its field" warning
struct "declared with greater visibility than the type of its field" warning
- Subject: struct "declared with greater visibility than the type of its field" warning
- From: Jens Alfke <email@hidden>
- Date: Mon, 26 Oct 2009 15:59:02 -0700
I'm trying to get rid of a pesky compiler warning which makes no sense
to me. I'm wondering whether it's a GCC bug. The C++ code in question
looks like this:
struct EditorInternalCommand { ...... };
static const CommandMap& createCommandMap()
{
struct CommandEntry { const char* name; EditorInternalCommand
command; };
...
When compiled, this last line produces the warning:
warning: 'WebCore::createCommandMap()::CommandEntry' declared with
greater visibility than the type of its field
'WebCore::createCommandMap()::CommandEntry::command'
Apparently the compiler thinks CommandEntry is an externally visible
symbol while EditorInternalCommand is not. The -fvisibility=hidden
flag is set, though, so all of these symbols should be hidden.
Certainly there's no way that a single-use struct type declared only
internally to a single function would be visible.
Weirdly, the simplest way I've found to get rid of the warning is to
move the CommandEntry declaration up above the beginning of the
function. Why would this make it less visible?
I'd be willing to just move the declaration and shrug it off, but my
code-reviewer is being a stickler and doesn't want us to change this
without knowing what the actual issue is and why this fixes it.
[This is using GCC 4.2, build 5574, with Xcode 3.1.3.]
—Jens _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden