RAD Studio Athens

E2018

Go Up to Error and Warning Messages (Delphi)

The compiler was expecting to find the type name which specified a record, object or class but did not find one.


  program Produce;

    type
      RecordDesc = class
        chย : Char;
      end;

    var
      pChย : PChar;
      rย : RecordDesc;

    procedure A;
    begin
      pCh.chย := 'A';    (* case 1 *)

      with pCh do begin (* case 2 *)
      end;
    end;
  end.


There are two causes for the same error in this program. The first is the application of '.' to a object that is not a record. The second case is the use of a variable which is of the wrong type in a WITH statement.


  program Solve;

    type
      RecordDesc = class
        chย : Char;
      end;

    var
      rย : RecordDesc;

    procedure A;
    begin
      r.chย := 'A';    (* case 1 *)

      with r do begin (* case 2 *)
      end;
    end;
  end.

The easy solution to this error is to always make sure that the '.' and WITH are both applied only to records, objects or class variables.