aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch5.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_ch5.adb')
-rw-r--r--gcc/ada/sem_ch5.adb8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 2e48721..b2ed158 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -2298,11 +2298,15 @@ package body Sem_Ch5 is
Set_Etype (DS, Entity (DS));
end if;
- -- Attempt to iterate through non-static predicate
+ -- Attempt to iterate through non-static predicate. Note that a type
+ -- with inherited predicates may have both static and dynamic forms.
+ -- In this case it is not sufficent to check the static predicate
+ -- function only, look for a dynamic predicate aspect as well.
if Is_Discrete_Type (Entity (DS))
and then Present (Predicate_Function (Entity (DS)))
- and then No (Static_Predicate (Entity (DS)))
+ and then (No (Static_Predicate (Entity (DS)))
+ or else Has_Dynamic_Predicate_Aspect (Entity (DS)))
then
Bad_Predicated_Subtype_Use
("cannot use subtype& with non-static predicate for loop " &