From mboxrd@z Thu Jan 1 00:00:00 1970 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: error: choice must be static? Date: Tue, 13 Feb 2024 11:45:17 +0000 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain Injection-Info: dont-email.me; posting-host="c5f3580d54f0b664f0245f64a1dbe9db"; logging-data="2185145"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pfCbkzEMuZVUJKze1qovgzbs4oGyQgSw=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin) Cancel-Lock: sha1:owaY79OxwSZmI9kaopOmeYlmCYo= sha1:1R0+jYh1+X12khIE9zscwwaFcKg= Xref: news.eternal-september.org comp.lang.ada:66055 List-Id: "Randy Brukardt" writes: > Looks like a compiler bug to me. The nonsense message gives that away... :-) GCC 14.0.1 says 1. procedure test_20240211_static_choice is 2. 3. package Maps is 4. type Map_Type is private 5. with Aggregate => (Empty => Empty_Map, | >>> error: aspect "Aggregate" can only be applied to non-array type 6. Add_Named => Add_To_Map); 7. procedure Add_To_Map (M : in out Map_Type; Key : in Integer; 8. Value : in String); 9. Empty_Map : constant Map_Type; 10. private 11. type Map_Type is array (1..10) of String (1..10); 12. procedure Add_To_Map (M : in out Map_Type; Key : in Integer; 13. Value : in String) is null; 14. Empty_Map : constant Map_Type := [1..10 => " "]; | >>> error: choice must be static 15. end; 16. 17. begin 18. null; 19. end; I think the first is because of ARM 4.3.5(2), "For a type other than an array type, the following type-related operational aspect may be specified"[1] and the second is a "nonsense" consequence. [1] http://www.ada-auth.org/standards/22rm/html/RM-4-3-5.html#p2