mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:49:35 +02:00
compiler: don't set a structure to routine if it accidentally match some (bug #0018452)
git-svn-id: trunk@16747 -
This commit is contained in:
parent
fb943ef00b
commit
f9f316ac45
@ -915,9 +915,8 @@ implementation
|
|||||||
(ttypesym(srsym).typedef.typ in [objectdef,recorddef]) then
|
(ttypesym(srsym).typedef.typ in [objectdef,recorddef]) then
|
||||||
begin
|
begin
|
||||||
astruct:=tabstractrecorddef(ttypesym(srsym).typedef);
|
astruct:=tabstractrecorddef(ttypesym(srsym).typedef);
|
||||||
if (df_generic in astruct.defoptions) then
|
if (df_generic in astruct.defoptions) and try_to_consume(_LT) then
|
||||||
begin
|
begin
|
||||||
consume(_LT);
|
|
||||||
ok:=true;
|
ok:=true;
|
||||||
i:=0;
|
i:=0;
|
||||||
repeat
|
repeat
|
||||||
@ -954,13 +953,22 @@ implementation
|
|||||||
consume(_GT);
|
consume(_GT);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if try_to_consume(_LT) then
|
if (df_generic in astruct.defoptions) and (token=_POINT) then
|
||||||
begin
|
begin
|
||||||
Message(type_e_type_parameters_are_not_allowed_here);
|
Message1(type_e_generic_declaration_does_not_match,astruct.RttiName);
|
||||||
repeat
|
end
|
||||||
consume(_ID);
|
else
|
||||||
until not try_to_consume(_COMMA);
|
begin
|
||||||
consume(_GT);
|
{ not a method. routine name just accidentally match some structure name }
|
||||||
|
astruct:=nil;
|
||||||
|
if try_to_consume(_LT) then
|
||||||
|
begin
|
||||||
|
Message(type_e_type_parameters_are_not_allowed_here);
|
||||||
|
repeat
|
||||||
|
consume(_ID);
|
||||||
|
until not try_to_consume(_COMMA);
|
||||||
|
consume(_GT);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user