//////////////////////////////////////////////////
#include <exception>
class MyException : public std::exception
{
public:
int NonVirtualFun()
{
return VirtualFun();
}
virtual int VirtualFun()
{
return 0;
}
};
int main()
{
MyException a, b;
a = b; // Internally calls std::exception::operator=.
return a.NonVirtualFun(); // MSVC 2003 crash!
}
//////////////////////////////////////////////////
Is this a known issue? Fortunately I could not reproduce the crash on later
versions of Visual C++. So is it fixed? I couldn't find a bug report on the
issue.
Originally I thought that it had to do with the bug reported by Jouni
Kiviniemi at
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=328570
"Memory leak on std::exception assignment operator", but that one doesn't
mention any crash.
Kind regards,
--
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center