From 3f77ce3b124adab3aeccf7f307a775029379854c Mon Sep 17 00:00:00 2001 From: svenbarth Date: Mon, 28 Nov 2016 17:54:48 +0000 Subject: [PATCH] * leave parse_proc_head() (with some error recovery) if the interface could not be found instead of running straight into an access violation + added test git-svn-id: trunk@35007 - --- .gitattributes | 1 + compiler/pdecsub.pas | 9 ++++++++- tests/tbf/tb0253.pp | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/tbf/tb0253.pp diff --git a/.gitattributes b/.gitattributes index 0f4df7bf71..c75b35afcb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10419,6 +10419,7 @@ tests/tbf/tb0251.pp svneol=native#text/pascal tests/tbf/tb0252a.pp svneol=native#text/plain tests/tbf/tb0252b.pp svneol=native#text/plain tests/tbf/tb0252c.pp svneol=native#text/plain +tests/tbf/tb0253.pp svneol=native#text/pascal tests/tbf/ub0115.pp svneol=native#text/plain tests/tbf/ub0149.pp svneol=native#text/plain tests/tbf/ub0158a.pp svneol=native#text/plain diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index fc4101f0fe..8f5609a1fa 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -878,7 +878,14 @@ implementation (ttypesym(srsym).typedef.typ=objectdef) then ImplIntf:=find_implemented_interface(tobjectdef(astruct),tobjectdef(ttypesym(srsym).typedef)); if ImplIntf=nil then - Message(parser_e_interface_id_expected) + begin + Message(parser_e_interface_id_expected); + { error recovery } + consume(_ID); + if try_to_consume(_EQ) then + consume(_ID); + exit; + end else { in case of a generic or specialized interface we need to use the name of the def instead of the symbol, so that always the correct diff --git a/tests/tbf/tb0253.pp b/tests/tbf/tb0253.pp new file mode 100644 index 0000000000..db44bfee00 --- /dev/null +++ b/tests/tbf/tb0253.pp @@ -0,0 +1,14 @@ +{ %FAIL } + +program tb0253; + +{$mode objfpc} + +type + TTest = class(TObject, IInterface) + procedure Blubb.Bar = Foo; + end; + +begin + +end.