https://gcc.gnu.org/g:4aca5bc773ced42d006e07197e24462d0fa38a8f

commit r15-9813-g4aca5bc773ced42d006e07197e24462d0fa38a8f
Author: Gary Dismukes <dismu...@adacore.com>
Date:   Fri Mar 21 22:03:46 2025 +0000

    ada: Storage_Error on Ordered_Maps container aggregate with enumeration 
Key_Type
    
    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.

Diff:
---
 gcc/ada/exp_aggr.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index f4674f565e65..b6c16052ee08 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -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

Reply via email to