Destructors are invoked automatically when control leaves the scope in which the object was created. Add an _explicit_ destructor call to that, and you end up with undefined behavior because the automatic destructor invocation will be invoked on an object that no longer exists. However sometimes it is acceptable to have destructor calls for some specific use-cases, i.e. when it is desired to destroy the object but without releasing the memory.


== Noncompliant Code Example

----
MyClass mc;
//...
mc.~MyClass();  // Noncompliant
----


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
