From febeef03e4830cc4ecfcda0a5236e6f6b86d483b Mon Sep 17 00:00:00 2001 From: svenbarth Date: Sat, 13 Jun 2020 18:42:31 +0000 Subject: [PATCH] * 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 - --- .gitattributes | 3 +++ compiler/pparautl.pas | 2 +- tests/tbs/tb0673.pp | 34 ++++++++++++++++++++++++++++++++++ tests/tbs/tb0674.pp | 14 ++++++++++++++ tests/tbs/ub0674.pp | 20 ++++++++++++++++++++ 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 tests/tbs/tb0673.pp create mode 100644 tests/tbs/tb0674.pp create mode 100644 tests/tbs/ub0674.pp diff --git a/.gitattributes b/.gitattributes index f7ff193b28..60dd4ea2bc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/pparautl.pas b/compiler/pparautl.pas index 13a3c0ec4b..141c9cca4e 100644 --- a/compiler/pparautl.pas +++ b/compiler/pparautl.pas @@ -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; diff --git a/tests/tbs/tb0673.pp b/tests/tbs/tb0673.pp new file mode 100644 index 0000000000..544d9e0205 --- /dev/null +++ b/tests/tbs/tb0673.pp @@ -0,0 +1,34 @@ +{ %NORUN } + +program tb0673; + +{$mode objfpc} + +type + TTest = class + generic procedure Test; + end; + +generic procedure TTest.Test; + + procedure SubTest1; forward; + + procedure SubTest2; + begin + SubTest1; + end; + + procedure SubTest1; + begin + + end; + +begin + SubTest2; +end; + +var + t: TTest; +begin + t.specialize Test; +end. diff --git a/tests/tbs/tb0674.pp b/tests/tbs/tb0674.pp new file mode 100644 index 0000000000..b9cd284df1 --- /dev/null +++ b/tests/tbs/tb0674.pp @@ -0,0 +1,14 @@ +{ %NORUN } + +{$mode objfpc}{$H+} + +uses + ub0674; + +var + LaunchRequest: TObject; + c: TMyClass; +begin + c:=TMyClass.Create; + LaunchRequest := c.specialize CreateObjectFromJSONString('qwe'); +end. diff --git a/tests/tbs/ub0674.pp b/tests/tbs/ub0674.pp new file mode 100644 index 0000000000..ba563202bd --- /dev/null +++ b/tests/tbs/ub0674.pp @@ -0,0 +1,20 @@ +{$mode objfpc}{$H+} + +unit ub0674; + +interface + +type + TMyClass = class + public + generic function CreateObjectFromJSONString(AJSONString: String; ADescriptionTag: string = ''): T; + end; + +implementation + +generic function TMyClass.CreateObjectFromJSONString(AJSONString: String; ADescriptionTag: string): T; +begin + Result:=Nil;//T.Create; +end; + +end.