Bug 198967 - new C++ visibility doesn't work as expected
Summary: new C++ visibility doesn't work as expected
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-15 03:35 UTC by Bill Nottingham
Modified: 2014-03-17 03:00 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-09-22 16:49:16 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 19664 0 None None None Never

Description Bill Nottingham 2006-07-15 03:35:08 UTC
Version-Release number of selected component (if applicable):

4.1.1-7

WARNING: C++ doofus here.

Consider the following foo.cpp:

#include <list>

class __attribute__((visibility("default"))) Foo {
public:
        Foo();
        ~Foo();
        std::list<std::string> Bar();

};

$ g++ -Wall -c -o foo.o foo.cpp -fvisibility=hidden
foo.cpp:8: warning: âstd::list<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > Foo::Bar()â declared with
greater visibility than its type

Shouldn't the standard libstdc++ template types (std::list, etc) be visible?

Adding #pragma GCC visiblity push & pop around the "#include <list>" fixes it,
but that seems wrong.

Comment 1 Bill Nottingham 2006-07-15 03:37:18 UTC
Erm, assume there's a #include <string> in there. :)  It still errors...



Comment 2 Jakub Jelinek 2006-07-15 07:44:35 UTC
I thought libstdc++ (particularly bits/c++config) already uses
__attribute__((visibility ("default"))) on the std namespace (and similar
namespaces), but apparently it doesn't.

Comment 3 Jakub Jelinek 2006-07-15 11:09:12 UTC
This isn't anything new BTW, it has never been there so far and thus code
without default visibility around the standard headers has always been broken.

Comment 4 Bill Nottingham 2006-07-17 13:31:49 UTC
Ok, then rather than munge all the #include statements in the package, I can
turn off the visibility flag for the build for now. Any chance that at least
libstdc++ could be fixed to have proper visiblity in the headers?

Comment 5 Jakub Jelinek 2007-09-22 16:49:16 UTC
GCC 4.3 will have that, but for 4.1 such changes are IMHO way too invasive.


Note You need to log in before you can comment on or make changes to this bug.