Rule: Polymorphic type has a non-virtual destructor¶
Canonical rule slug: polymorphic-nonvirtual-dtor. ← back to all rules
A type with virtual functions is destroyed through a base pointer without a virtual destructor, so derived state is never destroyed.
Canonical demonstration¶
- case165_polymorphic_nonvirtual_dtor — Polymorphic Type Without a Virtual Destructor (New Anti-Pattern) (🟡 COMPATIBLE_WITH_RISK)