From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:3c1:b0:6b8:e6e1:2950 with SMTP id r1-20020a05620a03c100b006b8e6e12950mr19965009qkm.651.1660767105614; Wed, 17 Aug 2022 13:11:45 -0700 (PDT) X-Received: by 2002:a81:7406:0:b0:322:64d1:3035 with SMTP id p6-20020a817406000000b0032264d13035mr23131557ywc.279.1660767105272; Wed, 17 Aug 2022 13:11:45 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 17 Aug 2022 13:11:45 -0700 (PDT) Injection-Info: google-groups.googlegroups.com; posting-host=102.112.134.221; posting-account=RLLoCgoAAAAlrjFze52eMRxLw8Zw6JGC NNTP-Posting-Host: 102.112.134.221 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Adjust primitive not called on defaulted nonlimited controlled parameter, bug or feature ? From: David SAUVAGE Injection-Date: Wed, 17 Aug 2022 20:11:45 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 3022 Xref: reader01.eternal-september.org comp.lang.ada:64200 List-Id: In the code extract below [2] Adjust primitive is not called on defaulted nonlimited controlled parameter Set. A reproducer is available on gitlab [1] Seems like a bug, any feedbacks ? [1] reproducer https://gitlab.com/adalabs/reproducers/-/tree/main/adjust-not-called-on-defaulted-nonlimited-controlled-parameter [2] 1 with Ada.Exceptions, 2 Ada.Text_IO; 3 4 with GNAT.OS_Lib; 5 6 procedure Reproducer.Main is 7 8 -- 9 -- snippet of reproducer.ads 10 -- ... 11 -- type Translate_Set is private; 12 -- Null_Set : constant Translate_Set; 13 -- private 14 -- type Translate_Set is new Ada.Finalization.Controlled with record 15 -- Ref_Count : Integer_Access; 16 -- Set : Boolean_Access; 17 -- end record; 18 -- Null_Set : constant Translate_Set := (Ada.Finalization.Controlled with null, null); 19 -- ... 20 -- 21 22 procedure Process (Set : Translate_Set := Null_Set) 23 is 24 Content : constant String := Parse (Filename => "Process", 25 Translations => Set); 26 begin 27 Ada.Text_IO.Put_Line (Content); 28 end Process; 29 begin 30 Process; 31 -- Ok, Initialize (Set) is not called because default value Null_Set is specified to Set (7.6 10/2). 32 -- However Adjust (Set) is not called (7.6 17.8/3). 33 -- Is it a feature or a bug ? 34 35 exception 36 when E : others => 37 Ada.Text_IO.Put_Line ("(FF) Adjust was not called on the nonlimited controlled object Set, when parameter defaulted to Null_Set"); 38 Ada.Text_IO.Put_Line ("(FF) " & Ada.Exceptions.Exception_Information (E)); 39 GNAT.OS_Lib.OS_Exit (255); 40 end Reproducer.Main;