[Ada] Warn on slices of the form A (subtype) for all objects
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 15 Apr 2020 20:53:54 +0000 (22:53 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 26 Nov 2020 08:39:51 +0000 (03:39 -0500)
gcc/ada/

* sem_eval.adb (Eval_Slice): Emit warning not just for
constants, but for any objects.

gcc/ada/sem_eval.adb

index 443926f1e7ee5e64baaed7fc99c5439a82a09ffb..e453bc1676b8a0f64aba6a12791b3962e7d19588 100644 (file)
@@ -3961,7 +3961,7 @@ package body Sem_Eval is
             T : constant Entity_Id := Etype (E);
 
          begin
-            if Ekind (E) = E_Constant
+            if Is_Object (E)
               and then Is_Array_Type (T)
               and then Is_Entity_Name (Drange)
             then