aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2020-06-25 16:44:27 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-16 03:31:25 -0400
commita121d54f7b59cbb424f707acd587adba4ad265d4 (patch)
tree0910cc2b31430f4197335ab808a786a8958bf178
parentf54147fcfd885598d57783f98b0786e9e200a5dc (diff)
downloadgcc-a121d54f7b59cbb424f707acd587adba4ad265d4.zip
gcc-a121d54f7b59cbb424f707acd587adba4ad265d4.tar.gz
gcc-a121d54f7b59cbb424f707acd587adba4ad265d4.tar.bz2
[Ada] Spurious visibility error on Declare_Expression with renames
gcc/ada/ * sem_res.adb (Resolve_Declare_Expression): Retrieve the created block entity that is the scope of the local declarations, from either a local object declaration or an object renaming declaration. The block entity does not have an explicit declaration, but appears as the scope of all locally declared objects.
-rw-r--r--gcc/ada/sem_res.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index de1bee9..cd87ec2 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -7441,11 +7441,14 @@ package body Sem_Res is
-- Install the scope created for local declarations, if
-- any. The syntax allows a Declare_Expression with no
-- declarations, in analogy with block statements.
+ -- Note that that scope has no explicit declaration, but
+ -- appears as the scope of all entities declared therein.
Decl := First (Actions (N));
while Present (Decl) loop
- exit when Nkind (Decl) = N_Object_Declaration;
+ exit when Nkind (Decl)
+ in N_Object_Declaration | N_Object_Renaming_Declaration;
Next (Decl);
end loop;