aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 14:09:22 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 14:09:22 +0200
commit5f8d3dd5b33acad71225d815ef3389fbf6c5963d (patch)
treea5829c6632499dbe2f6e9cb4940750c08b24b786 /gcc/ada/sem_disp.adb
parent0bcee2755848bd10da9be41b00eeafef8cb65bc5 (diff)
downloadgcc-5f8d3dd5b33acad71225d815ef3389fbf6c5963d.zip
gcc-5f8d3dd5b33acad71225d815ef3389fbf6c5963d.tar.gz
gcc-5f8d3dd5b33acad71225d815ef3389fbf6c5963d.tar.bz2
[multiple changes]
2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_disp.adb (Check_Dispatching_Context): Add guard to refine the check that recognizes a call to a private overridding and replaces the called subprogram with its alias. 2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * exp_util.adb: Minor reformatting. From-SVN: r247206
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index a2eb9ce..b0a8c6a 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -549,12 +549,19 @@ package body Sem_Disp is
-- Start of processing for Check_Dispatching_Context
begin
+ -- If the called subprogram is a private overriding, replace it
+ -- with its alias, which has the correct body. Verify that the
+ -- two subprograms have the same controlling type (this is not the
+ -- case for an inherited subprogram that has become abstract).
+
if Is_Abstract_Subprogram (Subp)
and then No (Controlling_Argument (Call))
then
if Present (Alias (Subp))
and then not Is_Abstract_Subprogram (Alias (Subp))
and then No (DTC_Entity (Subp))
+ and then Find_Dispatching_Type (Subp) =
+ Find_Dispatching_Type (Alias (Subp))
then
-- Private overriding of inherited abstract operation, call is
-- legal.