https://gcc.gnu.org/g:73659413d445b16accc64c28df404945f2ac157f

commit r17-888-g73659413d445b16accc64c28df404945f2ac157f
Author: Eric Botcazou <[email protected]>
Date:   Tue Mar 10 10:14:20 2026 +0100

    ada: Fix iterator for Iterable aspect rejected without subtype indication
    
    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.

Diff:
---
 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 825aeb3a8778..5f6570f36f08 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,

Reply via email to