[fpc-pascal] Compile error with published field
post at joaomorais.com.br
Sat Nov 18 16:31:35 CET 2006
Michael Van Canneyt wrote:
>>> This is the code:
>>> TPressObject = class(TPressSubject)
>>> _Id: TPressString;
>>> private // <- compiler stops here
>>> and this is the inheritance:
>>> TPersistent (Classes unit)
>>> +-TPressStreamable (PressClasses unit)
>>> +-TPressSubject (PressSubject unit)
>>> +-TPressObject (PressSubject unit)
>>> +-TPressAttribute (PressSubject unit)
>>> +-TPressString (PressSubject unit)
>>> I also tried to move the member to the published area; declared the class
>>> under the $M+ directive; but no success. Moving the _Id member to the
>>> private area solves the compilation problem.
>> The problem is - TPressString is a forward declaration and the compiler
>> doesn't know that it inherits from TPersistent. Is this the expected behavior?
> The compiler has no idea that _Id is publishable, and therefor rejects it.
But is this the correct behavior, a non implemented feature or a bug?
(note - Delphi doesn't raise this error)
More information about the fpc-pascal