From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Overriding Default_Component_Value in derived array type Date: Tue, 21 Apr 2020 21:13:04 +0300 Organization: Tidorum Ltd Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net AMC/lOz5KjnVkDKCGkd10gu/CEsLpHMxwztvh4/Ax1xHeXBKpA Cancel-Lock: sha1:NWtQDGJsaHIu2yDsgrG16fWD9Wc= X-Mozilla-News-Host: news://News.Individual.Net:119 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:58454 Date: 2020-04-21T21:13:04+03:00 List-Id: I'm seeing behaviour that looks strange to me when I derive an array type from another and use a Default_Component_Value aspect that tries to override the corresponding aspect of the parent type. The parent's default value is used also for the derived type, that is, the aspect definition for the derived type has no effect, it seems. This is on macOS Mojave (10.14.6), GNAT Community 2019 (20190517-83). An example: type Number is range 1 .. 15; type Arr_2 is array (3 .. 5) of Number with Default_Component_Value => 2; type Arr_6 is new Arr_2 with Default_Component_Value => 6; A2 : Arr_2; A6 : Arr_6; Printing out the default values of A2 and A6 I get 2's for both. I expected 2's for A2 and 6's for A6, as I read the RM. Overriding Default_Value for a derived integer type works as expected, as does overriding a Default_Value for the component type with a Default_Component_Value for the array type. For the array type derivation, if the parent array type has no Default_Component_Value then the Default_Component_Value for the derived type is effective. That is, in the above example, if I remove the Default_Component_Value from Arr_2, then A2 contains garbage as expected, and A6 contains sixes. Bug or feature? -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .