The object is deleted and not used within this context. The error occurs before
the assignment is complete.
I might have a (very strong) misunderstanding of how C++ references work, but,
I don't think that gdb should just quit and not allow me to debug.
In SlipSublist::replace if 'SlipCell& cell' is changed to 'SlipCell* cell',
with appropriate changes to the remaining code, then no error occurs. It is
only when a reference is used do I get into difficulty. I get a SIGSERV error
from gdb in this context and in others when an assignment is made to a
reference variable, 'cell' in this case. Whenever 'variable = somereference' is
executed, gdb faults. 'somereference' can be a function or a variable.
The questions I have are (1) can reference variables not be reassigned?, and (2)
is gdb's SIGSERV fault a legitimate fault or a bug?
Thanks for taking the time;
art
----- Original Message ----
From: Aurelian Melinte<ame01@gmx.net>
To: Arthur Schwarz<aschwarz1309@att.net>
Cc:gdb@sourceware.org
Sent: Tue, October 9, 2012 4:32:20 PM
Subject: Re: SIGSERV termination on return statement
On 09/10/2012 5:48 PM, Arthur Schwarz wrote:
SlipCell& SlipSublist::replace(SlipCell& X) { // Replace a
cell
on a list with a new cell
SlipCell& cell = *this;
if (X.isData()) {
cell = assignData(X); // failure before return to this statement
from
method
*** delete this;
} else {
*this = X;
}
*** return cell;
}; // SlipCell& SlipSublist::replace(SlipCell& X)
Are you returning from a deleted object then using it afterward?
Regards,
Aurelian