Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-05

which constant expression?

9 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mario R. Carro

Hi. Why does this fail to compile with FPC 2.3.1? (from ZeosLib):

procedure TZExpression.SetTokenizer(Value: IZTokenizer);
var
  Parser: TZExpressionParser;
begin
  FTokenizer := Value;
  TZExpressionParser(FParser).Tokenizer := Value; // <-- This line fails
end;

FParser is declared as TObject and assigned a is a property of TZExpressionParser of type IZTokenizer that gives direct access to the field FTokenizer of the same class.

The error message says:

ZExpression.pas(479,20) Error: Can't take the address of constant expressions

I googled a little and found that this error message is associated to trying to use a property as a var parameter or to try to modify a member of a value returned by a property, but this isn't any of those cases. May the problem be the property is of an interface type?

Thanks,
Mario

Reply by email

Jonas Maebe
to Daniël Mantione
Daniël Mantione wrote 7 lines
Op Sat, 26 May 2007, schreef Mario R. Carro: > Hi. Why does this fail to compile with FPC 2.3.1? (from ZeosLib): Please read http://lists.freepascal.org/lists/fpc-pascal/2007-May/ 013794.html and the replies.

This is actually a different situation. I'm testing a fix, as the code posted (at least what I guess it should be when you add enough things so it becomes compilable -- please, people, /always/ provide a fully compilable sample so we don't have to guess what your code looks like) should work.

Jonas

Reply by email

Mario R. Carro
to Jonas Maebe
Jonas Maebe wrote 14 lines
On 26 May 2007, at 23:40, Mario R. Carro wrote: > Hi. Why does this fail to compile with FPC 2.3.1? (from ZeosLib): > > procedure TZExpression.SetTokenizer(Value: IZTokenizer); > var > Parser: TZExpressionParser; > begin > FTokenizer := Value; > TZExpressionParser(FParser).Tokenizer := Value; // <-- This line > fails > end; Fixed.
Great! But look at the attached test: The compilation of the
line "ArrayInts := nil" fails with the same error. Rewriting it
as "FArrayInts := nil" lets the compiler accept it. I'm using r7494.
Jonas

Thanks,
Mario

_______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Jonas Maebe
to Mario R. Carro
Mario R. Carro wrote
Great! But look at the attached test: The compilation of the line "ArrayInts := nil" fails with the same error. Rewriting it as "FArrayInts := nil" lets the compiler accept it. I'm using r7494.

Thanks, fixed.

Jonas

Reply by email

Mario R. Carro
to Jonas Maebe
Jonas Maebe wrote 9 lines
On 28 May 2007, at 15:00, Mario R. Carro wrote: > Great! But look at the attached test: The compilation of the > line "ArrayInts := nil" fails with the same error. Rewriting it > as "FArrayInts := nil" lets the compiler accept it. I'm using r7494. Thanks, fixed. Jonas

With this fix ZeosLib-testing compiles out of the box with FPC from SVN (except a wrong ifdef in ZeosLib that I'll ask them to fix).

Thanks,
Mario

_______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Joost van der Sluis
to Mario R. Carro
Mario R. Carro wrote 13 lines
On Monday 28 May 2007, Jonas Maebe wrote: > On 28 May 2007, at 15:00, Mario R. Carro wrote: > > Great! But look at the attached test: The compilation of the > > line "ArrayInts := nil" fails with the same error. Rewriting it > > as "FArrayInts := nil" lets the compiler accept it. I'm using r7494. > > Thanks, fixed. > > > Jonas With this fix ZeosLib-testing compiles out of the box with FPC from SVN (except a wrong ifdef in ZeosLib that I'll ask them to fix).

You'd better test it with fpc 2.1.4 aka 2.2.0-beta. Changes in svn can break things again.

Joost.

Reply by email

Mario R. Carro
to Joost van der Sluis
Joost van der Sluis wrote 18 lines
On Mon, 2007-05-28 at 13:34 -0300, Mario R. Carro wrote: > On Monday 28 May 2007, Jonas Maebe wrote: > > On 28 May 2007, at 15:00, Mario R. Carro wrote: > > > Great! But look at the attached test: The compilation of the > > > line "ArrayInts := nil" fails with the same error. Rewriting it > > > as "FArrayInts := nil" lets the compiler accept it. I'm using r7494. > > > > Thanks, fixed. > > > > > > Jonas > > With this fix ZeosLib-testing compiles out of the box with FPC from SVN > (except a wrong ifdef in ZeosLib that I'll ask them to fix). You'd better test it with fpc 2.1.4 aka 2.2.0-beta. Changes in svn can break things again.

Ok, I'll do that.

Joost.

Thanks,
Mario

_______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email