title: How to check Variant is Unassigned with varByRef flag set?
body: <p>It is recommended to use <code>VarIsClear</code> to check is Variant is Null, Empty or Unassigned. But I found function can return False while variable <code>Unassigned</code> in debugger if varByRef flag is set. <code>VarIsClear</code> checking </p>
  
  <pre><code>function VarIsClear(const V: Variant): Boolean;
  var
    LHandler: TCustomVariantType;
    LVarData: TVarData;
  begin
    LVarData := FindVarData(V)^;
    with LVarData do
      if VType &lt; CFirstUserType then
        Result := (VType = varEmpty) or
                  (((VType = varDispatch) or (VType = varUnknown)) and
                    (VDispatch = nil))
      else if FindCustomVariantType(VType, LHandler) then
        Result := LHandler.IsClear(LVarData)
      else
        Result := False;
  end;
  </code></pre>
  
  <p>and VType in my case is 16384 ($4000 = varByRef).
  How to check is it Null, Empty or Unassigned properly?</p>