Bug#4011: simple c++ program segfaults
> > Is this actually a bug? I don't think you are supposed to call a
> > destructor directly in this situation. I would assume that the crash
> > comes when the destructor is called a second time when the program
> > exits main.
>
> It is legal to explicitly call a destructor but rarely needed. It
> certainly makes no sense in this case, as the destructor will be called
> twice.
It is legal, but highly discouraged! If the dtor is not implemented
with
this in mind (as most are not), then that could very easily be the cause
of the seg fault.
Brian
( bcwhite@verisim.com )
-------------------------------------------------------------------------------
In theory, theory and practice are the same. In practice, they're
not.
Reply to: