* for adding procdefs to forwarddefs check for the specialization flag instead of whether it's a full specialization; fixes implicit finalization handlers on x86_64-win64 not being found

+ added tests

git-svn-id: trunk@45646 -
This commit is contained in:
svenbarth 2020-06-13 18:42:31 +00:00
parent 4da6465d05
commit febeef03e4
5 changed files with 72 additions and 1 deletions

3
.gitattributes vendored
View File

@ -13306,6 +13306,8 @@ tests/tbs/tb0669.pp svneol=native#text/pascal
tests/tbs/tb0670.pp svneol=native#text/pascal
tests/tbs/tb0671.pp svneol=native#text/pascal
tests/tbs/tb0672.pp svneol=native#text/pascal
tests/tbs/tb0673.pp svneol=native#text/pascal
tests/tbs/tb0674.pp svneol=native#text/pascal
tests/tbs/ub0060.pp svneol=native#text/plain
tests/tbs/ub0069.pp svneol=native#text/plain
tests/tbs/ub0119.pp svneol=native#text/plain
@ -13344,6 +13346,7 @@ tests/tbs/ub0506.pp svneol=native#text/plain
tests/tbs/ub0569.pp svneol=native#text/pascal
tests/tbs/ub0629.pp svneol=native#text/pascal
tests/tbs/ub0635.pp svneol=native#text/pascal
tests/tbs/ub0674.pp svneol=native#text/pascal
tests/test/README.txt svneol=native#text/plain
tests/test/alglib/t_testconvunit.pp svneol=native#text/plain
tests/test/alglib/t_testcorrunit.pp svneol=native#text/plain

View File

@ -775,7 +775,7 @@ implementation
if assigned(currpd.struct) and
(currpd.struct.symtable.moduleid<>current_module.moduleid) and
not currpd.is_specialization then
not (df_specialization in currpd.defoptions) then
begin
result:=false;
exit;

34
tests/tbs/tb0673.pp Normal file
View File

@ -0,0 +1,34 @@
{ %NORUN }
program tb0673;
{$mode objfpc}
type
TTest = class
generic procedure Test<T>;
end;
generic procedure TTest.Test<T>;
procedure SubTest1; forward;
procedure SubTest2;
begin
SubTest1;
end;
procedure SubTest1;
begin
end;
begin
SubTest2;
end;
var
t: TTest;
begin
t.specialize Test<LongInt>;
end.

14
tests/tbs/tb0674.pp Normal file
View File

@ -0,0 +1,14 @@
{ %NORUN }
{$mode objfpc}{$H+}
uses
ub0674;
var
LaunchRequest: TObject;
c: TMyClass;
begin
c:=TMyClass.Create;
LaunchRequest := c.specialize CreateObjectFromJSONString<TObject>('qwe');
end.

20
tests/tbs/ub0674.pp Normal file
View File

@ -0,0 +1,20 @@
{$mode objfpc}{$H+}
unit ub0674;
interface
type
TMyClass = class
public
generic function CreateObjectFromJSONString<T{: TObject}>(AJSONString: String; ADescriptionTag: string = ''): T;
end;
implementation
generic function TMyClass.CreateObjectFromJSONString<T>(AJSONString: String; ADescriptionTag: string): T;
begin
Result:=Nil;//T.Create;
end;
end.