]> 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)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 9 Jun 2025 06:32:03 +0000 (08:32 +0200)
commit109ea2d2884eac0297847af1b3a41fede3b671cc
tree5e5db5c3fbd32c72c600f29e7dace2416ff00822
parent2e0e76ca8e37c42af96d6c2c581a8ee4b600a278
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