mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-05 04:58:31 +02:00
Partially fix for Mantis #22160. This resolves the internal error, but the given example units still don't compile, because of the way we handle specializations and unit loading (more about this once I fixed that, too).
pgenutil.pas, specialization_init: * don't add implementation units of the generic's unit to the symtable stack if we are specializing in a different unit (thus the generic needs to be defined in the interface section) as there is the possibility that the globalsymtable of an implementation unit is not yet defined if the specialization unit is used in the interface section of an implementation unit git-svn-id: trunk@21763 -
This commit is contained in:
parent
7492f196f8
commit
a908db5a91
@ -685,10 +685,18 @@ uses
|
||||
if sym.typ=unitsym then
|
||||
unitsyms.add(upper(sym.realname),sym);
|
||||
end;
|
||||
{ add all interface units to the new symtable stack }
|
||||
{ add all units if we are specializing inside the current unit (as the
|
||||
generic could have been declared in the implementation part), but load
|
||||
only interface units, if we are in a different unit as then the generic
|
||||
needs to be in the interface section }
|
||||
pu:=tused_unit(hmodule.used_units.first);
|
||||
while assigned(pu) do
|
||||
begin
|
||||
if (hmodule<>current_module) and not pu.in_interface then
|
||||
begin
|
||||
pu:=tused_unit(pu.next);
|
||||
continue;
|
||||
end;
|
||||
if not assigned(pu.u.globalsymtable) then
|
||||
internalerror(200705153);
|
||||
symtablestack.push(pu.u.globalsymtable);
|
||||
|
Loading…
Reference in New Issue
Block a user