]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix box accepted as second association of a generic formal package
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 20 Oct 2025 20:33:34 +0000 (22:33 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 3 Nov 2025 14:15:17 +0000 (15:15 +0100)
The syntax is plain invalid because a box can be accepted as a positional
parameter only in the first place.

gcc/ada/ChangeLog:

PR ada/61127
* sem_ch12.adb (Associations.Match_Positional): Remove the always
false condition that guards the error on a positional box.

gcc/ada/sem_ch12.adb

index 7b3828225bcc956e4658b8d3f90c24abb2c6babc..702939a821b45a1259127ac705aaa1e364227d4c 100644 (file)
@@ -1662,18 +1662,14 @@ package body Sem_Ch12 is
 
             if Box_Present (Src_Assoc) then
                Assoc.Actual := (Kind => Box_Actual);
-               if False then -- ???
-                  --  Disable this for now, because we have various
-                  --  code that needs to be updated.
-                  Error_Msg_N
-                    ("box requires named notation", Src_Assoc);
-               end if;
+               Error_Msg_N ("box requires named notation", Src_Assoc);
             else
                Assoc.Actual :=
                  (Name_Exp,
                   Explicit_Generic_Actual_Parameter (Src_Assoc));
                pragma Assert (Present (Assoc.Actual.Name_Exp));
             end if;
+
             Assoc.Actual_Origin := From_Explicit_Actual;
 
             Next (Src_Assoc);