diff options
author | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-05-27 16:29:22 +0000 |
---|---|---|
committer | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-05-27 16:29:22 +0000 |
commit | c8ace7cc352730e6fb9458c5f3b3703041fe536f (patch) | |
tree | 1fd561a5bb26bd617408737be9c9541ced607ee4 | |
parent | 80f4eb7e301516faf7d58bc317cba744c772eb5a (diff) | |
download | fpc-c8ace7cc352730e6fb9458c5f3b3703041fe536f.tar.gz |
Fix regressions.
pgenutil.pas:
* process_procdef & process_abstractrecorddef: only check whether the procdef's generic is still a forward declaration if it's in the current unit (otherwise we would trigger an internal error)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@33828 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | compiler/pgenutil.pas | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/compiler/pgenutil.pas b/compiler/pgenutil.pas index 1d672deecc..89b0f4427e 100644 --- a/compiler/pgenutil.pas +++ b/compiler/pgenutil.pas @@ -1559,8 +1559,9 @@ uses { only generate the code if we need a body } if assigned(tprocdef(hp).struct) and not tprocdef(hp).forwarddef then continue; - { and the body is available already } - if tprocdef(tprocdef(hp).genericdef).forwarddef then + { and the body is available already (which is implicitely the + case if the generic routine is part of another unit) } + if (hmodule=current_module) and tprocdef(tprocdef(hp).genericdef).forwarddef then begin result:=false; continue; @@ -1602,18 +1603,23 @@ uses case def.typ of procdef: begin + { the use of forwarddef should not backfire as the + specialization always belongs to the current module } if not tprocdef(def).forwarddef then continue; if not assigned(def.genericdef) then internalerror(2015061903); - if tprocdef(def.genericdef).forwarddef then + hmodule:=find_module_from_symtable(def.genericdef.owner); + if hmodule=nil then + internalerror(2015061904); + { we need to check for a forward declaration only if the + generic was declared in the same unit (otherwise there + should be one) } + if (hmodule=current_module) and tprocdef(def.genericdef).forwarddef then begin readdlist.add(def); continue; end; - hmodule:=find_module_from_symtable(def.genericdef.owner); - if hmodule=nil then - internalerror(2015061904); specialization_init(tstoreddef(def).genericdef,state); |