aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Servais <servais@adacore.com>2022-02-21 16:32:46 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-17 08:25:44 +0000
commit27b2b83bd7c1a9dfdba4ef27ea120ae5e1ead0b0 (patch)
tree1f8f5021d1bf257e12ec51a247bfc272ebad702f
parentc21a0097b63f1117b780f7b56332d40d5cbc9625 (diff)
downloadgcc-27b2b83bd7c1a9dfdba4ef27ea120ae5e1ead0b0.zip
gcc-27b2b83bd7c1a9dfdba4ef27ea120ae5e1ead0b0.tar.gz
gcc-27b2b83bd7c1a9dfdba4ef27ea120ae5e1ead0b0.tar.bz2
[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.
-rw-r--r--gcc/ada/sem_ch3.adb4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index d2605f5..d41e271 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