]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix bogus error with "=" operator on array of private unchecked union
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 20 May 2024 16:08:07 +0000 (18:08 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 20 Jun 2024 08:50:55 +0000 (10:50 +0200)
commit3a16f19777f882f98b6d901a81157779e898f636
tree05ed358f8fa76ba736ee00a560894e26f1b4c584
parent9cf95147c04c64344466f6e41ce5be32fbde96e0
ada: Fix bogus error with "=" operator on array of private unchecked union

The code is legal and, therefore, must be accepted by the compiler, but it
must raise Program_Error at run time due to operands not having inferable
discriminants and a warning be given at compile time (RM B.3.3(22-23)).

gcc/ada/

* exp_ch4.adb (Expand_Array_Equality.Component_Equality): Copy the
Comes_From_Source flag from the original test to the new one, and
remove obsolete code dealing with unchecked unions.
* sem_util.adb (Has_Inferable_Discriminants): Return False for an
incomplete or private nominal subtype.
gcc/ada/exp_ch4.adb
gcc/ada/sem_util.adb