public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1483] [Ada] Spurious error on qualified prefix in Pack.Func'Result
Date: Tue,  5 Jul 2022 08:30:08 +0000 (GMT)	[thread overview]
Message-ID: <20220705083008.A97233851A92@sourceware.org> (raw)

https://gcc.gnu.org/g:1f85342b42b4bf9fee3cd23bc38498a3565bc9f1

commit r13-1483-g1f85342b42b4bf9fee3cd23bc38498a3565bc9f1
Author: Yannick Moy <moy@adacore.com>
Date:   Mon May 23 14:27:41 2022 +0200

    [Ada] Spurious error on qualified prefix in Pack.Func'Result
    
    When using a qualified name such as Pack.Func as the prefix of a 'Result
    attribute reference, the prefix is not fully resolved and may contain a
    chain of homonyms. Look for the expected function in the homonym chain
    instead of issuing an error if the first one is not the expected one.
    
    gcc/ada/
    
            * sem_attr.adb (Analyze_Attribute): Take into account the
            possibility of homonyms.

Diff:
---
 gcc/ada/sem_attr.adb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 6a35358261e..b8d878c3d6d 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -5835,6 +5835,12 @@ package body Sem_Attr is
 
             elsif Present (Over_Id) and then Pref_Id = Over_Id then
                return True;
+
+            --  When a qualified name is used for the prefix, homonyms may come
+            --  before the current function in the homonym chain.
+
+            elsif Has_Homonym (Pref_Id) then
+               return Denote_Same_Function (Homonym (Pref_Id), Spec_Id);
             end if;
 
             --  Otherwise the prefix does not denote the related subprogram


                 reply	other threads:[~2022-07-05  8:30 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=20220705083008.A97233851A92@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@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).