diff --git a/.gitattributes b/.gitattributes index e9b73a95af..44c77d491d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10945,6 +10945,7 @@ tests/webtbs/tw1820.pp svneol=native#text/plain tests/webtbs/tw18222.pp svneol=native#text/pascal tests/webtbs/tw1825.pp svneol=native#text/plain tests/webtbs/tw18266.pp svneol=native#text/plain +tests/webtbs/tw18443.pp svneol=native#text/pascal tests/webtbs/tw1850.pp svneol=native#text/plain tests/webtbs/tw1851.pp svneol=native#text/plain tests/webtbs/tw1856.pp svneol=native#text/plain diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 078946029b..ad7e2b694c 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -2383,7 +2383,7 @@ implementation hclassdef:=hclassdef.childof; { if inherited; only then we need the method with the same name } - if token in endtokens then + if token <> _ID then begin hs:=current_procinfo.procdef.procsym.name; hsorg:=current_procinfo.procdef.procsym.realname; diff --git a/tests/webtbs/tw18443.pp b/tests/webtbs/tw18443.pp new file mode 100644 index 0000000000..c42c8a1f7e --- /dev/null +++ b/tests/webtbs/tw18443.pp @@ -0,0 +1,32 @@ +program tw18433; +{$mode objfpc} +type + TBase = class + function Print: String; virtual; + end; + + TDesc1 = class(TBase) + function Print: String; override; + end; + + TDesc2 = class(TBase) + function Print: String; override; + end; + +function TBase.Print: String; +begin + Result := 'Base'; +end; + +function TDesc1.Print: String; +begin + Result := inherited + '-Desc1'; +end; + +function TDesc2.Print: String; +begin + Result := inherited Print + '-Desc2'; +end; + +begin +end.