瀏覽代碼

* discard type conversions from/to generic defs for llvm as well

git-svn-id: trunk@38864 -
Jonas Maebe 7 年之前
父節點
當前提交
8da8b956b0
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      compiler/ncnv.pas

+ 7 - 1
compiler/ncnv.pas

@@ -2439,7 +2439,13 @@ implementation
 {$ifdef llvm}
                      { we still may have to insert a type conversion at the
                        llvm level }
-                     if left.resultdef<>resultdef then
+                     if (left.resultdef<>resultdef) and
+                        { if unspecialised generic -> we won't generate any code
+                          for this, and keeping the type conversion node will
+                          cause valid_for_assign to fail because the typecast will be from/to something of 0
+                          bytes to/from something with a non-zero size }
+                        not is_typeparam(left.resultdef) and
+                        not is_typeparam(resultdef) then
                        result:=nil
                      else
 {$endif llvm}