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

            Bug ID: 61718
           Summary: Visibility issue with template class
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: goughost at yahoo dot com.cn

With this code snippet::
  #pragma GCC visibility push(hidden)
  #define YYY_VIS ???
  #define XXX_VIS ???
  class YYY_VIS YYY;
  template <typename T>
  class XXX_VIS XXX {
    void func() {
      return;
    }
  };
  template class XXX<YYY *>;

Compiling with different definitions of XXX_VIS and YYY_VIS, results in the
following table::
  XXX_VIS    YYY_VIS      func visibility when compiled
  default    default      visible
  default    <nothing>    hidden
  <nothing>  default      hidden
  <nothing>  <nothing>    hidden

Here, ``default`` is short for ``__attribute__((visibility("default")))``, and
``<nothing>`` means empty macro.

What is the rational behind the 2nd row in the table? My expection is that
``func`` is visible when ``XXX`` is declared visible, no matter what YYY is.

Reply via email to