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-534] [Ada] Take full view of private type
Date: Tue, 17 May 2022 08:28:33 +0000 (GMT)	[thread overview]
Message-ID: <20220517082833.D25C03857805@sourceware.org> (raw)

https://gcc.gnu.org/g:27b2b83bd7c1a9dfdba4ef27ea120ae5e1ead0b0

commit r13-534-g27b2b83bd7c1a9dfdba4ef27ea120ae5e1ead0b0
Author: Etienne Servais <servais@adacore.com>
Date:   Mon Feb 21 16:32:46 2022 +0100

    [Ada] Take full view of private type
    
    This allows to resolve the following:
    
          type Rec (<>) is private;
          type Arr (<>) is private;
       private
          type Arr is array (Positive range <>) of Natural;
          type Rec (L : Natural) is record
             F1 : Integer;
             F2 : Arr (1 .. L);
          end record;
    
    gcc/ada/
    
            * sem_ch3.adb (Analyze_Subtype_Declaration): Use underlying type
            of Indic_Typ.
            (Constrain_Array): Ditto for T.

Diff:
---
 gcc/ada/sem_ch3.adb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index d2605f5a308..d41e27122f6 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -5978,7 +5978,7 @@ package body Sem_Ch3 is
       if Nkind (Subtype_Indication (N)) = N_Subtype_Indication then
          declare
             Indic_Typ    : constant Entity_Id :=
-                             Etype (Subtype_Mark (Subtype_Indication (N)));
+              Underlying_Type (Etype (Subtype_Mark (Subtype_Indication (N))));
             Subt_Index   : Node_Id;
             Target_Index : Node_Id;
 
@@ -13595,6 +13595,8 @@ package body Sem_Ch3 is
          T := Designated_Type (T);
       end if;
 
+      T := Underlying_Type (T);
+
       --  If an index constraint follows a subtype mark in a subtype indication
       --  then the type or subtype denoted by the subtype mark must not already
       --  impose an index constraint. The subtype mark must denote either an


                 reply	other threads:[~2022-05-17  8:28 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=20220517082833.D25C03857805@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).