]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Support Constant_Reference in Iterable aspect
authorClaire Dross <dross@adacore.com>
Fri, 17 Apr 2026 15:17:13 +0000 (17:17 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 4 Jun 2026 08:42:13 +0000 (10:42 +0200)
commit6d73ecc2f312fb4fb0bb4fdffbc0e42ff2d6f342
treef1f9469e2ce9abdd05e371ccc0b694a3fc159320
parent56d64fcb9ea143785b4b834f1b501a4387188e1b
ada: Support Constant_Reference in Iterable aspect

A Constant_Reference function returning an anonymous access-to-constant
type can be supplied instead of the Element primitive to allow
iteration over elements of a container.

gcc/ada/ChangeLog:

* exp_ch5.adb (Expand_Formal_Container_Element_Loop): Use
Constant_Reference instead of Element if necessary.
* sem_ch13.adb (Resolve_Iterable_Operation): Check Constant_Reference.
(Validate_Iterable_Aspect): Handle Constant_Reference if supplied.
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Iteration over
elements of a container is allowed if Constant_Reference is supplied.
* sem_util.adb (Get_Iterable_Type_Primitive): Fix assertion.
* snames.ads-tmpl (Name_Constant_Reference): New name.
gcc/ada/exp_ch5.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch5.adb
gcc/ada/sem_util.adb
gcc/ada/snames.ads-tmpl