summaryrefslogtreecommitdiffstats
path: root/gcc/ada/sem_res.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r--gcc/ada/sem_res.adb11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 7c823a8b261..6df474133d2 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -8478,7 +8478,16 @@ package body Sem_Res is
Set_Slice_Subtype (N);
- if Nkind (Drange) = N_Range then
+ -- Check bad use of type with predicates
+
+ if Has_Predicates (Etype (Drange)) then
+ Error_Msg_NE
+ ("subtype& has predicate, not allowed in slice",
+ Drange, Etype (Drange));
+
+ -- Otherwise here is where we check suspicious indexes
+
+ elsif Nkind (Drange) = N_Range then
Warn_On_Suspicious_Index (Name, Low_Bound (Drange));
Warn_On_Suspicious_Index (Name, High_Bound (Drange));
end if;
OpenPOWER on IntegriCloud