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-346] [Ada] Fix remaining asymmetry in Specific_Type Date: Thu, 12 May 2022 12:40:01 +0000 (GMT) [thread overview] Message-ID: <20220512124001.7985A383D837@sourceware.org> (raw) https://gcc.gnu.org/g:b9cff88ca79664ade8bd1c870d01b56f8599afa4 commit r13-346-gb9cff88ca79664ade8bd1c870d01b56f8599afa4 Author: Eric Botcazou <ebotcazou@adacore.com> Date: Sun Feb 6 15:54:25 2022 +0100 [Ada] Fix remaining asymmetry in Specific_Type gcc/ada/ * sem_type.adb (Specific_Type): Add swapped cases for interfaces. Diff: --- gcc/ada/sem_type.adb | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index d5ee20b0c74..971b1a3183b 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -3354,13 +3354,8 @@ package body Sem_Type is elsif T2 = Raise_Type then return B1; - -- ---------------------------------------------------------- - -- Special cases for equality operators (all other predefined - -- operators can never apply to tagged types) - -- ---------------------------------------------------------- - -- Ada 2005 (AI-251): T1 and T2 are class-wide types, and T2 is an - -- interface + -- interface, return T1, and vice versa. elsif Is_Class_Wide_Type (T1) and then Is_Class_Wide_Type (T2) @@ -3368,8 +3363,14 @@ package body Sem_Type is then return T1; + elsif Is_Class_Wide_Type (T2) + and then Is_Class_Wide_Type (T1) + and then Is_Interface (Etype (T1)) + then + return T2; + -- Ada 2005 (AI-251): T1 is a concrete type that implements the - -- class-wide interface T2 + -- class-wide interface T2, return T1, and vice versa. elsif Is_Tagged_Type (T1) and then Is_Class_Wide_Type (T2) @@ -3379,6 +3380,14 @@ package body Sem_Type is then return T1; + elsif Is_Tagged_Type (T2) + and then Is_Class_Wide_Type (T1) + and then Is_Interface (Etype (T1)) + and then Interface_Present_In_Ancestor (Typ => T2, + Iface => Etype (T1)) + then + return T2; + elsif Is_Class_Wide_Type (T1) and then Is_Ancestor (Root_Type (T1), T2) then
reply other threads:[~2022-05-12 12:40 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=20220512124001.7985A383D837@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: linkBe 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).