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: border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail From: =?ISO-8859-1?Q?Markus_Sch=F6pflin?= Newsgroups: comp.lang.ada Subject: Re: Validity of renamed objects? Date: Tue, 01 Apr 2014 15:55:15 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <871txhmc91.fsf@adaheads.sparre-andersen.dk> NNTP-Posting-Host: MdpKeRr+sx3LK7JQiK5aNw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:185446 Date: 2014-04-01T15:55:15+02:00 List-Id: Am 01.04.2014 15:04, schrieb Jacob Sparre Andersen: > I've been reading section 8.5.1 in the LRM, and I can't figure out when > the compiler is supposed to check the validity of a renamed object. > > An example: > > procedure Renaming_1 is > Object : String (1 .. 9) := "dead beef"; > Index : Natural := 0; > Renamed : Character renames Object (Index); > begin > Index := (Object'First + Object'Last) / 2; > if Renamed /= ' ' then > raise Program_Error > with "Expected Renamed to match the changed value of Index."; > end if; > end Renaming_1; > > 1) Should I get a Constraint_Error when Renamed is declared? Yes, see 8.5(3). "Object (Index)" is evaluated when the renaming declaration is elaborated. Markus