title: Member corrupted by initialization of following member
body: <p>During initialization of my class <code>CTestController</code> a member std::vector gets corrupted and I have no idea what causes this behavior.</p>
  
  <p>The situation is as follows:</p>
  
  <pre><code>class TestController
  {
      // ...   
      CReport m_report;
      CTestInspector m_testInspector;
      // ...
  }
  </code></pre>
  
  <p>These members get implicitly instantiated in the constructor of <code>CTestController</code>.</p>
  
  <pre><code>class CReport : public CGenericReport
  {
      // ...
      std::vector&lt;SReportData&gt; m_data;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class CGenericReport
  {
      // ...
      COLORREF m_bgColor;
      const short m_dmOrient;
      long m_defaultCX;
      long m_defaultCY;
      CWnd m_wnd;
  }
  </code></pre>
  
  <p><code>m_data</code> is the last member element of <code>CReport</code>. It gets properly initialized with size = capacity = 0.</p>
  
  <p>Nothing fancy with the struct:</p>
  
  <pre><code>struct SReportData
  {
      CPoint pos;
      std::tstring text;
      int fontType;
      COLORREF color;
  };
  </code></pre>
  
  <p>After initialization of <code>m_data</code> in <code>CReport</code> I save the address of its <code>_Myend</code> pointer:<br>
  <strong>0x03D84500</strong><br>
  A data breakpoint on that location gets immediately hit in the constructor of <code>CTestInspector</code>, when the member <code>m_testInspector</code> in <code>CTestController</code> is located at (<code>&amp;m_testInspector</code>):<br>
  <strong>0x03D84502</strong>!<br>
  This corrupts the <code>_Myend</code> pointer resulting in an erroneous <code>capacity</code> (eg. 3014656) in <code>CReport.m_data</code>.</p>
  
  <p><strong>What could be the reason for this corruption?</strong></p>
  
  <p>Additional information:  </p>
  
  <ul>
  <li>Clean/rebuild does not help</li>
  <li>I'm using MFC and Unicode</li>
  <li>Same problem after upgrading to Visual Studio 2013</li>
  <li><code>CGenericReport</code> belongs to another DLL project as <code>CReport</code>, moving it to the same module doesn't help</li>
  <li><code>sizeof(SReportData)</code> = 44</li>
  <li><code>std::tstring</code> is typedefed <code>std::wstring</code></li>
  </ul>