From a121d54f7b59cbb424f707acd587adba4ad265d4 Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Thu, 25 Jun 2020 16:44:27 -0400 Subject: [PATCH] [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. --- gcc/ada/sem_res.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index de1bee99540..cd87ec235af 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; -- 2.30.2