Compiler allows class method to be declared after const
Summary
Compiler allows class method to be declared after const. Normal procedure cannot be declared after const. Delphi doesn't allow either of them.
System Information
- Operating system: Windows
- Processor architecture: x86
- Compiler version: trunk
- Device: Computer
Example Project
program project1;
{$mode objfpc}
type
TMyClass = class(TObject)
const
procedure A; virtual; abstract; // should not be allowed
end;
begin
end.
Normal procedure is not allowed
unit Unit1;
{$mode objfpc}
interface
const
procedure A; // FPC error: Unit1.pas(5,3) Fatal: Syntax error, "identifier" expected but "PROCEDURE" found
implementation
procedure A;
begin
end;
end.
What is the current bug behavior?
It compiles.
What is the expected (correct) behavior?
It should not compile.