]> 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)
committerEric Botcazou <ebotcazou@adacore.com>
Tue, 10 Jun 2025 08:58:59 +0000 (10:58 +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 f4674f565e6545c46251026ffe43af14ae0723c7..b6c16052ee08b51752d7bca6afacb828dc375854 100644 (file)
@@ -7010,7 +7010,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