[fpc-pascal] Operator not overloaded

Thomas Kurz fpc.2021 at t-net.ruhr
Fri Jun 24 15:33:20 CEST 2022

Thank you very much, declaring the operator within the record does indeed solve the issue.

Just to be sure in case I might need it some day: Does this mean, if I need e.g. a comparison operator for a specialized TPair, I would declare a record class helper and define the operator there?

----- Original Message ----- 
From: Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org>
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Sent: Friday, June 24, 2022, 10:43:55
Subject: [fpc-pascal] Operator not overloaded

Thomas Kurz via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Do., 23. Juni 2022, 19:45:

> When compiling, I get this error:

> pathfinding.pas(17,17) Error: Operator is not overloaded: "TTileSegment" =
> "TTileSegment"

> Which I don't understand -- because the "=" operator is defined in
> tesstypes.pas.

> Am I doing something wrong or is this behavior a bug?

Global operator overloads need to be available at the time the generic is
*declared*, not *specialized*. That is one of the reasons why advanced
records were introduced.

So you need to declare your operators as part of your record.


More information about the fpc-pascal mailing list