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

            Bug ID: 113958
           Summary: support visibility attribute for typeinfo symbol
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: noelgrandin at gmail dot com
  Target Milestone: ---

Currently, if I want to compile with visibility=hidden, and only expose some
parts of a class definition to the linker, I can use

    class Foo {
        __attribute__ ((visibility("default"))) some_member() {}
    };

on the individual class members. Unfortunately, if external code wants to
dynamic_cast that class, then I end up with 

    /usr/bin/ld: libsvxlo.so: undefined reference to `typeinfo for SvxCharView'

When compiling with clang, I can specify

   __attribute__ ((type_visibility("default"))) class Foo {}

to solve the typeinfo linkage problem.

It would be wonderful if GCC could support something similar.

Reply via email to