--- p/objects.c.orig Wed Aug 2 14:19:58 2006 +++ p/objects.c Wed Aug 2 14:21:29 2006 @@ -797,8 +797,9 @@ if (TYPE_LANG_CODE (type) == PASCAL_LANG_ABSTRACT_OBJECT) { - /* Set `Size' and `NegatedSize' to 0 for abstract objects */ - TREE_VALUE (vmt_entry) = TREE_VALUE (TREE_CHAIN (vmt_entry)) = size_zero_node; + /* Set `Size' to 0 and `NegatedSize' to -1 for abstract objects */ + TREE_VALUE (vmt_entry) = size_zero_node; + TREE_VALUE (TREE_CHAIN (vmt_entry)) = size_int (-1); if (co->warn_inherited_abstract && parent && TYPE_LANG_CODE (parent) != PASCAL_LANG_ABSTRACT_OBJECT) warning ("abstract object type `%s' inherits from non-abstract type `%s'", object_name, IDENTIFIER_NAME (DECL_NAME (TYPE_NAME (parent)))); --- p/doc/en/reference.texi.orig Wed Aug 2 14:22:41 2006 +++ p/doc/en/reference.texi Wed Aug 2 14:24:01 2006 @@ -9298,10 +9298,14 @@ object type and can be accessed via @samp{TypeOf}. @samp{Size} contains the size of the object type, @samp{NegatedSize} -contains the size negated (for runtime checks). @samp{Parent} -contains a pointer to the parent type's VMT (or nil if the type has -no parent). @samp{Name} points to a string containing the type's -name. +contains the size negated (for optional runtime checks). +@samp{Parent} contains a pointer to the parent type's VMT (or nil if +the type has no parent). @samp{Name} points to a string containing +the type's name. + +For abstract object types, @samp{Size} contains 0 and +@samp{NegatedSize} contains -1, so they will always fail the runtime +check. @subheading Conforming to --- p/test/fjf1105.pas.orig Wed Aug 2 14:28:08 2006 +++ p/test/fjf1105.pas Wed Aug 2 14:24:19 2006 @@ -0,0 +1,47 @@ +{$object-checking} + +program fjf1105 (Output); + +uses GPC; + +type + px = ^tx; + tx = abstract object + procedure p; abstract; + end; + + py = ^ty; + ty = object (tx) + constructor c; + procedure p; virtual; + end; + +constructor ty.c; +begin +end; + +procedure ty.p; +begin + WriteLn ('ty.p') +end; + +procedure ExpectError; +begin + if ExitCode = 0 then + WriteLn ('failed') + else + begin + WriteLn ('OK'); + Halt (0) {!} + end +end; + +var + a: px; + +begin + AtExit (ExpectError); + a := New (py); + SetType (a^, TypeOf (a^)^.Parent); + a^.p +end.