[fpc-devel] Minor Error in $delphi mode for a unit I'm converting
Michael Van Canneyt
michael at freepascal.org
Fri Jun 10 10:48:07 CEST 2005
On Fri, 10 Jun 2005, L505 wrote:
> While converting a KOL regular expression unit for use with freepascal, I came
> across only one compile error, in {$mode delphi}
>
> The error was here:
> const
> RegExprInvertCaseFunction : TRegExprInvertCaseFunction=TRegExpr.InvertCaseFunction;
>
> Error: Typed constants of the type "procedure of object" can only be initialized
> with NIL
>
> The code below seemed to fix the problem, as it compiled ok.
> var
> RegExprInvertCaseFunction : TRegExprInvertCaseFunction;
>
> Is the error that I got correct even for delphi compatability? Is it bad code,
> good code?
It is bad code.
Since there is no instance of TRegExpr, the assignment would only work for
a class method, which makes little sense.
Michael.
More information about the fpc-devel
mailing list