comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Contraint error when "out" parameter has incorrect initial content
Date: Sun, 25 Aug 2013 17:49:41 +0300
Date: 2013-08-25T17:49:41+03:00	[thread overview]
Message-ID: <b7ujs6Fmin6U1@mid.individual.net> (raw)
In-Reply-To: <f0c0ffcd-3875-4f00-8ebb-be718b29dfed@googlegroups.com>

On 13-08-25 17:31 , AdaMagica wrote:
> RM 6.4.1(16) A formal parameter of mode in out or out with
> discriminants is constrained if either its nominal subtype or the
> actual parameter is constrained.
> 
> Thus the compiler may assume that variables supplied to calls already
> have the correct subtype.

In other words, as I understand it, this discriminant-check and
Constraint_Error happen when the parameter is passed into the call,
before the assignment statement in the callee.

The discriminant-check occurs because the formal parameter is
constrained to the subtype with a True discriminant. Since the actual
parameter has a False discriminant, the check fails and Constraint_Error
is raised.

Sloppily said: even if the formal parameter mode is "out", if the formal
constrains the discriminants then the discriminants are "in".

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
      .      @       .


  reply	other threads:[~2013-08-25 14:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-25 14:07 Contraint error when "out" parameter has incorrect initial content pascal.malaise
2013-08-25 14:31 ` AdaMagica
2013-08-25 14:49   ` Niklas Holsti [this message]
2013-08-25 16:47     ` AdaMagica
2013-08-25 15:25 ` pascal.malaise
replies disabled

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