]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Storage_Error on Ordered_Maps container aggregate with enumeration Key_Type
authorGary Dismukes <dismukes@adacore.com>
Fri, 21 Mar 2025 22:03:46 +0000 (22:03 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 10 Jun 2025 07:32:06 +0000 (09:32 +0200)
The compiler fails with a Storage_Error when compiling a container aggregate
for a Map type coming from an instantiation of Ada.Containers.Ordered_Maps
that specifies an enumeration type for the Key_Type formal.

gcc/ada/ChangeLog:

* exp_aggr.adb (Build_Container_Aggr_Code.To_Int): Apply Enumeration_Pos
to Entity (Expr) rather than Expr.

gcc/ada/exp_aggr.adb

index 8db15fa6a11d28f37c3a5c238d48285eff79c770..8aad72179358fdf430dfc9cd1c906ca8d92e6a89 100644 (file)
@@ -7017,7 +7017,7 @@ package body Exp_Aggr is
       begin
          return UI_To_Int ((if Nkind (Expr) = N_Integer_Literal
                             then Intval (Expr)
-                            else Enumeration_Pos (Expr)));
+                            else Enumeration_Pos (Entity (Expr))));
       end To_Int;
 
       --  Local variables