Sorry. Here are some oddments: OUTPUT: derived pure virtual method called terminate called without an active exception In my code I have received a SEGMENT FAULT as well as the above. When I try to catch the error with a try-catch statement, the exception is not caught. thanks art ----- Original Message ---- From: Arthur Schwarz <aschwarz1309@xxxxxxx> To: Andrew Haley <aph@xxxxxxxxxx> Sent: Fri, October 19, 2012 2:43:55 PM Subject: Re: C++ SEGMENT fault and vtable issu Hi Andrew; I must say its much easier to develop an example now that I know what the problem is; My thought is that the virtual table pointer (vptr) is made unusable by C++ as a result of executing the delete statement. Wonderful things happen when attempting to use a stale pointer. In the larger example the wond'rous things have led to several diagnostic messages. The difficulty I had in tracking down this issue is the the IDE (Netbeans) does not always display the vptr, so I can not detect when it changes, and the debugger (gdb 4.5.3) doesn't seem to automatically track C++ kernel code. Although I suspect going to the disassembled code will allow the debugger track C++ kernel calls, without documentation I wouldn't know what to make of the code. Anyhow, I couldn't find the problem using the debugger. Now that I realize what the fault is, I will substitute another method for delete. In my code there are 5 cases where delete is needed. This one case can not use a delete operator. As an unrelated issue, I do notice that 'class base { }' causes an error to be output while 'class base { };' does not. The error message is 'main.cpp:21:2: error: multiple types in one declaration' which seems to be a strange message even if legitimate. thanks art [code] # include <iostream> # include <cstdlib> using namespace std; class base { public: base() { } ~base() { } void * operator new(size_t size) { static int freespace; return (void*)&freespace; } void operator delete(void * ptr) { } virtual void fnc() = 0; }; class derived : public base { public: void fnc() { cout << "derived" << endl; } }; int main(int argc, char** argv) { derived* ptr = new derived(); ptr->fnc(); delete ptr; ptr->fnc(); return 0; } [/code' ----- Original Message ---- From: Andrew Haley <aph@xxxxxxxxxx> To: Arthur Schwarz <aschwarz1309@xxxxxxx> Cc: Jonathan Wakely <jwakely.gcc@xxxxxxxxx>; gcc-help@xxxxxxxxxxx Sent: Fri, October 19, 2012 11:19:36 AM Subject: Re: C++ SEGMENT fault and vtable issu On 10/19/2012 10:52 AM, Arthur Schwarz wrote: > As to the case in point, I would rather have comments concerning how to > correctly override 'new' and 'delete', or references which increase my > understanding, than admonitions saying "do not use". There are, I think, > good reasons that overriding was chosen over reinventing. > > I would be absolutely delighted to have someone provide support in this > effort and openly solicit anyone for any help. Well, you've done something wrong. We don't know what that is because you haven't given us a test case. Once you give us some code that demonstrates the problem we'll tell you what's wrong. All you have to do is boil the problem down to something small enough to send. Andrew.