Peter Schorn wrote:
- Cast in with statement
program prog3; { compile with gpc --mac-pascal prog3.pas } type baseType = object end;
derivedType = object(baseType) procedure f; end;
procedure derivedType.f; begin end;
var a: baseType; b: derivedType;
begin new(b); a := b; derivedType(a).f; { ok } with derivedType(a) do { warning: `with' element is not a constant or an lvalue } f; { error: invalid lvalue in method call } { error: function call used as a statement } end.
A workaround is to use a temporary variable for the with statement.
This compiles with gpc-20060325 (but not with the compiler at my website, based on gpc-20051116)
Regards,
Adriaan van Os