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:
paul 2011-01-11 02:00:27 +00:00
parent fb943ef00b
commit f9f316ac45

View File

@ -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;