[Bug c++/85071] The g++ delete the memory alloced by new operator before I manually delete it.
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 26 15:52:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85071
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
class Module : public SyntaxElement {
public:
Module() = default;
bool hasCalleesFor(IntrusiveRefCntPtr<Function> func) const
{ return true; }
};
void Context::setAvailableCallees() {
if(!M->hasCalleesFor(F)) return;
}
This creates an IntrusiveRefCntPtr<Function> which owns F, and so at the end of
the statement the smart pointer deletes F.
Any later use of that pointer (via this->F or the global func) is undefined.
More information about the Gcc-bugs
mailing list