summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-11 09:25:26 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-11 09:25:26 +0000
commit7e9e8bc8a8f124ac0d06d7f22e986146ff68c7c7 (patch)
tree46d21e8ecd9d60ce42e83f3b64e35a1ce9fee130 /gcc/ada/sem_disp.adb
parentde54c5aba9e149264f53a2ffb55ba0501288a771 (diff)
downloadgcc-7e9e8bc8a8f124ac0d06d7f22e986146ff68c7c7.tar.gz
2010-10-11 Ed Schonberg <schonberg@adacore.com>
* lib-xref.adb (Output_References): Common handling for objects and formals of an anonymous access type. 2010-10-11 Eric Botcazou <ebotcazou@adacore.com> * make.adb (Scan_Make_Arg): Also pass -O to both compiler and linker. 2010-10-11 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb: Fix check for illegal equality declaration in Ada2012 2010-10-11 Gary Dismukes <dismukes@adacore.com> * sem_disp.adb (Check_Dispatching_Operation): When testing for issuing a warning about subprograms of a tagged type not being dispatching, limit this to cases where the tagged type and the subprogram are declared within the same declaration list. 2010-10-11 Jerome Lambourg <lambourg@adacore.com> * projects.texi, prj-attr.adb: Add new attribute documentation_dir. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165284 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index bd51df435da..478819af007 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -1044,9 +1044,16 @@ package body Sem_Disp is
-- If the type is not frozen yet and we are not in the overriding
-- 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)).
-
- elsif not Is_Frozen (Tagged_Type) then
+ -- (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
+ -- 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)))
+ then
Error_Msg_N
("?not dispatching (must be defined in a package spec)", Subp);
return;