On Thu, March 21, 2013 10:53, OBones wrote:
Hello, > I'm using FPC 2.6.0 and have the following test program : > > program test; > > function Element: Double; > begin > Result := 4; > end; > > function Tmp: Double; > begin > Result := 10; + Element; > end; > > begin > WriteLn(Tmp); > end. > > And quite surprisingly to me, both ppc386 and pccrossx64 compile it > successfully in Delphi mode! I don't have Delphi but TP/BP fails on this indeed (even when replacing the Result references with the names of the respective functions as required with TP/BP). > What's even weirder is that if I replace the Plus operator by a Minus > operator, then the compilation fails. No idea why '+' should be different to '-' here, but I may have missed something. > What I was expecting is that the compilation fails in all cases. > Is there some flag that I failed to specify? You can add {$X-} to the top (i.e. disable the so-called extended syntax allowing to treat functions like procedures) and then it fails. However, I think that it should fail on the plus sign in any case and I would suggest filing a bug report. Tomas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal