comp.lang.ada
 help / color / mirror / Atom feed
From: pascal.malaise@gmail.com
Subject: Contraint error when "out" parameter has incorrect initial content
Date: Sun, 25 Aug 2013 07:07:39 -0700 (PDT)
Date: 2013-08-25T07:07:39-07:00	[thread overview]
Message-ID: <54258ffb-a99c-48d8-8d2b-02694efb6d36@googlegroups.com> (raw)

Hi,
I am wondering if GNAT is correct when raising Constraint_Error in the following case:
procedure Out_Discr is

  type T (B : Boolean := False) is record
    case B is
      when True => null;
      when False => null;
    end case;
  end record;
  subtype Tt is T(True);

  procedure P (V : out Tt) is
  begin
    V := (B => True);
  end P;

  M : T;

begin
  M := (B => False);
  P (M); -- <-- Here
end Out_Discr;

>> raised CONSTRAINT_ERROR : out_discr.adb:20 discriminant check failed
Indeed M is not Tt when calling P, but M is "out" parameter. Shouldn't it be overwritten without any constraint check?

Thank you.

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

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