aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-07-13 15:22:27 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-20 03:21:30 -0400
commit797c14b5cd592ee5ded30f4c002a18e8a76de7d9 (patch)
tree37af39305987f623efb3a7e437ef8fa9de69d643 /gcc/ada/sem_ch3.adb
parente837a621857bf6c61be5db4666fadf8db14fa2a0 (diff)
downloadgcc-797c14b5cd592ee5ded30f4c002a18e8a76de7d9.zip
gcc-797c14b5cd592ee5ded30f4c002a18e8a76de7d9.tar.gz
gcc-797c14b5cd592ee5ded30f4c002a18e8a76de7d9.tar.bz2
[Ada] Propagate predicate function to a full view of a private subtype
gcc/ada/ * sem_ch3.adb (Analyze_Subtype_Declaration): Propagate predicate function to full view of the created type as well, if it was created.
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 8fe118b..91e4ebb 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -5713,6 +5713,16 @@ package body Sem_Ch3 is
then
Set_Subprograms_For_Type (Id, Subprograms_For_Type (T));
+ -- If the current declaration created both a private and a full view,
+ -- then propagate Predicate_Function to the latter as well.
+
+ if Present (Full_View (Id))
+ and then No (Predicate_Function (Full_View (Id)))
+ then
+ Set_Subprograms_For_Type
+ (Full_View (Id), Subprograms_For_Type (Id));
+ end if;
+
if Has_Static_Predicate (T) then
Set_Has_Static_Predicate (Id);
Set_Static_Discrete_Predicate (Id, Static_Discrete_Predicate (T));