[fpc-devel] compiler syntax bug : "Fatal: Syntax error, ")" expected but "(" found"

Inoussa OUEDRAOGO inoussa12 at gmail.com
Sun Mar 2 22:47:28 CET 2008


Hi

I 'm about to file a bug report and would like to have a confirmation.
The compiler conplains( see the code below ) :
  "Fatal: Syntax error, ")" expected but "(" found"
It compiles under Delphi ( D7 ). I tried with "mode delphi" and "mode
objfpc" and still got the
same syntax error ( WinXP fpc 2.2.1 19/11/2007 ).


Please can you confirm this bug.

Thanks.

<code>
program test_syntax;
{$IFNDEF FPC}
  {$APPTYPE CONSOLE}
{$ENDIF}
{$IFDEF FPC}
  {$mode objfpc}{$H+}
{$ENDIF}
type
{$IFNDEF FPC}
  PPtrInt = ^Integer;
{$ENDIF}
  PRecA = ^TRecA;
  TRecA = record
    _data : array[0..0] of Byte;
  end;

  TTestObj = class
    function Append() : PRecA;
  end;

function TTestObj.Append() : PRecA;
begin
  Result := nil;
end;

var
  ox : TTestObj;
begin
  ox := TTestObj.Create();
  PPtrInt(@((ox.Append()^._data[0])))^ := 0; //this one compiles
  PPtrInt(@(ox.Append()^._data[0]))^ := 0;   // error on this line :
"Fatal: Syntax error, ")" expected but "(" found"
end.

</code>

-- 
Inoussa O.



More information about the fpc-devel mailing list