Explorar o código

* 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 -

svenbarth %!s(int64=8) %!d(string=hai) anos
pai
achega
3f77ce3b12
Modificáronse 3 ficheiros con 23 adicións e 1 borrados
  1. 1 0
      .gitattributes
  2. 8 1
      compiler/pdecsub.pas
  3. 14 0
      tests/tbf/tb0253.pp

+ 1 - 0
.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

+ 8 - 1
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

+ 14 - 0
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.