Original Post
A buddy of mine posted a piece of code on another BB,
pointing that it might be a compiler bug. The problem
boils down to this code:
// VC++6.0 SP5, on W2k SP2
// Win32 Console App, debug build (default configuration)
class a
{
private:
int m_i;
public:
a operator << (int i);
};
a a::operator <<(int i)
{
m_i = i; // breakpoint here
return *this;
}
int main(int argc, char* argv[])
{
int z = 10;
a aa;
aa << ++z << z;
return 0;
}
When the breakpoint is touched the first time, the operator << gets 11 as function parameter (as expected). When the breakpoint is touched the second time, the parameter is 10.
I think this is a compiler bug. What do you think?
Forever trusting who we are
And nothing else matters - Metallica