From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Bob Duff <duff@adacore.com>
Subject: [COMMITTED] ada: Error in prefix-notation call
Date: Tue, 7 Nov 2023 10:19:58 +0100 [thread overview]
Message-ID: <20231107091958.3906017-1-poulhies@adacore.com> (raw)
From: Bob Duff <duff@adacore.com>
The compiler gives a wrong error for a call of the form X.Y(...)
when Y is inherited indirectly via an interface.
gcc/ada/
* sem_ch4.adb (Is_Private_Overriding): Return True in the case
where a primitive operation is publicly inherited but privately
overridden.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_ch4.adb | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 50ba6c9c847..2f3dfe71590 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -10223,9 +10223,15 @@ package body Sem_Ch4 is
elsif not Comes_From_Source (Visible_Op)
and then Alias (Visible_Op) = Op
- and then not Is_Hidden (Visible_Op)
then
- return True;
+ -- If Visible_Op or what it overrides is not hidden, then we
+ -- have found what we're looking for.
+
+ if not Is_Hidden (Visible_Op)
+ or else not Is_Hidden (Overridden_Operation (Op))
+ then
+ return True;
+ end if;
end if;
Visible_Op := Homonym (Visible_Op);
--
2.42.0
reply other threads:[~2023-11-07 9:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231107091958.3906017-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=duff@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).