This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with destruction of temporary


Hi

I am using gcc 2.95 on NT 4 SP 6.

The following program's output should be

C::C()
C::C()
C::~C()
C::~C()

but I merely get

C::C()
C::C()
C::~C()

Thomas


#include <iostream>

class C
{
	public:
		C();
		~C();

		bool C::operator==(const C &) const;
};

C::C()
{
	std::cout << "C::C()" << std::endl;
}

C::~C()
{
	std::cout << "C::~C()" << std::endl;
}

bool C::operator==(const C &d) const
{
	return true;
}

bool f()
{
	return false;
}

int main()
{
	return !f() &&  C()==C();
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]