[fpc-devel] Parameters must match exactly?

Florian Klaempfl florian at freepascal.org
Wed May 19 08:44:54 CEST 2010

>>> But that wasn't the problem. The problem I mean is that:
>>> procedure p (out c : tc2)
>>> begin
>>>    c := tc3.create;
>> This breaks already here if I assume the type definitions I used.
> I assumed a tc1 -> tc2 -> tc3 inheritance, sorry if I missed something here. 

Yes, the type declarations. I used tc1 -> tc2 and tc1 -> tc3.

> So creating an instance of tc3 and assigning it to a variable of tc2 should be legal.
>>> end;
>>> var
>>>   c1 : tc1;
>>> begin
>>>   p(c1);
>>> end.
>>> seems not to be allowed anymore.
>> Please test your examples first before doing some wild guesses.
> I think it was Jonas who said it wouldn't be possible anymore. 

This was *never* possible as far as I remember, so nothing changed here
and no reason to complain that existing code gets havoc as Graeme
feared. It is a different discussion if it should be allowed.

More information about the fpc-devel mailing list