Hello,
The way to declare a inline virtual destructor within the class declaration
seems to unvirtualize it.
Trying the following code :

#include <iostream>

struct A {
  virtual ~A() = default;
};

struct B : A {
  virtual ~B() {
    std::cout << "B destructor" << std::endl;
  }
};

int main() {
  B* b = new B;
  A * ptrA = *b;
  delete ptrA;
  return 0;
}

Nothing appear on standard output.


-- 
           Summary: [c++0x] Unvirtualzation of virtual destructor
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lavock at gmail dot com
 GCC build triplet: -486-linux-gnu
  GCC host triplet: -486-linux-gnu
GCC target triplet: -i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42983

Reply via email to