#247569 Wrong output from legal program, ordered generic parameter association

Package:
gnat-12
Source:
gcc-12
Description:
GNU Ada compiler
Submitter:
Date:
2022-04-04 05:33:16 UTC
Severity:
normal
Tags:
#247569#5
Date:
2004-05-05 20:16:25 UTC
From:
To:
with text_io;
procedure Test_75 is
   generic
   package pak1 is
      type T1 is null record;
   end pak1;

   generic
      with package A is new pak1(<>);
      with package B is new pak1(<>);
   package pak2 is
      procedure p1(x: B.T1);
      procedure p1(x: A.T1);
   end pak2;

   package body pak2 is

      procedure p1(x: B.T1) is
      begin
         text_io.put_line("failed: wrong p1 called");
      end p1;

      procedure p1(x: A.T1) is
      begin
         text_io.put_line("passed");
      end p1;

      x: A.T1;
   begin
      p1(x);
   end pak2;

   package new_pak1 is new pak1;
   package new_pak2 is new pak2(new_pak1, new_pak1); -- (1)

begin
   null;
end Test_75;

The program outputs:
failed: wrong p1 called


It looks like line (1) switched the actual and formal generic
parameters.

#247569#22
Date:
2008-12-30 20:32:43 UTC
From:
To:
found 247020 4.3.2-2
found 247569 4.3.2-2
found 247571 4.3.2-2
thanks

#247569#33
Date:
2009-08-04 19:42:28 UTC
From:
To:
found 247569 4.4.1-1
thanks