Here is my error demo program:
procedure test_bug is
d : Duration;
s : Duration := 1.0;
begin
-- The following compile:
d := 1.0*2.0*3.0;
d := s*2.0;
d := s*(2.0*3.0); -- Why does this work,
d := s*s;
d := s*Duration(s*s); -- and this works,
-- The following DO NOT compile:
d := Duration(1.0)*2.0*3.0;
d := Duration(1.0)*(2.0*3.0)*(4.0);
d := Duration(1.0)*Duration(2.0)*Duration(3.0);
d := s*s*s;
d := s*(s*s); -- but this doesn't work???
d := s*2.0*3.0;
d := s*Duration(2.0)*Duration(3.0);
end test_bug;
Here are the results from compiling with both GCC 14.2.0 and 15.2.0 (warnings redacted):
test_bug.adb:14:21: error: type cannot be determined from context
test_bug.adb:14:21: error: explicit conversion to result type required
test_bug.adb:15:21: error: type cannot be determined from context
test_bug.adb:15:21: error: explicit conversion to result type required
test_bug.adb:16:21: error: type cannot be determined from context
test_bug.adb:16:21: error: explicit conversion to result type required
test_bug.adb:17:09: error: type cannot be determined from context
test_bug.adb:17:09: error: explicit conversion to result type required
test_bug.adb:18:12: error: type cannot be determined from context
test_bug.adb:18:12: error: explicit conversion to result type required
test_bug.adb:19:09: error: type cannot be determined from context
test_bug.adb:19:09: error: explicit conversion to result type required
test_bug.adb:20:09: error: type cannot be determined from context
test_bug.adb:20:09: error: explicit conversion to result type required
The workaround seems to be extra parentheses and/or casts, as in program lines 10 and 12.
If I change Duration to Float it compiles without errors.