When trying to pass default class property to by-ref argument, the error message refers to the first line of the Pascal script, instead of the actual place in the code

145 views
Skip to first unread message

mpri...@gmail.com

unread,
Nov 14, 2020, 11:10:20 AM11/14/20
to innosetup
Hello, try to compile the below script. It will result in:
> Compiling [Code] section
> Error on line 10 in B:\hshgdh\Example1.iss: Column 1:
> Variable Expected.
> Compile aborted.
While the error message is correct, it incorrectly refers to Column 1 of the first script line (procedure Dummy in this case), instead of the actual location of the error.
The problem does not happen, when you similarly incorrectly try to use a constant string – ByRef('foo')or a function result — ByRef(ExpandConstant('foo')), or when using the explicit property name – ByRef(S.Strings[0]). In all these cases the error message will correctly refer to the ByRef call statement.

Occurs both in Inno Setup 6.0.5 and 6.1.1 beta.

Spotted, while solving this question:

[Setup]
AppName=My Program
AppVersion=1.15
DefaultDirName={autopf}\My Program

[Code]

// Just some random dummy code to show that the error message refers to
// the very first line in the script, which is unrelated to the error.
procedure Dummy;
begin
end;

procedure ByRef(var S: string);
begin
end;

procedure Foo;
var
  S: TStrings;
begin
  ByRef(S[0]);
end;


Andrew Truckle

unread,
Nov 15, 2020, 3:05:13 AM11/15/20
to innosetup
What if you count to line 10 beginning at the [Code] section? I am sure this might be the issue. My error line numbers are way off because of this (I think).

mpri...@gmail.com

unread,
Nov 15, 2020, 3:17:53 AM11/15/20
to innosetup
On Sunday, November 15, 2020 at 9:05:13 AM UTC+1 truc...@gmail.com wrote:
What if you count to line 10 beginning at the [Code] section? I am sure this might be the issue. My error line numbers are way off because of this (I think)
 
No. That's not the case. The error message always refers to the first code line in the .iss script. Even included one. You can see that in the linked Stack Overflow question. The OP includes idp.iss at the beginning of the main .iss script. And in his case, the error message always refers to the first real code line in the idp.iss (the idpAddFile function declaration).

Martijn Laan

unread,
Dec 10, 2020, 9:55:29 AM12/10/20
to inno...@googlegroups.com
Hi,

Op 14-11-2020 om 17:10 schreef mpri...@gmail.com:
While the error message is correct, it incorrectly refers to Column 1 of the first script line (procedure Dummy in this case), instead of the actual location of the error.

This will be fixed in the next version, thanks.

Greetings,
Martijn

mpri...@gmail.com

unread,
Dec 10, 2020, 11:13:09 AM12/10/20
to innosetup
Thanks.
Reply all
Reply to author
Forward
0 new messages