https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81764
Bug ID: 81764 Summary: Visibility for explicitly instantiated template class get warned if it was implicitly instantiated Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lanxingcan at gmail dot com Target Milestone: --- ```cpp template<typename ...> class g; template<typename ...T> class __attribute((visibility("default"))) g { g() = default; static int f(int x) { return g<>::yyy::u(x); // g<> instantiated here } struct yyy { static int u(int x){ return x+ sizeof...(T); } }; }; extern template class __attribute((visibility("default"))) g<>; template class g<>; ``` g++ says: extern-template.cc:23:60: warning: type attributes ignored after type is already defined [-Wattributes] extern template class __attribute((visibility("default"))) g<>; Is this behaviour intended?