Legacy curiosity. This compiled fine in Delphi 6. (Spotted at XMLSchema.pas)

Legacy curiosity. This compiled fine in Delphi 6. (Spotted at XMLSchema.pas)

type
  TFoo=class
  private
    procedure Foo(const AClass: TClass; const G: TGuid; const S: String='');
  public
    procedure Bar;
  end;

procedure TFoo.Bar;
begin
  Foo(TObject IInterface);   // <-- No comma !
end;

procedure TFoo.Foo(const AClass: TClass; const G: TGuid; const S: String='');
begin
end;

Comments

  1. That had to be some sort of compiler bug in D6?

    ReplyDelete
  2. I've seen this before. Known parser thing. Forgot if it still works for all platforms.

    ReplyDelete
  3. At least D5 was affect as well by the missing comma bug. Also newer compilers have similar bugs like "1 + 1;" compiles (fixed in D2009) or "procedure Foo(A: Integer; B: Integer = 1);" + "Foo(1,);" (fixed in XE5)

    ReplyDelete

Post a Comment