]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Enable resolution of overloading on Last and Previous for Iterable
authorClaire Dross <dross@adacore.com>
Wed, 11 Mar 2026 09:25:16 +0000 (10:25 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 29 May 2026 08:49:47 +0000 (10:49 +0200)
The resolution of overloading for the optional Last and Previous primitives
of an Iterable aspect should be done like for other primitives.

gcc/ada/ChangeLog:

* sem_ch13.adb (Resolve_Iterable_Operation): Handle Previous and Last
like Next and First.

gcc/ada/sem_ch13.adb

index a08b13445db5a127e249f272300ce6c19085f724..03063a6942597c78be2036772355554e8809aef8 100644 (file)
@@ -18057,7 +18057,7 @@ package body Sem_Ch13 is
                then
                   F1 := First_Formal (It.Nam);
 
-                  if Nam = Name_First then
+                  if Nam in Name_First | Name_Last then
                      if Etype (It.Nam) = Cursor
                        and then No (Next_Formal (F1))
                      then
@@ -18065,7 +18065,7 @@ package body Sem_Ch13 is
                         exit;
                      end if;
 
-                  elsif Nam = Name_Next then
+                  elsif Nam in Name_Next | Name_Previous then
                      F2 := Next_Formal (F1);
 
                      if Present (F2)