This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problem with destruction of temporary
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Problem with destruction of temporary
- From: Thomas Maeder <maeder at glue dot ch>
- Date: Mon, 24 Jan 2000 23:45:03 +0100
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();
}