Strange compiler error: function header doesn't match the previous declaration
Original Reporter info from Mantis: Kryvich
-
Reporter name:
Original Reporter info from Mantis: Kryvich
- Reporter name:
Description:
I'm trying to convert the CCR Exif library from Delphi to FPC.
Cannot compile the attached code with error
CompileError.lpr(17,30) Error: function header doesn't match the previous declaration "class procedure CreateFromString(const AnsiString):&LtPos;record type>; Static;"
program CompileError;
{$mode delphi}{$H+}
uses Classes;
type
TWordTagValue = record
strict private
FValue: Word;
FMissingOrInvalid: Boolean; // Try to disable this line !
public
class function CreateFromString(const AString: string): TWordTagValue; static;
property Value: Word read FValue;
end;
class function TWordTagValue.CreateFromString(const AString: string): TWordTagValue;
begin
Result.FValue := 0;
end;
begin
end.
Steps to reproduce:
- Download CompileError.lpr
- Try to compile it.
It's interesting if we remove field FMissingOrInvalid from the record declaration, the program is compiled just fine.
Mantis conversion info:
- Mantis ID: 22796
- OS: Windows XP
- OS Build: SP3
- Build: 22304
- Platform: Windows
- Version: 2.7.1
- Fixed in revision: 22414 (#64740049)
- Target version: 2.7.1