aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-04-09 12:56:01 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-16 09:07:18 -0400
commitdad94b3aca12f25cd2b3f6c32b7e55d69c8c4ad6 (patch)
tree614286d9ac2c0641e1e3afaf0e11a075c37403f4 /gcc
parenteb6dc6f301e444c3644fc209c786c7edb9bb238d (diff)
downloadgcc-dad94b3aca12f25cd2b3f6c32b7e55d69c8c4ad6.zip
gcc-dad94b3aca12f25cd2b3f6c32b7e55d69c8c4ad6.tar.gz
gcc-dad94b3aca12f25cd2b3f6c32b7e55d69c8c4ad6.tar.bz2
[Ada] Fix spurious error on derived private type with predicate
2020-06-16 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch4.adb (Common_Type): Go to Underlying_Full_View, if any.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch4.adb22
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 92c5a7a..bc841c0 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -3291,20 +3291,30 @@ package body Sem_Ch4 is
T2 : Entity_Id) return Boolean
is
function Common_Type (T : Entity_Id) return Entity_Id;
- -- Find non-private full view if any, without going to ancestor type
- -- (as opposed to Underlying_Type).
+ -- Find non-private underlying full view if any, without going to
+ -- ancestor type (as opposed to Underlying_Type).
-----------------
-- Common_Type --
-----------------
function Common_Type (T : Entity_Id) return Entity_Id is
+ CT : Entity_Id;
+
begin
- if Is_Private_Type (T) and then Present (Full_View (T)) then
- return Base_Type (Full_View (T));
- else
- return Base_Type (T);
+ CT := T;
+
+ if Is_Private_Type (CT) and then Present (Full_View (CT)) then
+ CT := Full_View (CT);
end if;
+
+ if Is_Private_Type (CT)
+ and then Present (Underlying_Full_View (CT))
+ then
+ CT := Underlying_Full_View (CT);
+ end if;
+
+ return Base_Type (CT);
end Common_Type;
-- Start of processing for Compatible_Types_In_Predicate