cpp: fix virtual destructors in inheritance tree

For some reason we were not generating the leaf type destructor. Its
normally fine as long as the base type has a virtual destructor, as I
understand it, but in some cases it seems that the compiler generated
destructor does not have the correct exception specifier, causing
compilation errors.