--- Merging r31910 into '.':

U    compiler/ptype.pas
A    tests/webtbs/tw28674.pp
--- Recording mergeinfo for merge of r31910 into '.':
 U   .
--- Merging r31987 into '.':
U    tests/webtbs/tw28674.pp
G    compiler/ptype.pas
--- Recording mergeinfo for merge of r31987 into '.':
 G   .i

# revisions: 31910,31987

git-svn-id: branches/fixes_3_0@31995 -
This commit is contained in:
joost 2015-10-09 16:38:40 +00:00
parent cde218d81c
commit d8b82e0ba5
3 changed files with 43 additions and 2 deletions

1
.gitattributes vendored
View File

@ -14284,6 +14284,7 @@ tests/webtbs/tw2853d.pp svneol=native#text/plain
tests/webtbs/tw2853e.pp svneol=native#text/plain
tests/webtbs/tw2859.pp svneol=native#text/plain
tests/webtbs/tw2865.pp svneol=native#text/plain
tests/webtbs/tw28674.pp svneol=native#text/pascal
tests/webtbs/tw2876.pp svneol=native#text/plain
tests/webtbs/tw2883.pp svneol=native#text/plain
tests/webtbs/tw2885.pp svneol=native#text/plain

View File

@ -122,11 +122,13 @@ implementation
procedure resolve_forward_types;
var
i: longint;
tmp,
hpd,
def : tdef;
srsym : tsym;
srsymtable : TSymtable;
hs : string;
fileinfo : tfileposinfo;
begin
for i:=0 to current_module.checkforwarddefs.Count-1 do
begin
@ -152,6 +154,20 @@ implementation
if assigned(srsym) and
(srsym.typ=typesym) then
begin
if (sp_generic_dummy in srsym.symoptions) and
not (ttypesym(srsym).typedef.typ=undefineddef) and
assigned(def.owner.defowner) then
begin
{ is the forward def part of a specialization? }
tmp:=tdef(def.owner.defowner);
while not tstoreddef(tmp).is_specialization and assigned(tmp.owner.defowner) do
tmp:=tdef(tmp.owner.defowner);
{ if the genericdef of the specialization is the same as the
def the dummy points to, then update the found symbol }
if tstoreddef(tmp).is_specialization and
(tstoreddef(tmp).genericdef=ttypesym(srsym).typedef) then
srsym:=tstoreddef(tmp).typesym;
end;
tabstractpointerdef(def).pointeddef:=ttypesym(srsym).typedef;
{ avoid wrong unused warnings web bug 801 PM }
inc(ttypesym(srsym).refs);
@ -171,10 +187,17 @@ implementation
the case for generics defined in non-Delphi
modes }
tstoreddef(ttypesym(srsym).typedef).is_generic and
not parse_generic
not defs_belong_to_same_generic(def,ttypesym(srsym).typedef)
)
) then
MessagePos(def.typesym.fileinfo,parser_e_no_generics_as_types);
begin
if assigned(def.typesym) then
fileinfo:=def.typesym.fileinfo
else
{ this is the case for inline pointer declarations }
fileinfo:=srsym.fileinfo;
MessagePos(fileinfo,parser_e_no_generics_as_types);
end;
end
else
begin

17
tests/webtbs/tw28674.pp Normal file
View File

@ -0,0 +1,17 @@
{ %NORUN }
program tw28674;
{$mode objfpc}
type
generic node<T> = object
data: T;
link: ^node;
end;
tintnode = specialize node<int32>;
begin
end.