[Bug c++/30842] New: Warning received when private class has hidden visibility
9ugsa9j02 at sneakemail dot com
gcc-bugzilla@gcc.gnu.org
Sun Feb 18 15:36:00 GMT 2007
----------------------------------------------------
class A {
class __attribute__((visibility("hidden"))) B {
};
B v;
};
int main (void) { A a; return (0); }
----------------------------------------------------
Compiling the above code with 4.2.0 20070207 generates:
----------------------------------------------------
ex.cc:1: warning: 'A' declared with greater visibility than the type of its
field 'A::v'
----------------------------------------------------
4.0.2 did not generate this warning. I believe this is a bug because A::v is
private and thus does not have to be visible to anyone but A. In fact, the best
solution, IMHO, is to make all private members hidden by default, since they
can not be accessed from outside anyway. The only time the warning would still
be valid is if there are friends in the class.
This may be related to the ADA bug <a
href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24167">24167</a>.
--
Summary: Warning received when private class has hidden
visibility
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: 9ugsa9j02 at sneakemail dot com
GCC host triplet: x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30842
More information about the Gcc-bugs
mailing list