2
0
Эх сурвалжийг харах

* convert the array into a variant as well before calling fpc_variant_put, resolves #10495

git-svn-id: trunk@10453 -
florian 17 жил өмнө
parent
commit
914a8ec4b4

+ 1 - 0
.gitattributes

@@ -7979,6 +7979,7 @@ tests/webtbs/tw1044.pp svneol=native#text/plain
 tests/webtbs/tw10454.pp svneol=native#text/plain
 tests/webtbs/tw1046.pp svneol=native#text/plain
 tests/webtbs/tw10489.pp svneol=native#text/plain
+tests/webtbs/tw10495.pp svneol=native#text/plain
 tests/webtbs/tw1050.pp svneol=native#text/plain
 tests/webtbs/tw10519.pp svneol=native#text/plain
 tests/webtbs/tw10540.pp svneol=native#text/plain

+ 1 - 1
compiler/pexpr.pas

@@ -1747,7 +1747,7 @@ implementation
                    ccallparanode.create(caddrnode.create_internal
                   (ctemprefnode.create(temp)),
                    ccallparanode.create(ctypeconvnode.create_internal(p4,cvarianttype),
-                   ccallparanode.create(p1
+                   ccallparanode.create(ctypeconvnode.create_internal(p1,cvarianttype)
                      ,nil))));
 
                 addstatement(newstatement,ccallnode.createintern('fpc_vararray_put',paras));

+ 20 - 0
tests/webtbs/tw10495.pp

@@ -0,0 +1,20 @@
+uses
+  variants;
+var
+  tmp: OleVariant;
+  a: OleVariant;
+  b: OleVariant;
+begin
+  tmp:=VarArrayCreate([0,2], varVariant);
+  a:=1234;
+  b:=4321;
+  tmp[0]:=a;
+  tmp[1]:=b;
+  a:=tmp[0];
+  b:=tmp[1];
+  if a<>1234 then
+    halt(1);
+  if b<>4321 then
+    halt(1);
+  writeln('ok');
+end.