[cfe-dev] is delete on abstract with non-virtal ever safe?

emmanuel.attia emmanuel.attia at philips.com
Fri Oct 4 07:52:47 PDT 2013


Jonathan Sauer wrote
> But the standard talks about *trivial* destructors, not *virtual* ones.
> From ยง12.4p5:
> 
> | A destructor is trivial if it is not user-provided and if:
> 
> So the moment you define a destructor you have a non-trivial one. 

In my example my_destroy_interface has no destructor.
So when delete (my_destroy_interface*) is called:
* no (non-trivial) destructor is called
* operator delete is called
* in the body of operator delete, the object is still valid according to the
rule, until the memory is released.



--
View this message in context: http://clang-developers.42468.n3.nabble.com/is-delete-on-abstract-with-non-virtal-ever-safe-tp4025653p4034883.html
Sent from the Clang Developers mailing list archive at Nabble.com.




More information about the cfe-dev mailing list