[Ada] Spurious visibility error in subprogram body in with_clause
authorEd Schonberg <schonberg@adacore.com>
Fri, 6 Nov 2020 15:21:06 +0000 (10:21 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 30 Nov 2020 14:16:15 +0000 (09:16 -0500)
gcc/ada/

* sem_util.adb (Enter_Name): When an inherited operation for a
local derived type is hidden by an explicit declaration of a
non-overloadable entity in the same scope, make the inherited
operation non-visible to prevent its accidental use elsewhere.

gcc/ada/sem_util.adb

index 675aeed..e1535e2 100644 (file)
@@ -8288,6 +8288,13 @@ package body Sem_Util is
                   else
                      Set_Name_Entity_Id (Chars (E), Homonym (E));
                   end if;
+
+                  --  The inherited operation cannot be retrieved
+                  --  by name, even though it may remain accesssible
+                  --  in some cases involving subprogram bodies without
+                  --  specs appearing in with_clauses..
+
+                  Set_Is_Immediately_Visible (E, False);
                end if;
             end;