]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/ada/sem_res.adb
[multiple changes]
[thirdparty/gcc.git] / gcc / ada / sem_res.adb
index 7c823a8b2612031dad79d890d6d15780bec471b8..6df474133d2cb64d78ec6302b768148b6f90fe24 100644 (file)
@@ -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;