From: Ed Schonberg Date: Thu, 25 Jun 2020 20:44:27 +0000 (-0400) Subject: [Ada] Spurious visibility error on Declare_Expression with renames X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a121d54f7b59cbb424f707acd587adba4ad265d4;p=gcc.git [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. --- 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;