From: "Markus Schöpflin" <no.spam@spam.spam>
Subject: Re: Validity of renamed objects?
Date: Tue, 01 Apr 2014 15:55:15 +0200
Date: 2014-04-01T15:55:15+02:00 [thread overview]
Message-ID: <lhegg0$ags$1@speranza.aioe.org> (raw)
In-Reply-To: 871txhmc91.fsf@adaheads.sparre-andersen.dk
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
next prev parent reply other threads:[~2014-04-01 13:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-01 13:04 Validity of renamed objects? Jacob Sparre Andersen
2014-04-01 13:44 ` J-P. Rosen
2014-04-01 13:55 ` Markus Schöpflin [this message]
2014-04-01 18:35 ` Jacob Sparre Andersen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox