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

            Bug ID: 70480
           Summary: Reduce RTTI code bloat for specified types
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: frankhb1989 at gmail dot com
  Target Milestone: ---

There are cases that certain type info symbols are not needed, e.g. a class as
operand of 'typeid' which has multiple Boost.Operators bases. These base
classes are essentially insignificant in the class hierarchy when the program
is running, and no sane users would play them with 'dynamic_cast'/'typeid' or
handling them in 'catch' clauses. So it is unnecessary to emit type info for
these types. However, I find no way to suppress the bloated symbol generation
for them separately, even if these bases themselves are not operands of
'typeid'. (Note I do want RTTI elsewhere in the same translation units, so
'-fno-rtti' does not work.) LTO also fails to optimize them away. Can there be
some attributes on the class-definitions or base-specifiers tweaking the
behavior here? With such attributes the compiler can also warn about unintended
use.

Reply via email to