Re: [Cppunit-devel] Final answer: Exception::operator =() bug with VC++ (was :Partial answer: 2.3) W
Brought to you by:
blep
From: Baptiste L. <bl...@cl...> - 2001-10-06 10:15:21
|
Went one step further in that quest... When the std::exception::operator =() call the destructor and the constructor to do the 'copy', the constructor reset the virtual table back to std::exception virtual table. Therefore, the previous affectation to CppUnit::Exception virtual table is lost, and all call to any virtual function of std::exception (what() is among them) will lead to a call to the std::exception implementatin instead of the most derived class implementation. I beleive this is a MSVC++ STL bug (I'll tell you, that stuff is pure black magic ;-) ). Has anyone heard of it ? Well, anyway I'll go for the simplest thing that could possibly work and comment out the call to std::exception::operator =() in CppUnit::Exception::operator =() (no data from the base class are use anyway). But at least, now we know what is going wrong ! And we finaly got to see the green bar =) Thanks Phil, Baptiste. ----- Original Message ----- From: "Phil Taylor" <phi...@ts...> To: <cpp...@li...> Sent: Thursday, October 04, 2001 2:57 PM Subject: [Cppunit-devel] Partial answer: 2.3) Why does the test ExceptionTest.testAssignment failed in CppUnit test > The implementation of the assignment operator for std::exception in > MSVCRT seems to be cause of the problem. Comment out the > SuperClass::operator= (other) call in Exception::operator=(Exception&) > and the test now passes. > > Examination of MSVCRT disassembly yields some odd-looking (shortcut?) > behavior. It looks as though exception::operator=(exception&) resets > itself by calling its own destructor (memory is not freed) then calls > exception(exception&) to complete the assignment. > > I can't progress the problem any further at this time but the > information above may be of some assistance. > > Regards, > Phil > > > _______________________________________________ > Cppunit-devel mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppunit-devel > |