2
0
Эх сурвалжийг харах

Fix for Mantis #26922.

pgenutil.pas, specialization_init:
  * don't push the localsymtable if the unit does not have one available

+ added test (needs manual execution though... :/ )

git-svn-id: trunk@29172 -
svenbarth 10 жил өмнө
parent
commit
fa1bc0757d

+ 3 - 0
.gitattributes

@@ -14116,6 +14116,7 @@ tests/webtbs/tw26773.pp svneol=native#text/plain
 tests/webtbs/tw2678.pp svneol=native#text/plain
 tests/webtbs/tw2690.pp svneol=native#text/plain
 tests/webtbs/tw2691.pp svneol=native#text/plain
+tests/webtbs/tw26922.pp svneol=native#text/pascal
 tests/webtbs/tw2696.pp svneol=native#text/plain
 tests/webtbs/tw26976.pp svneol=native#text/plain
 tests/webtbs/tw26993.pp svneol=native#text/plain
@@ -14875,6 +14876,8 @@ tests/webtbs/uw25598.pp svneol=native#text/plain
 tests/webtbs/uw25610a.pp -text svneol=native#text/plain
 tests/webtbs/uw25610b.pp -text svneol=native#text/plain
 tests/webtbs/uw25814.pp svneol=native#text/plain
+tests/webtbs/uw26922a.pp svneol=native#text/pascal
+tests/webtbs/uw26922b.pp svneol=native#text/pascal
 tests/webtbs/uw2706a.pp svneol=native#text/plain
 tests/webtbs/uw2706b.pp svneol=native#text/plain
 tests/webtbs/uw2731.pp svneol=native#text/plain

+ 2 - 1
compiler/pgenutil.pas

@@ -1321,7 +1321,8 @@ uses
       if assigned(hmodule.globalsymtable) then
         symtablestack.push(hmodule.globalsymtable);
       { push the localsymtable if needed }
-      if (hmodule<>current_module) or not current_module.in_interface then
+      if ((hmodule<>current_module) or not current_module.in_interface)
+          and assigned(hmodule.localsymtable) then
         symtablestack.push(hmodule.localsymtable);
     end;
 

+ 12 - 0
tests/webtbs/tw26922.pp

@@ -0,0 +1,12 @@
+{ %INTERACTIVE }
+{ This test requires a change in uw26922a for recompilation which can not be done automatically by
+  simply adding a define, because the compiler won't detect that it needs to recompile that unit }
+
+program tw26922;
+
+uses
+  uw26922a, uw26922b;
+
+begin
+end.
+

+ 28 - 0
tests/webtbs/uw26922a.pp

@@ -0,0 +1,28 @@
+unit uw26922a;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  unit2_test;
+
+Type
+  TTestAbstract = class
+
+  end;
+
+  TTest = class;
+
+  TTestObject = class(specialize TTestObjectAbstract<TTest>);
+
+  // Note: uncomment TTestAbstract when for recompilation
+  TTest = class//(TTestAbstract)
+    public
+  end;
+
+
+implementation
+
+end.
+

+ 20 - 0
tests/webtbs/uw26922b.pp

@@ -0,0 +1,20 @@
+unit uw26922b;
+
+{$mode objfpc}{$H+}
+
+interface
+
+Type
+  generic TTestObjectAbstract<T> = class
+    private
+      var
+        FTest : T;
+  end;
+
+implementation
+
+uses
+  uw26922a;
+
+end.
+