fox@allegra.tempo.nj.att.com (David Fox) (01/03/90)
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--);
}