comp.lang.ada
 help / color / mirror / Atom feed
* Contraint error when "out" parameter has incorrect initial content
@ 2013-08-25 14:07 pascal.malaise
  2013-08-25 14:31 ` AdaMagica
  2013-08-25 15:25 ` pascal.malaise
  0 siblings, 2 replies; 5+ messages in thread
From: pascal.malaise @ 2013-08-25 14:07 UTC (permalink / 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-25 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2013-08-25 16:47     ` AdaMagica
2013-08-25 15:25 ` pascal.malaise

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