Recent

Author Topic: FPC 3.x bug?  (Read 1985 times)

derek.john.evans

  • Guest
FPC 3.x bug?
« on: September 04, 2015, 05:55:57 pm »
This code once compiled in 2.6.4, but now doesn't in 3.x. Ive also checked 3.1.1. Has the the feature of having a writable object property been removed?

Error Message: project1.lpr(23,17) Error: Argument can't be assigned to

Code: [Select]
program project1;

{$mode objfpc}{$H+}

type

  TMyObject = object
    Name: String;
  end;

  TTest = class
  private
    FMyObject: TMyObject;
  public
    property MyObject: TMyObject read FMyObject write FMyObject;
  end;

var GTest: TTest;

begin
  GTest := TTest.Create;
  GTest.MyObject.Name := 'FreePascal';
  WriteLn(GTest.MyObject.Name);
  ReadLn;
end.     

**EDIT** Ive just some testing. Looks like I've been using a feature that isn't in Delphi, and doesn't work for records, so, I guess they removed it. O, well.
« Last Edit: September 04, 2015, 06:03:19 pm by derek.john.evans »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: FPC 3.x bug?
« Reply #1 on: September 05, 2015, 10:23:24 am »
Looks similar to this, perhaps it was forgotten that object is record compatible in terms of memory allocation (it's statically allocated), therefore it used to work until 2.6.4 while the original restriction was already in 2.4.0.
« Last Edit: September 05, 2015, 04:29:27 pm by Leledumbo »


 

TinyPortal © 2005-2018