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

--- Comment #3 from R. Diez <rdiez-2006 at rd10 dot de> ---
This is an example:

class test_class
{
public:
  // The mere existence of this empty constructor is enough
  // to make GCC generate an empty _GLOBAL__sub_I_main block
  // and to keep all unused virtual methods.
  test_class ( void )
  {
  }

  virtual int unused1 ( void ) { return 1; }
  virtual int unused2 ( void ) { return 2; }
  virtual int unused3 ( void ) { return 3; }
  virtual int unused4 ( void ) { return 4; }
  virtual int unused5 ( void ) { return 5; }
};

static test_class test_instance;

int main ( void )
{
}


You can play with it here:  https://godbolt.org/z/EPco45T3f

Reply via email to