[fpc-devel] Impossible CONST generic constraints in forward declarations...?

Martin Frb lazarus at mfriebe.de
Tue Nov 25 23:39:06 CET 2025


On 25/11/2025 23:01, Martin Frb via fpc-devel wrote:
> On 25/11/2025 22:02, Martin Frb via fpc-devel wrote:
>> On 25/11/2025 20:41, Martin Frb via fpc-devel wrote:
>>> According to
>>> https://forum.lazarus.freepascal.org/index.php/topic,52157.msg383991.html#msg383991 
>>>
>>>
>>> 2) Constraints in a "forward" declaration in the implementation (or 
>>> a program?) must be kept.
>>
>> Actually, that does not seem to be true either...
>
> Sorry, the evening seems to have been to long....
>
> I misread the post.
> - "const constraints" (value param) must be repeated on forward, and 
> forward only.
> - All others must always be stripped.
>

Then again, below does not compile

program Project1;{$Mode objfpc}
generic procedure Foo<const A: integer;B: TObject;C>(p1: B); forward;

generic procedure Foo<const A: integer; B; C>(p1: B);
begin {} end;

begin
end.



More information about the fpc-devel mailing list