[fpc-devel] generic forward declaration?
Martin Frb
lazarus at mfriebe.de
Tue Jul 29 09:18:16 CEST 2025
Are there? Or is there something else?
The below compiles. No duplicate TBar. Looks like a forward declaration...
program Project1;{$Mode objfpc}
type
generic TBar<A,B> = class; // forward
generic TBar<A, B> = class
F:A;
X:B;
end;
begin
end.
But the next does not compile "Identifier not found TBar" (inside TFoo).
Yet the identifier is clearly there.
https://gitlab.com/freepascal.org/fpc/source/-/issues/24097 seems to say
it is supported since 2022?
program Project1;
{$Mode objfpc}
type
generic TBar<A,B> = class; // forward
generic TFoo<A, B> = class
F:specialize TBar<A>;
X:B;
end;
generic TBar<A, B> = class
F:specialize TFoo<A>;
X:B;
end;
begin
end.
More information about the fpc-devel
mailing list