comp.lang.ada
 help / color / mirror / Atom feed
From: arny@bonnie.ATT.COM
Subject: Re: Allocator Subtypes Question
Date: Fri, 5-Sep-86 13:30:44 EDT	[thread overview]
Date: Fri Sep  5 13:30:44 1986
Message-ID: <960@clyde.UUCP> (raw)
In-Reply-To: 12236430813.14.MENDAL@SU-SIERRA.ARPA

In article <12236430813.14.MENDAL@SU-SIERRA.ARPA> Mendal@SU-SIERRA.ARPA (Geoff Mendal) writes:
>
>We've read LMC-AI 00324/02, and paragraphs 4.8:3-6 of the Language
>Reference Manual, but still have a question concerning the behavior
>of the following program:
>
>  procedure Main is
>    type A is access Integer range -10 .. 15;
>    X : A;
>  begin
>    X := new Natural'(-5);
>    ...
>  end;
>
>Does evaluation of the allocator raise Constraint_Error or not?
>Why or why not.  We would appreciate appropriate LRM references
>to back up any "interpretations".  Thanks in advance.
>


Yes, evaluation of the allocator raises Constraint_Error because
the operand of the qualified expression used in the assignment
(-5) is not within the type mark given (Natural).

The qualified expression must be evaluated before its result can
be assigned to the object designated by X.  The appropriate
reference in the LRM is section 4.7, paragraph 3 (Qualified
Expressions).

BTW, I checked it on the (validated) AT&T UNIX Ada compiler, and
it checked out, but I don't know if the ACVC tests actually
tested that or not.  Anybody care to check?

   Thanks for a fun question, (hope the answer's correct!)
     Arny

  parent reply	other threads:[~1986-09-05 17:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-09-05  6:42 Allocator Subtypes Question Geoff Mendal
1986-09-05 12:42 ` John B. Goodenough
1986-09-05 17:30 ` arny [this message]
     [not found] <14@<12236430813>
1986-09-10 20:14 ` stt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox