Sfoglia il codice sorgente

* prevent crash on not yet supported attribute declarations, resolves #32075

git-svn-id: trunk@38272 -
florian 7 anni fa
parent
commit
ad4ad82908
3 ha cambiato i file con 22 aggiunte e 1 eliminazioni
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/pdecvar.pas
  3. 20 0
      tests/webtbf/tw32075.pp

+ 1 - 0
.gitattributes

@@ -14349,6 +14349,7 @@ tests/webtbf/tw3186.pp svneol=native#text/plain
 tests/webtbf/tw31973.pp svneol=native#text/pascal
 tests/webtbf/tw32043b.pp svneol=native#text/pascal
 tests/webtbf/tw32043c.pp svneol=native#text/pascal
+tests/webtbf/tw32075.pp svneol=native#text/pascal
 tests/webtbf/tw3218.pp svneol=native#text/plain
 tests/webtbf/tw3241.pp svneol=native#text/plain
 tests/webtbf/tw32412a.pp svneol=native#text/pascal

+ 1 - 1
compiler/pdecvar.pas

@@ -175,7 +175,7 @@ implementation
                      begin
                        consume(_LECKKLAMMER);
                        repeat
-                         if def.typ=arraydef then
+                         if assigned(def) and (def.typ=arraydef) then
                           begin
                             idx:=0;
                             p:=comp_expr([ef_accept_equal]);

+ 20 - 0
tests/webtbf/tw32075.pp

@@ -0,0 +1,20 @@
+{ %fail }
+program compilercrash;
+// This code is nonsense a.t.m. but it crashes the compiler.
+{$mode objfpc}
+uses classes;
+type
+{$M+}
+Tmyclass = class(Tpersistent)
+private
+  FDetachable:Boolean;
+  procedure setdetachable(const aValue:Boolean);
+public
+  property Detachable: Boolean read FDetachable write SetDetachable
+  ['widgetsets:qt,gtk,win32', 'implementor:Vasya Pupkin', 'creation-date:01.01.2007'];
+end;
+
+begin
+{ the initial purpose of this test was that the compiler shouldn't crash on the attribute above,
+  however, as soon as attributes are implemented, it will succeed, so cause always an error at the end }
+end;