[fpc-devel] Error: Argument can't be assigned to

Jonas Maebe jonas.maebe at elis.ugent.be
Fri May 25 11:48:45 CEST 2007


On 25 mei 2007, at 11:45, Graeme Geldenhuys wrote:

> Compiling it with FPC 2.3.1 (Revision: 7448) using
>
> ppc386 -S2cgi -OG1 -gl -vewnhi -l -Fu../ -Fu. -FUlib/i386-linux/
> fpgfxpackage.pas
>
> ..I get the following errors.  Any ideas why?
>
> fpGUI/gfx/x11/gfx_x11.pas(798,8) Error: Argument can't be assigned to

****

	From: 	  jonas.maebe at elis.ugent.be
	Subject: 	Re: [fpc-pascal] Release of fpc-2.1.4 aka 2.2.0-beta
	Date: 	20 mei 2007 16:43:34 GMT+02:00
	To: 	  fpc-pascal at lists.freepascal.org
	Reply-To: 	  fpc-pascal at lists.freepascal.org


On 20 May 2007, at 16:38, bartek wrote:


> OK. And what about this:
> -----8<-----
> /home/bartek/Dev/units/glgui/glgui.pp(376,33) Error: Can't take the  
> address of
> constant expressions
> -----8<-----
> constructor TGLGUI3DMouseMapper.Create(aOwnerDesktop: TGLGUIDesktop);
> begin
>         OwnerDesktop:=aOwnerDesktop;
>         OwnerDesktop.MouseMapper:=self; // 376 is here
> end;
> -----8<-----
>
> Definition snippet:
> -----8<-----
>                 // properties
>                 property OwnerDesktop: TGLGUIDesktop read  
> fOwnerDesktop write
> fOwnerDesktop;
> -----8<-----
>

You cannot write to fields of properties. The reason is that any  
property accessor should be transparently replaceable by a function  
call, and if you do that in the above expression then your assignment  
would change something inside the (temporary) function result rather  
than in the field.


Jonas
***



More information about the fpc-devel mailing list