Explorar el Código

--- Merging r30168 into '.':
U compiler/symdef.pas
--- Recording mergeinfo for merge of r30168 into '.':
U .
--- Merging r33164 into '.':
A tests/webtbs/tw29547.pp
--- Recording mergeinfo for merge of r33164 into '.':
G .

git-svn-id: branches/fixes_3_0@33165 -

Jonas Maebe hace 9 años
padre
commit
6303eda6d8
Se han modificado 3 ficheros con 47 adiciones y 3 borrados
  1. 1 0
      .gitattributes
  2. 9 3
      compiler/symdef.pas
  3. 37 0
      tests/webtbs/tw29547.pp

+ 1 - 0
.gitattributes

@@ -14334,6 +14334,7 @@ tests/webtbs/tw2944.pp svneol=native#text/plain
 tests/webtbs/tw2946.pp svneol=native#text/plain
 tests/webtbs/tw2949.pp svneol=native#text/plain
 tests/webtbs/tw2953.pp svneol=native#text/plain
+tests/webtbs/tw29547.pp svneol=native#text/plain
 tests/webtbs/tw2956.pp svneol=native#text/plain
 tests/webtbs/tw2958.pp svneol=native#text/plain
 tests/webtbs/tw2966.pp svneol=native#text/plain

+ 9 - 3
compiler/symdef.pas

@@ -4023,9 +4023,15 @@ implementation
           begin
             if tsym(symtable.symlist[i]).typ<>fieldvarsym then
               continue;
-            if assigned(tfieldvarsym(symtable.symlist[i]).vardef) and
-              tstoreddef(tfieldvarsym(symtable.symlist[i]).vardef).is_fpuregable then
-              exit;
+            if assigned(tfieldvarsym(symtable.symlist[i]).vardef) then
+              begin
+                if tstoreddef(tfieldvarsym(symtable.symlist[i]).vardef).is_fpuregable then
+                  exit;
+                { search recursively }
+                if (tstoreddef(tfieldvarsym(symtable.symlist[i]).vardef).typ=recorddef) and
+                  (tabstractrecorddef(tfieldvarsym(symtable.symlist[i]).vardef).contains_float_field) then
+                  exit;
+              end;
           end;
         result:=false;
       end;

+ 37 - 0
tests/webtbs/tw29547.pp

@@ -0,0 +1,37 @@
+program Test;
+
+{$mode objfpc}
+
+type
+    Point2D = record
+      x, y: Single;
+    end;
+
+    Line = record
+        start : Point2D;
+        endP : Point2D;
+    end;
+
+function LineFrom(p1, p2: Point2D): Line;
+begin
+    result.start := p1;
+    result.endP := p2;
+end;
+
+procedure Main();
+var
+    l: Line;
+    pt1, pt2: Point2D;
+begin
+    pt1.x := 1.0;
+    pt2.x := 2.0;
+    l := LineFrom(pt1, pt2);
+    if (l.start.x<>1.0) or
+       (l.endp.x<>2.0) then
+      halt(1);
+end;
+
+begin
+    Main();
+end.
+