'Delphi does not infer TDateTime for local variables

I have a routine that fetches a TDateTime from a database. I fetch it like this in another routine:

var lCrmStartDate := self.GetCrmStartDate;

This results in lCrmStartDate being inferred as Extended, giving me all sorts of trouble.

I now fetch the date like so:

var lCrmStartDate : TDateTime := self.GetCrmStartDate;

and that works fine.

Can someone explain to me why the compiler infers Extended instead of TDateTime (which is the return type for GetCrmStartDate())?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source