From 86b747a553784eb0675406c23f4789afe76eadab Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Fri, 6 Nov 2020 10:21:06 -0500 Subject: [PATCH] [Ada] Spurious visibility error in subprogram body in with_clause 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 675aeed6b34..e1535e2f540 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -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; -- 2.30.2