diff options
author | Viljar Indus <indus@adacore.com> | 2023-07-05 14:21:50 +0300 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-07-18 15:11:47 +0200 |
commit | 99c419b2a8ce033e8be08f656edd350d97f72125 (patch) | |
tree | eb7192a7cbc529a6a5f9f999a5cb302f8ed8a8a6 /gcc | |
parent | a6ca70c6744ed6019b1ddbc41c8a09a45331e5bb (diff) | |
download | gcc-99c419b2a8ce033e8be08f656edd350d97f72125.zip gcc-99c419b2a8ce033e8be08f656edd350d97f72125.tar.gz gcc-99c419b2a8ce033e8be08f656edd350d97f72125.tar.bz2 |
ada: Apply correct element type for container aggregates
When dealing with a container aggregate with an iterator
specification the iterator should take the value of the
element of the container instead of the key.
gcc/ada/
* sem_aggr.adb (Resolve_Iterated_Association): Use the element
type for the iterator in a container aggregate with an iterator
specification.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_aggr.adb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 5bfbde5..ecd508a 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -3228,6 +3228,8 @@ package body Sem_Aggr is Analyze_And_Resolve (New_Copy_Tree (Key_Expr), Key_Type); End_Scope; + Typ := Key_Type; + elsif Present (Iterator_Specification (Comp)) then Copy := Copy_Separate_Tree (Iterator_Specification (Comp)); Id_Name := @@ -3252,7 +3254,7 @@ package body Sem_Aggr is elsif Present (Key_Type) then Analyze_And_Resolve (Choice, Key_Type); - + Typ := Key_Type; else Typ := Etype (Choice); -- assume unique for now end if; @@ -3282,12 +3284,8 @@ package body Sem_Aggr is Enter_Name (Id); - if No (Key_Type) then - pragma Assert (Present (Typ)); - Set_Etype (Id, Typ); - else - Set_Etype (Id, Key_Type); - end if; + pragma Assert (Present (Typ)); + Set_Etype (Id, Typ); Mutate_Ekind (Id, E_Variable); Set_Is_Not_Self_Hidden (Id); |