title: Compiler bug when using generics and forward declaration in Delphi XE2
body: <p>I started project on Delphi 2010, then migrated to XE and now I try to migrate to XE2.
  After compiling in XE2 (Update 4 Hotfix 1), unit tests began fail with AV.
  After some debugging, it became clear that the following code is not correctly compiled:</p>
  
  <pre><code>program ForwardDeclaration;
  
  {$APPTYPE CONSOLE}
  
  uses
      System.SysUtils;
  
  type
      TEntityBase = class(TObject)
      protected
          FModel: Integer;
      public
          constructor Create(const AModel: Integer);
      end;
  
      TEntity&lt;TKey&gt; = class(TEntityBase)
      end;
  
      TMyEntity2 = class;
  
      TMyEntity1 = class(TEntity&lt;Integer&gt;)
          FData: Integer;
      end;
  
      TMyEntity2 = class(TMyEntity1)
      end;
  
  constructor TEntityBase.Create(const AModel: Integer);
  begin
      inherited Create;
      FModel := AModel;
  end;
  
  var
      MyEntity: TMyEntity1;
  begin
      try
          Writeln(TEntityBase.ClassName, ': ', TEntityBase.InstanceSize, ' bytes');
          Writeln(TMyEntity1.ClassName, ': ', TMyEntity1.InstanceSize, ' bytes');
          MyEntity := TMyEntity1.Create(100);
          Assert(MyEntity.FData = 0);
      except
          on E: Exception do Writeln(E.ClassName, ': ', E.Message);
      end;
  end.
  </code></pre>
  
  <p>Program outputs:</p>
  
  <pre><code>TEntityBase: 12 bytes
  TMyEntity1: 12 bytes &lt;-- Must be 16 bytes!
  EAssertionFailed: Assertion failure (ForwardDeclaration.dpr, line 41)
  </code></pre>
  
  <p>Is it possible to resolve the problem by tuning compiler options?</p>
  
  <p>Whether this problem repeats at someone else?</p>
  
  <p>P.S.
  <a href="http://qc.embarcadero.com/wc/qcmain.aspx?d=107110">QC107110</a></p>