------- Comment #2 from lavock at gmail dot com  2010-02-06 12:05 -------
(In reply to comment #1)
> Your testcase doesn't even compile:
> 
> 42983.C: In function ‘int main()’:
> 42983.C:15:15: error: cannot convert ‘B’ to ‘A*’ in initialization
> 

Sorry, my mistake, i've added an extra *...

#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;
}


-- 

lavock at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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

Reply via email to