aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 478819a..6205c09 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -1045,14 +1045,13 @@ package body Sem_Disp is
-- case it looks suspiciously like an attempt to define a primitive
-- operation, which requires the declaration to be in a package spec
-- (3.2.3(6)). Only report cases where the type and subprogram are
- -- in the same declaration list (by comparing the unit nodes reached
- -- via Parent links), to avoid spurious warnings on subprograms in
+ -- in the same declaration list (by checking the enclosing parent
+ -- declarations), to avoid spurious warnings on subprograms in
-- instance bodies when the type is declared in the instance spec but
-- hasn't been frozen by the instance body.
elsif not Is_Frozen (Tagged_Type)
- and then
- Parent (Parent (Tagged_Type)) = Parent (Parent (Parent (Subp)))
+ and then In_Same_List (Parent (Tagged_Type), Parent (Parent (Subp)))
then
Error_Msg_N
("?not dispatching (must be defined in a package spec)", Subp);