fpc/tests/webtbf/tw16234.pp
Jonas Maebe 72758864e4 * only allow field names in record/object typed constant declarations (mantis #16234)
* improved error recovery after encountering invalid field name in record/object typed constant
    declaration

git-svn-id: trunk@15150 -
2010-04-18 07:55:42 +00:00

19 lines
362 B
ObjectPascal

{ %fail }
type
MyObjType = object
Field1 : String;
Field2 : String;
Field3 : String;
property Prop3:String read Field3;
end;
var // or const
Obj: MyObjType = (Prop3:'prop3';Field3:'field3'); // actually sets Field1 ?!
begin
writeln(Obj.Field1); // prints 'prop3' ?!
writeln(Obj.Field3); // prints 'field3'
writeln(Obj.Prop3); // prints 'field3'
end.