]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix spurious error on anonymous array initialized by conditional expression
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 27 Feb 2025 19:43:04 +0000 (20:43 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 9 Jun 2025 08:19:37 +0000 (10:19 +0200)
commit823e9733520536cf1fc427d6a128f5a7a48cc3b5
treee5e2ae71202c592a7682dfb8829487efbd215581
parentc8934b1c08111222ccf64932272e2b7ba793fccd
ada: Fix spurious error on anonymous array initialized by conditional expression

Even though the actual subtype of the anonymous array is not yet set on the
object itself by the time Insert_Conditional_Object_Declaration is called,
it is set on its initialization expression, so it can simply be forwarded
to Insert_Conditional_Object_Declaration from there, which avoids creating
a new one for each new object and triggering a subtype mismatch later.

gcc/ada/ChangeLog:

* exp_ch4.adb (Insert_Conditional_Object_Declaration): Remove Decl
formal parameter, add Typ and Const formal parameters.
(Expand_N_Case_Expression): Fix pasto in comment.  Adjust call to
Insert_Conditional_Object_Declaration and tidy up surrounding code.
(Expand_N_If_Expression): Adjust couple of calls to
Insert_Conditional_Object_Declaration.
gcc/ada/exp_ch4.adb