intrusive_ptr
intrusive_ptr copied to clipboard
-Wfree-nonheap-object when using intrusive objects on the stack
GCC warns of -Wfree-nonheap-object when stack-allocating objects that derive from intrusive_base
. The compiler thinks it's weird that there are potentially calls to "delete" on a stack object. Not sure how this warning could be avoided so I personally recommend to silence it at this point if you're ok with being careful of your allocations.
It is probably caused by the destructor, which may delete an object of _Weak_view
and instantiates its destructor, which could potentially instantiate intrusive_ptr
itself and deletion of the aforementioned object, despite unreachability? It has been out of sync so long that I couldn't remember how it goes.