Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi inline usage causes 'F2084 internal error'

Tags:

inline

delphi

I am actually facing a compilation problem which occurs both on Berlin and Tokyo Delphi compilers. It occurs when I call an inlined function which itself calls a property for which the READ function is also inlined... Here is sample program which leads to a fatal internal error :

unit TestForm;
interface
uses System.Classes, Vcl.Forms, Vcl.Controls, Vcl.StdCtrls;
type
  TForm1            = class(TForm)
                        private
                        public
                      end;

  TProgType         = (_Prog1,_Prog2);
  TCxProgTypeHlp    = record helper for TProgType
                        private
                          function  GetIsProg2 : boolean; inline;
                        public
                          property  IsProg2 : boolean read GetIsProg2;
                      end;
  TProgAccess       = class
                        private
                          fProgType : TProgType;
                        public
                          function  ProgType : TProgType;
                          function  IsProg2 : boolean; inline;
                          function  CheckProg(const ProgTag : string) : boolean;
                      end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses System.SysUtils;

function TCxProgTypeHlp.GetIsProg2 : boolean;
begin
     Result:=Self = _Prog2;
end;

function TProgAccess.ProgType : TProgType;
begin
     Result:=fProgType;
end;

function TProgAccess.IsProg2 : boolean;
begin
     Result:=ProgType.IsProg2;
end;

function TProgAccess.CheckProg(const ProgTag : string) : boolean;
begin
     Result:=IsProg2;
end;

end.

When I remove any inline statement, the compiler error disapears. Is there any misconception in what I am doing ? Thanks for your help.

like image 549
Mouscap Avatar asked Aug 10 '18 16:08

Mouscap


1 Answers

Generally, there is nothing you can do about internal compiler errors. In your case, you found a workaround, which indicates there is nothing wrong with your code.

From Documentation:

The information after "Internal Error" contains one or more characters, immediately followed by a number that indicates the file and line number in the compiler itself where the error occurred. Although this information may not help you, it can help us (Embarcadero) track down the problem if and when you report the error. Be sure to jot down this information and include it with your internal error description.

Just file a QP bug report and move on.

like image 194
LU RD Avatar answered Oct 20 '22 15:10

LU RD