Exposing a base class destructor as virtual means breaking ABI backward compatiblity?

  abi, c++

I have the following interface class:

class __attribute__((visibility("default"))) Base
{
public:
  Base() = default;

  virtual rtype method1() = 0;
  virtual rtype method2() = 0;
···
  virtual rtype methodN() = 0;
}

And the following child class:

class __attribute__((visibility("default"))) Child
{
public:
  Child() = default;
  virtual ~Child() = default;


  virtual rtype method1()
  {
    ···
  }

  virtual rtype method2()
  {
    ···
  }
···
  virtual rtype methodN()
  {
    ···
  }
}

Both classes are exposed in a shared library. Now, I want to make the following change to the classes:

Base class:

class __attribute__((visibility("default"))) Base
{
public:
  Base() = default;
  // This is the change
  virtual ~Base() = default;

  virtual rtype method1() = 0;
  virtual rtype method2() = 0;
···
  virtual rtype methodN() = 0;
}

Child class:

class __attribute__((visibility("default"))) Child
{
public:
  Child() = default;
  // This is the change
  ~Child() override = default;


  virtual rtype method1()
  {
    ···
  }

  virtual rtype method2()
  {
    ···
  }
···
  virtual rtype methodN()
  {
    ···
  }
}

So my question here is making such change will break ABI backward compatiblity?
My asumption here is that it will as I am adding a new entry to the Base class vtable, but I ran
abi-compliance-checker and it reported no problems… so what do you think?

Source: Windows Questions C++

LEAVE A COMMENT