[Bug c++/42983] [C++0x] Defaulted virtual destructor isn't virtual
--- Comment #7 from lavock at gmail dot com 2010-02-08 13:49 --- (In reply to comment #5) > n3000 says "Only special member functions may be explicitly defaulted, and the > implementation shall define them as if they had implicit definitions." > > An implicit destructor is not virtual. > An implicit definition does not mean an implicit declaration. Moreover, the norm use sometimes this syntax. There is a thread in comp.std.c++ about this. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42983
[Bug c++/42983] [C++0x] Defaulted virtual destructor isn't virtual
--- Comment #17 from lavock at gmail dot com 2010-02-08 15:18 --- (In reply to comment #16) > Yes, but you're using an experimental implementation of an incomplete > specification. Using it for serious code would be foolish, so I tend to agree > it's low priority Yes, i agree with low priority, but maybe don't mark available for this feature, since it seems to be partially available. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42983
[Bug c++/42983] New: [c++0x] Unvirtualzation of virtual destructor
Hello, The way to declare a inline virtual destructor within the class declaration seems to unvirtualize it. Trying the following code : #include 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
[Bug c++/42983] [c++0x] Unvirtualization of virtual destructor
--- 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 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