[fpc-devel] misleading error msg in fpc 2.2.0

Peter Vreman peter at freepascal.org
Mon Feb 4 20:35:07 CET 2008

Giuliano Colla wrote:
> While porting Delphi CLX library to fpc/Lazarus, I mixed up things, and 
> I tried to override an ancestor method which is static in CLX, because I 
> remembered it to be virtual in Lazarus.
> So far so good, but it took me some time to sort out the problem, 
> because the compiler error message was "There's no ancestor method to be 
> overridden", instead of "A static method can't be overridden" (as Delphi 
> tells in such cases).
> So I started looking for typos, wrong inheritance, etc, instead of 
> looking for the real bug. Has this error message been fixed in 2.3.1 or 
> it's still there?

I don't think it is fixed based on the error file:

~/fpc/compiler/msg>>> grep -i overridden errore.msg
% overridden in the descendent class with the \var{override} directive. 
If you
parser_e_nothing_to_be_overridden=03058_E_There is no method in an 
ancestor class to be overridden: "$1"
parser_e_overridden_methods_not_same_ret=03066_E_Overridden methods must 
have the same return type: "$2" is overriden by "$1" which has another 
return type
% If you declare overridden methods in a class definition, they must
% should be overridden by a descendant class.
parser_w_overridden_methods_not_same_ret=03218_W_Overridden methods must 
have a related return type. This code may crash, it depends on a Delphi 
parser bug ("$2" is overridden by "$1" which has another return type)
% If you declare overridden methods in a class definition, they must
% method that wasn't overridden.

Please submit a bug report with example code so it will not be forgotten.


More information about the fpc-devel mailing list