From: Eric Botcazou <[email protected]>

Iterator specifications of the In form without subtype indication are parsed
as a choice list, and later turned during semantic analysis into a bona-fide
N_Iterator_Specification node when there is a single choice with an iterator
type, but the case of the GNAT Iterable aspect is overlooked in the process.

gcc/ada/ChangeLog:

        * sem_aggr.adb (Resolve_Array_Aggregate): Also rewrite a choice list
        with a single choice as an iterator specification when the choice's
        type has the GNAT Iterable aspect specified.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_aggr.adb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 825aeb3a877..5f6570f36f0 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -2581,7 +2581,10 @@ package body Sem_Aggr is
                         Analyze (Choice);
 
                         if Is_Object_Reference (Choice)
-                          and then Is_Iterator (Etype (Choice))
+                          and then (Is_Iterator (Etype (Choice))
+                                     or else
+                                       Has_Aspect
+                                         (Etype (Choice), Aspect_Iterable))
                         then
                            Set_Iterator_Specification
                              (Assoc,
-- 
2.53.0

Reply via email to