From fa1bc0757d42760d45a39690e7c4c552fefc2e91 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 28 Nov 2014 16:35:28 +0000 Subject: [PATCH] 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 - --- .gitattributes | 3 +++ compiler/pgenutil.pas | 3 ++- tests/webtbs/tw26922.pp | 12 ++++++++++++ tests/webtbs/uw26922a.pp | 28 ++++++++++++++++++++++++++++ tests/webtbs/uw26922b.pp | 20 ++++++++++++++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw26922.pp create mode 100644 tests/webtbs/uw26922a.pp create mode 100644 tests/webtbs/uw26922b.pp diff --git a/.gitattributes b/.gitattributes index 71fdcd5ce5..8dd08fbcaf 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/pgenutil.pas b/compiler/pgenutil.pas index 63a13ee15c..c00bb967df 100644 --- a/compiler/pgenutil.pas +++ b/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; diff --git a/tests/webtbs/tw26922.pp b/tests/webtbs/tw26922.pp new file mode 100644 index 0000000000..0414610bba --- /dev/null +++ b/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. + diff --git a/tests/webtbs/uw26922a.pp b/tests/webtbs/uw26922a.pp new file mode 100644 index 0000000000..997bc0f255 --- /dev/null +++ b/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); + + // Note: uncomment TTestAbstract when for recompilation + TTest = class//(TTestAbstract) + public + end; + + +implementation + +end. + diff --git a/tests/webtbs/uw26922b.pp b/tests/webtbs/uw26922b.pp new file mode 100644 index 0000000000..5afb1fd0eb --- /dev/null +++ b/tests/webtbs/uw26922b.pp @@ -0,0 +1,20 @@ +unit uw26922b; + +{$mode objfpc}{$H+} + +interface + +Type + generic TTestObjectAbstract = class + private + var + FTest : T; + end; + +implementation + +uses + uw26922a; + +end. +