Peter N Lewis wrote:
Using methods-always-virtual gives a problem for interface-only/implementation-only compiles.
With the example shown below, if you compile with
gpc -c peterQ.pas
all is well, but if you compile as gp often does, first with interface-only and then with implementation-only:
gpc -c --interface-only peterQ.pas gpc -c --implementation-only peterQ.pas
gpc thinks the object defined in the interface is not methods-always-virtual.
Note that using the command line switch --methods-always-virtual in both compiles makes no difference.
<snip>
zany:~/unix/c/testgpco% gpc -c peterQ.pas peterQ.pas:9: warning: object type has virtual method, but no constructor zany:~/unix/c/testgpco% gpc -c --interface-only peterQ.pas peterQ.pas:9: warning: object type has virtual method, but no constructor zany:~/unix/c/testgpco% gpc -c --implementation-only peterQ.pas peterQ.pas:9: warning: object type has virtual method, but no constructor peterQ.pas: In method `MyObject.Destroy': peterQ.pas:17: error: argument 1 to `Dispose' must be a pointer
That is still problem of `self' beeing a reference: the information needed to decide if `self' should be a pointer was not passed trough .gpi files. The following should fix this:
--- p.nn/module.c 2005-03-25 21:32:59.000000000 +0100 +++ p/module.c 2005-07-01 13:47:45.044573312 +0200 @@ -2012,6 +2012,7 @@ #ifdef EGCS store_node (TYPE_SIZE_UNIT (t)); #endif + store_node (TYPE_POINTER_TO (t)); store_node (TYPE_GET_INITIALIZER (t)); store_node (TYPE_MAIN_VARIANT (t) == t ? NULL_TREE : TYPE_MAIN_VARIANT (t)); break; @@ -2478,6 +2479,7 @@ #ifdef EGCS TYPE_SIZE_UNIT (t) = load_node (); #endif + TYPE_POINTER_TO (t) = load_node (); tmp = load_node (); if (tmp) { --- p.nn/utils/gpidump.pas 2005-03-31 01:01:01.000000000 +0200 +++ p/utils/gpidump.pas 2005-07-01 14:05:53.575091520 +0200 @@ -836,6 +836,7 @@ {$ifdef EGCS} Ref ('size_unit'); {$endif} + Ref ('pointer_to'); OptRef ('initializer'); OptRef ('main_variant'); end;