From mboxrd@z Thu Jan 1 00:00:00 1970 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: error: choice must be static? Date: Mon, 12 Feb 2024 20:12:01 -0600 Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Tue, 13 Feb 2024 02:11:01 -0000 (UTC) Injection-Info: dont-email.me; posting-host="b3f6773f6607d6dae636052a24857e93"; logging-data="1895935"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19SkknveDLLfsk75fI7nnGOWYd1bK4CmRQ=" Cancel-Lock: sha1:/sWfG/5uhWjFOM29+VcU/HdCyeY= X-Priority: 3 X-RFC2646: Format=Flowed; Response X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 Xref: news.eternal-september.org comp.lang.ada:66054 List-Id: Looks like a compiler bug to me. The nonsense message gives that away... :-) Randy. "Blady" wrote in message news:uqaek7$vd8o$1@dont-email.me... > 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;