[fpc-pascal] A Delphi "class constructor" does not compile in FPC
Sven Barth
pascaldragon at googlemail.com
Wed Feb 4 20:41:12 CET 2015
On 04.02.2015 19:58, silvioprog wrote:
> Hello,
>
> First, please test the code below in Delphi and after in FPC:
>
> TTest = class
> public
> class constructor Create;
> constructor Create; virtual;
> end;
> ...
> constructor TTest.Create;
> begin
> end;
>
> class constructor TTest.Create;
> begin
> end;
>
> OK, it will compile fine. Now test the code below in Delphi and after in
> FPC (just changing the declaration order of the methods):
>
> TTest = class
> public
> constructor Create; virtual;
> class constructor Create;
> end;
> ...
> constructor TTest.Create;
> begin
> end;
>
> class constructor TTest.Create;
> begin
> end;
>
> In Delphi it compile fine, but in FPC:
>
> =======
> Compile Project, Target: project1.exe: Exit code 1, Errors: 1, Warnings: 1
> unit1.pas(23,23) Warning: An inherited method is hidden by "class
> constructor Create;"
> unit1.pas(39,25) Error: method identifier expected
> =======
>
> Bug?
Yes. Please report.
Regards,
Sven
More information about the fpc-pascal
mailing list