From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed1-a.proxad.net!nnrp1-2.free.fr!not-for-mail Newsgroups: comp.lang.ada References: <5ff9779d$0$24281$426a74cc@news.free.fr> <5ffb311f$0$16185$426a74cc@news.free.fr> <5ffb7135$0$24247$426a74cc@news.free.fr> <5ffc8efd$0$8957$426a74cc@news.free.fr> <60004212$0$13563$426a34cc@news.free.fr> <1064b0e8-2486-42be-a52d-1b3bc0bfd65en@googlegroups.com> <60014950$0$24269$426a74cc@news.free.fr> <9f669e87-b60d-4a9c-8aa9-51aa4042533an@googlegroups.com> From: DrPi <314@drpi.fr> Subject: Re: Record initialisation question Date: Sat, 16 Jan 2021 11:28:36 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <9f669e87-b60d-4a9c-8aa9-51aa4042533an@googlegroups.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Message-ID: <6002bfd5$0$6202$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 16 Jan 2021 11:28:37 CET NNTP-Posting-Host: 82.65.30.55 X-Trace: 1610792917 news-1.free.fr 6202 82.65.30.55:59888 X-Complaints-To: abuse@proxad.net Xref: reader02.eternal-september.org comp.lang.ada:61152 List-Id: Le 15/01/2021 à 19:15, Shark8 a écrit : > On Friday, January 15, 2021 at 12:50:41 AM UTC-7, DrPi wrote: >> Unchecked_Conversion is not compatible with no elaboration code. > I find that surprising. > Ada.Unchecked_Conversion is defined by the LRM as a compiler-intrinsic, with the Pure pragma*: > > generic > type Source(<>) is limited private; > type Target(<>) is limited private; > function Ada.Unchecked_Conversion(S : Source) return Target > with Convention => Intrinsic; > pragma Pure(Ada.Unchecked_Conversion); > > The GNAT source has, as its last three lines: > pragma No_Elaboration_Code_All (Ada.Unchecked_Conversion); > pragma Pure (Ada.Unchecked_Conversion); > pragma Import (Intrinsic, Ada.Unchecked_Conversion); > > So, if you are generating elaboration-code, then GNAT is broken. > > * IIUC, this (Intrinsic+Pure) should make it essentially equivalent to C's bitwise reinterpretation-cast, and [IIRC] should qualify for 'static function call'. > I made new tests. You are right, Unchecked_Conversion() is not the culprit. When I tried it, I got 'violation of restriction "No_Elaboration_Code"' due to other statements but didn't realized it.