comp.lang.ada
 help / color / mirror / Atom feed
From: "Rick Santa-Cruz" <rick_santa_cruz75@msn.com>
Subject: Constraint Error
Date: Thu, 30 Sep 2004 01:24:43 +0200
Date: 2004-09-30T01:24:43+02:00	[thread overview]
Message-ID: <cjfg8e$g6i$00$1@news.t-online.com> (raw)

Hi,

how can I avoid the Constraint Error, when executing the following code:

with Messages;

procedure Test_Messages is
 M1: Messages.Message;
 M2: Messages.Message;

begin
 m1:=Messages.Create("This is a test");
 m2:=Messages.Create("This is a second test");
end Test_Messages;
----------------------------
 package Messages is
 type Message is tagged private;
 subtype String_Txt is String(1..20);

 function Create(Str: String) return Message;

 private
  type Message is tagged
   record
    Text: String_Txt;
   end record;
end Messages;
------------------------------
package body Messages is
 function Create(Str: String) return Message is
  M: Message;
 begin
  M.Text := Str;
  return M;
 end Create;
end Messages;

The Constraint Error occurs in the Create-Function.

Thanks in advance,
Rick 





             reply	other threads:[~2004-09-29 23:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-29 23:24 Rick Santa-Cruz [this message]
2004-09-30  0:42 ` Constraint Error Jeffrey Carter
2004-09-30  0:42 ` Stephen Leake
2004-09-30  1:11 ` tmoran
2004-09-30 13:47 ` John A. S. Rowlands
  -- strict thread matches above, loose matches on Subject: below --
1999-04-07  0:00 Constraint error Nirmala Bhupathi
1999-04-07  0:00 ` Matthew Heaney
1999-04-07  0:00   ` Nirmala Bhupathi
1999-04-08  0:00     ` Matthew Heaney
1987-04-10 21:47 Constraint_Error keith
replies disabled

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