Skip to content

Problems with TValue and Boolean

Under special circumstances a Boolean is not implicitly converted to a TValue. Here is a test project, which compiles under Delphi.

program Project1;

uses
  System.Rtti;

type
  TMyClass = class(TObject)
  strict private
    FMyValue: TValue;
  public
    property MyValue: TValue read FMyValue write FMyValue;
  end;

var
  lClass: TMyClass;

begin
  lClass := TMyClass.Create;
  try
    lClass.MyValue := False;
  finally
    lClass.Free;
  end;
end.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information