aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2021-02-27 14:30:09 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-16 04:43:00 -0400
commitf5b4b6bf14a571df07021936c29b4773beb80324 (patch)
tree3779bc8c06440d570ef7e394d066272c1875b543 /gcc
parent7626537ae7643013855cf28f82b16239314f20d1 (diff)
downloadgcc-f5b4b6bf14a571df07021936c29b4773beb80324.zip
gcc-f5b4b6bf14a571df07021936c29b4773beb80324.tar.gz
gcc-f5b4b6bf14a571df07021936c29b4773beb80324.tar.bz2
[Ada] Spurious accessibility error on "for of" loop parameter
gcc/ada/ * sem_util.adb (Accessibility_Level): Take into account renamings of loop parameters.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_util.adb9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 65376b1..aa24493 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -664,6 +664,15 @@ package body Sem_Util is
return Make_Level_Literal
(Scope_Depth (Enclosing_Dynamic_Scope (E)) + 1);
+ -- Check if E is an expansion-generated renaming of an iterator
+ -- by examining Related_Expression. If so, determine the
+ -- accessibility level based on the original expression.
+
+ elsif Ekind (E) in E_Constant | E_Variable
+ and then Present (Related_Expression (E))
+ then
+ return Accessibility_Level (Related_Expression (E));
+
-- Normal object - get the level of the enclosing scope
else