[gcc r15-1518] ada: Cannot override inherited function with controlling result
Marc Poulhi?s
dkm@gcc.gnu.org
Fri Jun 21 08:38:04 GMT 2024
https://gcc.gnu.org/g:df0637007e08eb11ead3ba4ac76de2b69a115327
commit r15-1518-gdf0637007e08eb11ead3ba4ac76de2b69a115327
Author: Javier Miranda <miranda@adacore.com>
Date: Thu May 30 11:24:54 2024 +0000
ada: Cannot override inherited function with controlling result
When a package has the declaration of a derived tagged
type T with private null extension that inherits a public
function F with controlling result, and a derivation of T
is declared in the public part of another package, overriding
function F may be rejected by the compiler.
gcc/ada/
* sem_disp.adb (Find_Hidden_Overridden_Primitive): Check
public dispatching primitives of ancestors; previously,
only immediately-visible primitives were checked.
Diff:
---
gcc/ada/sem_disp.adb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 9c498ee9a3f7..fe822290e453 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -89,7 +89,9 @@ package body Sem_Disp is
-- to the found entity; otherwise return Empty.
--
-- This routine does not search for non-hidden primitives since they are
- -- covered by the normal Ada 2005 rules.
+ -- covered by the normal Ada 2005 rules. Its name was motivated by an
+ -- intermediate version of AI05-0125 where this term was proposed to
+ -- name these entities in the RM.
function Is_Inherited_Public_Operation (Op : Entity_Id) return Boolean;
-- Check whether a primitive operation is inherited from an operation
@@ -2403,7 +2405,7 @@ package body Sem_Disp is
Orig_Prim := Original_Corresponding_Operation (Prim);
if Orig_Prim /= Prim
- and then Is_Immediately_Visible (Orig_Prim)
+ and then not Is_Hidden (Orig_Prim)
then
Vis_Ancestor := First_Elmt (Vis_List);
while Present (Vis_Ancestor) loop
More information about the Gcc-cvs
mailing list