Sign in Join

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

Mailing lists / fpc-pascal / 2007-12

[2.3.1] Can't take the address of constant expressions

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Damien Gerard

Hi !

I am trying the 2.3.1 and I can not recompile my projects. I ve got the message :Can't take the address of constant expressions.

I have only the following :

TMyClass = class(TObject)
    p_ref : TAnotherClass;
    procedure setRef(AValue: TANotherClass);
public
    property ref: TAnotherClass read p_ref write setRef;
end;

Where am I wrong for the 2.3.1 ?

Damien Gerard People who used magic without knowing what they were doing usually came to a sticky end. All over the entire room, sometimes. -- (Terry Pratchett, Moving Pictures)
Jonas Maebe
to Damien Gerard
Damien Gerard wrote
I am trying the 2.3.1 and I can not recompile my projects. I ve got the message :Can't take the address of constant expressions. I have only the following :

No, you have more:

bigmac:~/fpc/test jonas$ cat tt4.pp
{$mode delphi}

TMyClass = class(TObject)

    p_ref : TAnotherClass;
    procedure setRef(AValue: TANotherClass);

public

    property ref: TAnotherClass read p_ref write setRef;

end;
bigmac:~/fpc/test jonas$ ppcppc27 tt4
Free Pascal Compiler version 2.3.1 [2007/12/01] for powerpc Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Darwin for PowerPC
Compiling tt4.pp
tt4.pp(3,9) Fatal: Syntax error, "BEGIN" expected but "identifier TMYCLASS" found
Fatal: Compilation aborted

(even adding "type" and a dummy declaration for TAnotherClass is not enough to get the error message you are reporting)

Show quoted text 8 lines
TMyClass = class(TObject) p_ref : TAnotherClass; procedure setRef(AValue: TANotherClass); public property ref: TAnotherClass read p_ref write setRef; end; Where am I wrong for the 2.3.1 ?

Please post the full source needed to reproduce the error message you are getting.

Jonas