Serializing a COleDateTime object failes with VC++ 2005
I'm trying to build and run a MFC-based program with VS2005. It contains these lines of code:
m_pTime =
new Dat_DateTime; // Dat_DateTime is derived from COleDateTimem_pTime->m_status = COleDateTime::valid;
ar >> m_pTime->m_dt; // ar is of typeCArchive&
When I compile this with VC++ 2003 the Watch window looks like this (as it should):
- m_pTime 0x0af92470 Dat_DateTime*
- ATL::COleDateTime {...} ATL::COleDateTime
m_dt 38426.54724537037 double
m_status 0 ATL::COleDateTime::DateTimeStatus
But when I compile with VC++ 2005 (unchanged project settings) and test using the same input data I get this at the same break location:
- m_pTime 0x0807b968 Dat_DateTime*
- ATL::COleDateTime {...} ATL::COleDateTime
m_dt 38426.5 double
m_status error: unable to access invalid memory location ATL::COleDateTime::DateTimeStatus
and I get an exception when trying to access this variable later on. (note: the value "38426.5" is not a typo, it really looks truncated like this).
What is happening here? Is this a bug or can I do something to fix this behavior?
Thanks.

