In bug 10591, it's pointed out that you can use the ODR rules to clear the
TREE_PUBLIC flag.  You can do the same thing to make something have hidden
visibility even though it's not declared so.

In fact, this is a requirement.  For example, in bug 19664, I mention that if
the user declares

struct mytype __attribute__((visibility(hidden))) { ... };
vector<mytype> x;

then everything to do with 'vector<mytype>' needs to be hidden, because a user
could do the same thing in a different shared object with a different 'mytype'.
 Likewise,

struct a_struct __attribute__((visibility(hidden)));
void foo(a_struct &) { }

Even though "foo" is not marked hidden it should still be hidden, because it
could be overloaded in a different shared object with a parameter which has
type 'a_struct &' but is a different type.

This is especially important when 'func' is 'operator ==' or similar.


-- 
           Summary: visibility and ODR
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: geoffk at gcc dot gnu dot org
OtherBugsDependingO 19664
             nThis:


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26612

Reply via email to