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: backlog1.nntp.ams3.giganews.com!backlog1.nntp.ams2.giganews.com!backlog1.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.CARNet.hr!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Contraint error when "out" parameter has incorrect initial content Date: Sun, 25 Aug 2013 17:49:41 +0300 Organization: Tidorum Ltd Message-ID: References: <54258ffb-a99c-48d8-8d2b-02694efb6d36@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net WUwKe6QP3AjZk10LIjJqRAaDNBHODntl7kNnwgO05gW3CeSmWk Cancel-Lock: sha1:RXfOPUDr1fM/KDdsWhg9dW5wKb8= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: Xref: number.nntp.dca.giganews.com comp.lang.ada:183128 Date: 2013-08-25T17:49:41+03:00 List-Id: 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 . @ .