[fpc-pascal] odd compiling + linking error (with invalid casting of Exp)

Dmitry Boyarintsev skalogryz.lists at gmail.com
Mon Oct 29 17:48:35 CET 2018


I'm using 3.0.4 (win32), could any one try it on a later version of the
compiler?

The code i'm compiling looks like this:
--------------
{$mode delphi}

type
  Ttest = class(TObject)
  public
    Value: string;
  end;

function Custom: extended;
begin
  Result := 0;
end;

begin
  // writeln( TTest(Custom).Value );
  writeln( TTest(Exp).value);
end.
--------------
It gives the linking error:
sample.pas(17,1) Error: Undefined symbol:
SYSTEM_::=::\_EXP$EXTENDED::=::\EXTENDED
sample.pas(17,1) Fatal: There were 1 errors compiling module, stopping

If one un-comments  the line with invalid Custom() cast, they would get a
compiling error instead:
Compiling sample.pas
sample.pas(15,12) Error: Illegal type conversion: "Extended" to "Ttest"
(which is expected).

Is the issue known? worth bug reporting?
(clearly a compiler error should be thrown, rather than a linker error)

The issue I actually ran into is with a bigger project:
Error: Undefined symbol: SYSTEM_::=::\_EXP$EXTENDED::=::\EXTENDED
doesn't indicate the source code or line numbers.
So catching the problem might be tricky.

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181029/f0cdd6eb/attachment.html>


More information about the fpc-pascal mailing list