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

             Bug #: 51930
           Summary: Explicitly instantiated template gets hidden
                    visibility
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: s...@s-e-f-i.de


gcc-4.7 produces a symbol with hidden visibility for testfunc<foo>, while
gcc-4.6 produces a symbol with default visibility.

struct foo
{
};

template<
        typename T
>
__attribute__ ((visibility("default")))
void testfunc();

template<
        typename T
>
void testfunc()
{
}

template
__attribute__ ((visibility("default")))
void testfunc<foo>();


I compiled this with 
g++-4.7 -fvisibility=hidden -shared test.cpp


If I replace

struct foo {};

with 

struct __attribute__ ((visibility("default"))) foo {};

then testfunc<foo> gets default visibility even with gcc-4.7.

Is this intentional?

Reply via email to