Advanced Record parser bug
Original Reporter info from Mantis: chrish @chadilukito
-
Reporter name: Christian Hadi
Original Reporter info from Mantis: chrish @chadilukito
- Reporter name: Christian Hadi
Description:
There are different result occurred when using advanced record method inside and outside class.
I try to provide with simple code below to test
Steps to reproduce:
Program FPC30821_Bug;
{$mode objfpc}
{$modeswitch advancedrecords}
type
TStringWithCounter = record
Data : String;
Counter : Integer;
function Create( Const s : String; i : Integer) : TStringWithCounter;
end;
ttest = class
public
procedure test();
end;
var
tmp : TStringWithCounter;
function TStringWithCounter.Create( Const s : String; i : Integer) : TStringWithCounter;
begin
Result.Data := s;
Result.Counter := i;
end;
procedure ttest.test();
begin
TStringWithCounter.Create('aa', 5); // => no error, but I think should be an error
tmp.Create('aa', 5); // => no error
end;
begin
TStringWithCounter.Create('aa', 5); // => error: illegal expression
tmp.Create('aa', 5); // => no error
end.
Additional information:
Free Pascal Compiler version 3.1.1 [2015/05/08] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling fpc30821_bug.pp
fpc30821_bug.pp(34,3) Error: Illegal expression
fpc30821_bug.pp(36,4) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: C:\Mine\FPC\3.1.1\bin\x86_64-win64\ppcx64.exe returned an error exitcode
Mantis conversion info:
- Mantis ID: 28355
- OS: Windows
- OS Build: 8.1 64 bit
- Build: 30821
- Version: 3.1.1
- Fixed in version: 3.1.1