public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1508] [Ada] Spurious accessibility error on "for of" loop parameter
@ 2021-06-16  8:45 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-16  8:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f5b4b6bf14a571df07021936c29b4773beb80324

commit r12-1508-gf5b4b6bf14a571df07021936c29b4773beb80324
Author: Justin Squirek <squirek@adacore.com>
Date:   Sat Feb 27 14:30:09 2021 -0500

    [Ada] Spurious accessibility error on "for of" loop parameter
    
    gcc/ada/
    
            * sem_util.adb (Accessibility_Level): Take into account
            renamings of loop parameters.

Diff:
---
 gcc/ada/sem_util.adb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 65376b1e1a1..aa2449329cd 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-16  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16  8:45 [gcc r12-1508] [Ada] Spurious accessibility error on "for of" loop parameter Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).