gcc should allow to apply the visibility attribute to classes and other complex types. It should behave as if the visibility attribute was specified on each member function and variable, unless one of them "overwrites" the setting by specifying a custom visibility. This feature is necessary to easily control the amount of exported symbols in bigger C/C++ projects. Release: 3.3 Environment: System: Linux matrix 2.4.19-4GB #1 Thu Nov 14 09:55:36 UTC 2002 i686 unknown Architecture: i686 host: i486-suse-linux-gnu build: i486-suse-linux-gnu target: i486-suse-linux-gnu configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i486-suse-linux How-To-Repeat: try to compile this example file: #include <stdio.h> class __attribute__( ( visibility( "hidden" ) ) ) MyClass { public: MyClass(); static int member; }; int MyClass::member; MyClass::MyClass() { } int main() { MyClass f; printf( "%d",MyClass::member ); return 0; } #g++ -Wall test.cc test.cc:9: warning: `visibility' attribute does not apply to types
Fix: see above.
From: Dirk Mueller <dmuell@gmx.net> To: gcc-gnats@gcc.gnu.org Cc: Subject: Re: middle-end/9332: __attribute__ ((visibility("hidden")) should apply to classes Date: Wed, 22 Jan 2003 21:06:20 +0100 On Mit, 15 Jan 2003, gcc-gnats@gcc.gnu.org wrote: can you please merge this report with c++/9282 ? I've reported it twice because somehow GNATS was broken inbetween. Thanks, -- Dirk
*** This bug has been marked as a duplicate of 9283 ***