[fpc-pascal] Bug?

Roger Bailey rb at doc.ic.ac.uk
Sat Jun 12 02:11:53 CEST 2010


Can someone explain this?

> program WhatsGoingOnHere ; 
> 
> type
> 
>   FunctionType = function : INTEGER ;
> 	
> function NamedFunction : INTEGER ;
> begin
> NamedFunction := 12345 ;
> end ;
> 
> function TestFunction ( ActualParameter : FunctionType ) : INTEGER ;
> begin
>   TestFunction := ActualParameter ( ) ; { compiles and runs o.k. }
>   TestFunction := ActualParameter ;     { gives "incompatible type" error, but ... }
>   TestFunction := NamedFunction ;       { ... compiles and runs o.k. }
> end ;
> 
> begin
> WRITELN ( TestFunction ( NamedFunction ) ) ;
> end .



More information about the fpc-pascal mailing list