瀏覽代碼

* generate specializations only of no error happened so far to prevent further (internal)errors, resolves #40646

florian 1 年之前
父節點
當前提交
af482fde23
共有 2 個文件被更改,包括 19 次插入2 次删除
  1. 3 2
      compiler/pmodules.pas
  2. 16 0
      tests/webtbf/tw40646.pp

+ 3 - 2
compiler/pmodules.pas

@@ -2313,9 +2313,10 @@ type
            end;
            end;
 
 
          { Generate specializations of objectdefs methods }
          { Generate specializations of objectdefs methods }
-         generate_specialization_procs;
+         if Errorcount=0 then
+           generate_specialization_procs;
 
 
-         // This needs to be done before we generate the VMTs
+         { This needs to be done before we generate the VMTs }
          if (target_cpu=tsystemcpu.cpu_wasm32) then
          if (target_cpu=tsystemcpu.cpu_wasm32) then
            add_synthetic_interface_classes_for_st(current_module.localsymtable);
            add_synthetic_interface_classes_for_st(current_module.localsymtable);
 
 

+ 16 - 0
tests/webtbf/tw40646.pp

@@ -0,0 +1,16 @@
+{ %fail }
+program Project1;
+type
+  generic TFoo<_A: TObject> = class
+    type x = type _A;
+    type b = class(x)
+    end;
+  end;
+
+  TBar = class sealed
+  end;
+
+  TAbc = specialize TFoo<TBar>;
+
+begin
+end.