diff --git a/.gitattributes b/.gitattributes index 1d73c345e1..b36d3b1e1e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11003,6 +11003,7 @@ tests/webtbf/tw2046.pp svneol=native#text/plain tests/webtbf/tw2053.pp svneol=native#text/plain tests/webtbf/tw2053b.pp svneol=native#text/plain tests/webtbf/tw20580.pp svneol=native#text/pascal +tests/webtbf/tw20661.pp svneol=native#text/plain tests/webtbf/tw2070.pp svneol=native#text/plain tests/webtbf/tw2128.pp svneol=native#text/plain tests/webtbf/tw2129.pp svneol=native#text/plain diff --git a/compiler/ncal.pas b/compiler/ncal.pas index d77b806304..8547ec592b 100644 --- a/compiler/ncal.pas +++ b/compiler/ncal.pas @@ -2971,6 +2971,14 @@ implementation CGMessage(cg_e_cant_call_abstract_method); end; + { directly calling an interface/protocol/category/class helper + method via its type is not possible (always must be called via + the actual instance) } + if (methodpointer.nodetype=typen) and + (is_interface(methodpointer.resultdef) or + is_objc_protocol_or_category(methodpointer.resultdef)) then + CGMessage1(type_e_class_type_expected,methodpointer.resultdef.typename); + { if an inherited con- or destructor should be } { called in a con- or destructor then a warning } { will be made } diff --git a/tests/webtbf/tw20661.pp b/tests/webtbf/tw20661.pp new file mode 100644 index 0000000000..6d433112a5 --- /dev/null +++ b/tests/webtbf/tw20661.pp @@ -0,0 +1,40 @@ +{ %fail } + +unit tw20661; + +{$mode objfpc}{$H+} + +interface + +const + PrescriptionStorageIntfId = '{C2F3C9F6-657C-4974-841A-4EBFF33B2180}';//'blik.prescriptionstorage'; + DatasetProviderIntfId = '{B0B1501A-9266-48EA-B2E0-7EF23511D799}'; + +type + IDatasetPool = interface + ['{F866EB5B-5B32-438E-918E-A56B031C73DA}'] + procedure ReleaseDataset(Instance: pointer); + end; + + { TBlikServices } + + TBlikServices = class + public + procedure ReleaseDataset(Instance: pointer); + end; + +var + Services: TBlikServices; + +implementation + +{ TBlikServices } + +procedure TBlikServices.ReleaseDataset(Instance: pointer); +begin + IDatasetPool.ReleaseDataset(Instance); +end; + +end. + +