I am working on a legacy Ada 95 project (inherited from some other company) which was originally compiled using GNAT 3.13a1. I have updated the compiler to GNAT 4.7.4, to get access to some GNAT libraries that I would like to use in further development, but I am using the -gnat95 flag.
I am having trouble getting a particular file to compile. It's a bit of an odd one, in that it was named "Ada.Calendar.GMT". This was a problem for the new compiler, which complained that I could not define a package which was a child package of a package in the Ada package tree. I figured this wasn't too big a problem, so I changed the name of the package to "GMT_Library", imported Ada.Calendar to get access to it's types, and changed the name of the file to suit (so as to prevent a further compiler warning).
But now the compiler complains that casting an Ada.Calendar.Time to a Duration is not valid. Specifically, I am given the following error:
180. D := Duration (Date);
|
>>> illegal operand for numeric conversion
Other than changing the name of the package, and importing Ada.Calendar, I have not changed this source file, or the corresponding spec file, in any other way. Why was this an allowed operation in GNAT 3.13a1? Why does it no longer work, and is there a solution?
EDIT:
D is a Duration, and Date is an Ada.Calendar.Time.
After further investigation, it appears that the original developers mostly copied the implementation of Ada.Calendar defined here. That file performs the same cast in the Split procedure. So why is it okay for the standard libraries to do it?