Explorar o código

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

git-svn-id: trunk@10453 -
florian %!s(int64=17) %!d(string=hai) anos
pai
achega
914a8ec4b4
Modificáronse 3 ficheiros con 22 adicións e 1 borrados
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/pexpr.pas
  3. 20 0
      tests/webtbs/tw10495.pp

+ 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/tw10454.pp svneol=native#text/plain
 tests/webtbs/tw1046.pp svneol=native#text/plain
 tests/webtbs/tw1046.pp svneol=native#text/plain
 tests/webtbs/tw10489.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/tw1050.pp svneol=native#text/plain
 tests/webtbs/tw10519.pp svneol=native#text/plain
 tests/webtbs/tw10519.pp svneol=native#text/plain
 tests/webtbs/tw10540.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
                    ccallparanode.create(caddrnode.create_internal
                   (ctemprefnode.create(temp)),
                   (ctemprefnode.create(temp)),
                    ccallparanode.create(ctypeconvnode.create_internal(p4,cvarianttype),
                    ccallparanode.create(ctypeconvnode.create_internal(p4,cvarianttype),
-                   ccallparanode.create(p1
+                   ccallparanode.create(ctypeconvnode.create_internal(p1,cvarianttype)
                      ,nil))));
                      ,nil))));
 
 
                 addstatement(newstatement,ccallnode.createintern('fpc_vararray_put',paras));
                 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.