Browse Source

* an internal definition in a specialization might not have a genericdef

Sven/Sarah Barth 3 years ago
parent
commit
b5ab81c983
1 changed files with 9 additions and 3 deletions
  1. 9 3
      compiler/pgenutil.pas

+ 9 - 3
compiler/pgenutil.pas

@@ -2775,8 +2775,10 @@ uses
         hmodule : tmodule;
       begin
         result:=true;
-        hmodule:=find_module_from_symtable(def.genericdef.owner);
-        if hmodule=nil then
+        hmodule:=nil;
+        if assigned(def.genericdef) then
+          hmodule:=find_module_from_symtable(def.genericdef.owner)
+        else if not (df_internal in def.defoptions) then
           internalerror(201202041);
         for i:=0 to def.symtable.DefList.Count-1 do
           begin
@@ -2788,7 +2790,11 @@ uses
                  continue;
                { and the body is available already (which is implicitely the
                  case if the generic routine is part of another unit) }
-               if ((hmodule=current_module) or (hmodule.state=ms_compile)) and
+               if (
+                    not assigned(hmodule) or
+                    (hmodule=current_module) or
+                    (hmodule.state=ms_compile)
+                  ) and
                   { may not be assigned in case it's a synthetic procdef that
                     still needs to be generated }
                   assigned(tprocdef(hp).genericdef) and