comp.lang.ada
 help / color / mirror / Atom feed
* error: choice must be static?
@ 2024-02-11 12:29 Blady
  2024-02-11 20:56 ` Jeffrey R.Carter
  2024-02-13  2:12 ` Randy Brukardt
  0 siblings, 2 replies; 7+ messages in thread
From: Blady @ 2024-02-11 12:29 UTC (permalink / raw)


Hello,

I've got the following GNAT error:

$ gcc -c -gnat2022 -gnatl 2024/test_20240211_static_choice.adb
GNAT 13.2.0
      1. procedure test_20240211_static_choice is
      2.
      3.    package Maps is
      4.       type Map_Type is private
      5.         with Aggregate =>  (Empty     => Empty_Map,
      6.                             Add_Named => Add_To_Map);
      7.       procedure Add_To_Map (M : in out Map_Type; Key : in 
Integer; Value : in String);
      8.       Empty_Map : constant Map_Type;
      9.    private
     10.       type Map_Type is array (1..10) of String (1..10);
     11.       procedure Add_To_Map (M : in out Map_Type; Key : in 
Integer; Value : in String) is null;
     12.       Empty_Map : constant Map_Type := [1..10 => "          "]; 
-- error: choice must be static
                                                  |
         >>> error: choice must be static

     13.    end;
     14.
     15. begin
     16.    null;
     17. end;

I wonder what more static it should be.
Any clue ?

Thanks, Pascal.

Source code:
procedure test_20240211_static_choice is

    package Maps is
       type Map_Type is private
         with Aggregate =>  (Empty     => Empty_Map,
                             Add_Named => Add_To_Map);
       procedure Add_To_Map (M : in out Map_Type; Key : in Integer; 
Value : in String);
       Empty_Map : constant Map_Type;
    private
       type Map_Type is array (1..10) of String (1..10);
       procedure Add_To_Map (M : in out Map_Type; Key : in Integer; 
Value : in String) is null;
       Empty_Map : constant Map_Type := [1..10 => "          "]; -- 
error: choice must be static
    end;

begin
    null;
end;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-17  8:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-11 12:29 error: choice must be static? Blady
2024-02-11 20:56 ` Jeffrey R.Carter
2024-02-12  8:12   ` Dmitry A. Kazakov
2024-02-13  2:12 ` Randy Brukardt
2024-02-13 11:45   ` Simon Wright
2024-02-14  4:28     ` Randy Brukardt
2024-02-17  8:51       ` Blady

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox