Главная страница | назад





Article #19648: Working around GH1949 internal error.

 Question and Answer Database

     FAQ: FAQ4648C - Working around GH1949 internal error.
Category: Compiler
Platform: All-32Bit
 Product: C++Builder4.x,   

Question:

I'm compiling a Delphi unit in Builder and am getting internal 
error GH1949. The code compiled fine in Delphi. What does it 
mean and how do I fix it?


Answer:

The problem here is a bug in the header generation portion 
of the delphi compiler included with Builder (dcc32.exe). 
This bug commonly surfaces when your code defines a class 
inheritance structure looks something like this:

type
  AncestorClass = class
    protected
      AncestorField: Integer;
  end;

  BaseClass = class(AncestorClass);

  MyClass = class(BaseClass)
    protected
      procedure SetField(const Value: Integer);
    public
      property MyField: Integer read AncestorField write SetField;
  end;

MyClass.MyField's read is set to AncestorField, but the bug 
keeps the compiler from finding AncestorField. Instead, the 
compiler sees the empty field list in BaseClass and doesn't 
look any deeper in the ancestry.

To work around this bug, simply add a read function to 
BaseClass that MyClass.MyField can reference. 

The definition of BaseClass becomes:

  BaseClass = class(AncestorClass)
    protected
      function GetAncestorField: Integer;
  end;

The definition of MyClass becomes:

  MyClass = class (BaseClass)
    protected
      procedutre SetField(const Value: Integer);
    public
      property MyField: Integer read GetAncestorField write SetField;
  end;

8/4/99 11:52:49 AM
 

Last Modified: 01-SEP-99