[Bug c++/104631] Visibility of static member s yields duplicate symbols.

amonakov at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 22 14:58:29 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104631

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #3 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Note that what matters is not the type of the member, but whether template
parameters have hidden visibility, as the following example demonstrates:

struct S {
};

template<class T>
struct TS {
        __attribute__((visibility("default")))
        static int i;
        __attribute__((visibility("default")))
        static S s;
};

template<class T>
int TS<T>::i{};

template<class T>
S TS<T>::s{};

template struct TS<int>;
template struct TS<S>;


More information about the Gcc-bugs mailing list