[Ada] Warnings on overloays involving generic In_Parameters
authorEd Schonberg <schonberg@adacore.com>
Mon, 15 Jun 2020 21:40:26 +0000 (17:40 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 27 Jul 2020 08:05:16 +0000 (04:05 -0400)
gcc/ada/

* sem_ch13.adb (Analyze_Address_Specification_Clause): Do not
emit a warning when a constant declaration in a generic unit
overlays a generic In_Parameter.

gcc/ada/sem_ch13.adb

index ec25e3d6eb43ff03257ba5d466cb12218c7659e1..6927d54fc5fb3ab7394a67962d859b0c6be5f1d1 100644 (file)
@@ -6190,9 +6190,13 @@ package body Sem_Ch13 is
                   --  Issue an unconditional warning for a constant overlaying
                   --  a variable. For the reverse case, we will issue it only
                   --  if the variable is modified.
+                  --  Within a generic unit an In_Parameter is a constant.
+                  --  It can be instantiated with a variable, in which case
+                  --  there will be a warning on the instance.
 
                   if Ekind (U_Ent) = E_Constant
                     and then Present (O_Ent)
+                    and then Ekind (O_Ent) /= E_Generic_In_Parameter
                     and then not Overlays_Constant (U_Ent)
                     and then Address_Clause_Overlay_Warnings
                   then