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.



That leaves 2 other issues

1)
The example from the link, shouldn’t that be a ; instead of the ,
generic procedure Test<T,const N:Integer>(A: T); forward;
generic procedure Test<T,const N:Integer>(A: T); begin end;

(even if the const kind of clarifies that integer only applies to N, not to T...)

2)
from my 1st post
fpc 3.3.1 only

it seems it forgets some checks?
T2 changes to an incompatible constraint.

program Project1;
{$mode ObjFPC}
  type
    TX1 = class end;
    TX2 = class end;

  generic procedure Proc4<T1;   T2: TX1>(a: T1); forward;
  generic procedure Proc4<T1;   T2:TX2>(a: T1); begin {} end;

begin

end.


_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to