https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107309
Bug ID: 107309 Summary: GNAT does not apply type conversion rules to dependent expressions of conditional expressions Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: jakub.s7920 at gmail dot com Target Milestone: --- Created attachment 53726 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53726&action=edit if / case expression example According to AARM 4.5.7 (10/3), if the conditional expression is an argument of a type conversion then said conversion should apply to each of the dependent expressions. I tried compiling an example taken straight from AARM on GNAT 12.1.0 and GNAT 10.3.0 but got the following error message: > $ gnat make if_exp.adb > x86_64-linux-gnu-gcc-12 -c if_exp.adb > if_exp.adb:5:34: error: expected an integer type > if_exp.adb:5:34: error: found type universal real > x86_64-linux-gnu-gnatmake-12: "if_exp.adb" compilation error Similar results with an equivalent case expression: > $ gnat make case_exp.adb > x86_64-linux-gnu-gcc-12 -c case_exp.adb > case_exp.adb:7:30: error: expected type universal integer > case_exp.adb:7:30: error: found type universal real > x86_64-linux-gnu-gnatmake-12: "case_exp.adb" compilation error I've attached the source code of both files. The commented out code is, to my understanding, semantically the same as the corresponding version that doesn't compile. http://www.ada-auth.org/standards/12rat/html/Rat12-3-2.html http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-4-5-7.html