mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-10 10:09:21 +02:00
* var, type, threadvar, const sections require also in classes etc. at least one declaration, resolves #39599
This commit is contained in:
parent
d36761f4a4
commit
9e3f647333
@ -1194,18 +1194,27 @@ implementation
|
||||
Message(parser_e_type_var_const_only_in_records_and_classes);
|
||||
consume(_TYPE);
|
||||
object_member_blocktype:=bt_type;
|
||||
{ expect at least one type declaration }
|
||||
if token<>_ID then
|
||||
consume(_ID);
|
||||
end;
|
||||
_VAR :
|
||||
begin
|
||||
check_unbound_attributes;
|
||||
rtti_attrs_def := nil;
|
||||
parse_var(false);
|
||||
{ expect at least one var declaration }
|
||||
if token<>_ID then
|
||||
consume(_ID);
|
||||
end;
|
||||
_CONST:
|
||||
begin
|
||||
check_unbound_attributes;
|
||||
rtti_attrs_def := nil;
|
||||
parse_const
|
||||
parse_const;
|
||||
{ expect at least one constant declaration }
|
||||
if token<>_ID then
|
||||
consume(_ID);
|
||||
end;
|
||||
_THREADVAR :
|
||||
begin
|
||||
@ -1217,6 +1226,9 @@ implementation
|
||||
is_classdef:=true;
|
||||
end;
|
||||
parse_var(true);
|
||||
{ expect at least one threadvar declaration }
|
||||
if token<>_ID then
|
||||
consume(_ID);
|
||||
end;
|
||||
_ID :
|
||||
begin
|
||||
|
10
tests/webtfs/tw39599a.pp
Normal file
10
tests/webtfs/tw39599a.pp
Normal file
@ -0,0 +1,10 @@
|
||||
{ %fail }
|
||||
program project1;
|
||||
{$mode objfpc}
|
||||
type
|
||||
TMyClass = class(TObject)
|
||||
const
|
||||
procedure A; virtual; abstract; // should not be allowed
|
||||
end;
|
||||
begin
|
||||
end.
|
10
tests/webtfs/tw39599b.pp
Normal file
10
tests/webtfs/tw39599b.pp
Normal file
@ -0,0 +1,10 @@
|
||||
{ %fail }
|
||||
program project1;
|
||||
{$mode objfpc}
|
||||
type
|
||||
TMyClass = class(TObject)
|
||||
type
|
||||
procedure A; virtual; abstract; // should not be allowed
|
||||
end;
|
||||
begin
|
||||
end.
|
10
tests/webtfs/tw39599c.pp
Normal file
10
tests/webtfs/tw39599c.pp
Normal file
@ -0,0 +1,10 @@
|
||||
{ %fail }
|
||||
program project1;
|
||||
{$mode objfpc}
|
||||
type
|
||||
TMyClass = class(TObject)
|
||||
var
|
||||
procedure A; virtual; abstract; // should not be allowed
|
||||
end;
|
||||
begin
|
||||
end.
|
10
tests/webtfs/tw39599d.pp
Normal file
10
tests/webtfs/tw39599d.pp
Normal file
@ -0,0 +1,10 @@
|
||||
{ %fail }
|
||||
program project1;
|
||||
{$mode objfpc}
|
||||
type
|
||||
TMyClass = class(TObject)
|
||||
threadvar
|
||||
procedure A; virtual; abstract; // should not be allowed
|
||||
end;
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user