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: Tue, 13 Feb 2024 22:28:22 -0600 Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Wed, 14 Feb 2024 04:27:22 -0000 (UTC) Injection-Info: dont-email.me; posting-host="fd8ce468f87ca1b6498a13521cc30f06"; logging-data="2639273"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192aJqAQuvBDo9C1k6Pd1TFmFI4dymuFbQ=" Cancel-Lock: sha1:WU7wvE/w4JEVsy36uyQGLmYKn/8= X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 X-MSMail-Priority: Normal X-Priority: 3 Xref: news.eternal-september.org comp.lang.ada:66056 List-Id: Ah, yes, didn't notice that part. One cannot give the Aggregate aspect on an array type, directly or indirectly. That's because container aggregates are designed to work like array aggregates, and we didn't want visibility to determine the interpretation of an aggregate (especially where the same syntax could have a different meaning in different visibility).. Thus, there can be no point where a single type can have both array aggregates and container aggregates. Note that record aggregates and container aggregates are always syntactally different, and thus it is OK to have both in a single location (that's one of the reasons that we adopted square brackets for container aggregates). That seemed important as the majority of private types are completed by record types, and not allowing record types in this context would be difficult to work around. Randy. "Simon Wright" wrote in message news:lybk8klh9u.fsf@pushface.org... > "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