* properly compare parameter lists involving pointers to or classrefdefs of

forward defined types by maing sure that we always compare typesyms in
    that case instead of the forwarddefs (mantis #22705)

git-svn-id: trunk@22215 -
This commit is contained in:
Jonas Maebe 2012-08-23 20:58:22 +00:00
parent 88776524fd
commit 85765364ee
3 changed files with 75 additions and 2 deletions

1
.gitattributes vendored
View File

@ -12807,6 +12807,7 @@ tests/webtbs/tw22669.pp svneol=native#text/plain
tests/webtbs/tw2267.pp svneol=native#text/plain
tests/webtbs/tw2268.pp svneol=native#text/plain
tests/webtbs/tw2269.pp svneol=native#text/plain
tests/webtbs/tw22705.pp svneol=native#text/plain
tests/webtbs/tw2274.pp svneol=native#text/plain
tests/webtbs/tw2277.pp svneol=native#text/plain
tests/webtbs/tw2280.pp svneol=native#text/plain

View File

@ -1220,7 +1220,8 @@ implementation
else
{ the types can be forward type, handle before normal type check !! }
if assigned(def_to.typesym) and
(tpointerdef(def_to).pointeddef.typ=forwarddef) then
((tpointerdef(def_to).pointeddef.typ=forwarddef) or
(tpointerdef(def_from).pointeddef.typ=forwarddef)) then
begin
if (def_from.typesym=def_to.typesym) or
(fromtreetype=niln) then
@ -1559,7 +1560,9 @@ implementation
begin
{ similar to pointerdef wrt forwards }
if assigned(def_to.typesym) and
(tclassrefdef(def_to).pointeddef.typ=forwarddef) then
(tclassrefdef(def_to).pointeddef.typ=forwarddef) or
((def_from.typ=classrefdef) and
(tclassrefdef(def_from).pointeddef.typ=forwarddef)) then
begin
if (def_from.typesym=def_to.typesym) or
(fromtreetype=niln) then

69
tests/webtbs/tw22705.pp Normal file
View File

@ -0,0 +1,69 @@
{ %norun }
program badclass;
{$mode objfpc}
type
tMyClass=class
end;
tMyFormType= class of tMyClass;
prec = ^trec;
trec = record
end;
TForm1 = class
public
procedure myFNC(obj:tMyFormType); overload;
procedure myFNC(obj:tClass); overload;
procedure myFNC2(obj:prec); overload;
procedure myFNC2(obj:pchar); overload;
end;
TForm2 = class
public
procedure myFNC(obj:tClass); overload;
procedure myFNC(obj:tMyFormType); overload;
procedure myFNC2(obj:pchar); overload;
procedure myFNC2(obj:prec); overload;
end;
procedure TForm1.myFNC(obj:tClass);
begin
end;
procedure TForm1.myFNC(obj:tMyFormType);
begin
end;
procedure TForm1.myFNC2(obj:prec);
begin
end;
procedure TForm1.myFNC2(obj:pchar);
begin
end;
procedure TForm2.myFNC(obj:tClass);
begin
end;
procedure TForm2.myFNC(obj:tMyFormType);
begin
end;
procedure TForm2.myFNC2(obj:prec);
begin
end;
procedure TForm2.myFNC2(obj:pchar);
begin
end;
begin
end.