EVariantTypeCastError in call to VarArrayOf with array of QWord as parameter
Summary
When assigning array of QWord to Variant variable using VarArrayOf function EVariantTypeCastError exception is raised with message: Could not convert variant of type (QWord) into type (Array of Variant).
System Information
- Operating system: Windows
- Processor architecture: x86-64
- Compiler version: trunk
- Device: Computer
Steps to reproduce
Run example project.
Example Project
program Project1;
{$mode delphi}
uses SysUtils, Variants;
var a: variant; b: UInt64;
begin
b := 1;
a := VarArrayOf([b]);
writeln('a=',a[0],'; b=',b);
end.
What is the current bug behavior?
Project runs and raises an exception in call to VarArrayOf.
What is the expected (correct) behavior?
Project runs without exceptions.
Possible fixes
varQWord seems to be missing from set of valid elements in function VarTypeIsValidElementType file variants.pp package rtl-objpas. When I add varQWord to the list of valid elements, the exception is no longer raised and example project works correctly.