Thread View: gnu.g++.bug
1 messages
1 total messages
Started by David Fox
Tue, 02 Jan 1990 21:30
destructor called for object that never was
Author: David Fox
Date: Tue, 02 Jan 1990 21:30
Date: Tue, 02 Jan 1990 21:30
21 lines
914 bytes
914 bytes
I am running the g++ from interviews of December 21
on a sun-4. The program below constructs an "X" only when
the if condition is satisfied, but it mistakenly destructs
it regardless. Enclosing the for statment in braces is a
workaround. Cfront behaves correctly.
#include <stream.h>
class X {
int a;
public:
X() : a(123) {}
X(int n) : a(n) {}
~X() {cout << "Deleting " << a << "\n";}
};
main(int ac)
{
if (ac > 1)
for (X x(5); ac > 0; ac--);
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads