]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix iterator for Iterable aspect rejected without subtype indication
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 10 Mar 2026 09:14:20 +0000 (10:14 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 28 May 2026 08:52:52 +0000 (10:52 +0200)
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.

gcc/ada/sem_aggr.adb

index 825aeb3a8778d4f661bad329d911472f57eb6f0b..5f6570f36f08dde7163f63fe319f2f8bc0d30e30 100644 (file)
@@ -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,