diff --git a/.gitattributes b/.gitattributes index 15eabc669f..c66675ce24 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8138,6 +8138,7 @@ tests/webtbs/tw1096.pp svneol=native#text/plain tests/webtbs/tw10966.pp svneol=native#text/plain tests/webtbs/tw1097.pp svneol=native#text/plain tests/webtbs/tw10979.pp svneol=native#text/plain +tests/webtbs/tw10998.pp svneol=native#text/plain tests/webtbs/tw11006.pp svneol=native#text/plain tests/webtbs/tw11027.pp svneol=native#text/plain tests/webtbs/tw1103.pp svneol=native#text/plain diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index d8495583af..ad6d237c82 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -165,6 +165,11 @@ implementation assigned(tprocdef(pd)._class) and (pd.parast.symtablelevel=normal_function_level) then begin + { static class methods have no hidden self/vmt pointer } + if (po_staticmethod in pd.procoptions) and + (po_classmethod in pd.procoptions) then + exit; + storepos:=current_tokenpos; current_tokenpos:=tprocdef(pd).fileinfo; diff --git a/tests/webtbs/tw10998.pp b/tests/webtbs/tw10998.pp new file mode 100644 index 0000000000..244a65ac79 --- /dev/null +++ b/tests/webtbs/tw10998.pp @@ -0,0 +1,18 @@ +program statictest; + +{$mode delphi}{$STATIC ON} + +type + TMyClass = class + public + class procedure StaticCall; static; + end; + +class procedure TMyClass.StaticCall; +begin + WriteLn('Static method was called!'); +end; + +begin + TMyClass.StaticCall; +end. \ No newline at end of file