comp.lang.ada
 help / color / mirror / Atom feed
From: gautier_niouzes@hotmail.com
Subject: Mystery with "others"
Date: Wed, 29 Aug 2012 08:38:21 -0700 (PDT)
Date: 2012-08-29T08:38:21-07:00	[thread overview]
Message-ID: <48024e68-4d18-4bbc-af47-102f32e4f43e@googlegroups.com> (raw)

Hello,

I get an error message with the initialization of variable s4 below, that I don't understand.
The workaround is easy, using the expression for variable s3.
Still, I am curious about the reason.

GNAT GPL 2012, with any of the modes Ada 95, 2005 and 2012, I get:
test_sets.adb:10:21: "others" choice not allowed here
ObjectAda 7.2.2 (Ada 95 only) is more verbose
test_sets.adb: Error: line 10 col 17 LRM:4.3.3(11), An OTHERS is not allowed in this context because there is no applicable_index_constraint, Continuing

So why is Ada unhappy with the expression after "s4 := " ?

---8<----8<----8<----8<--
procedure Test_sets is

  type Enum is (a,b,c,d);

  type Set is array(Enum) of Boolean;

  s1: Set := (a => True, others => False);
  s2: Set := (d => True, others => False);
  s3: Set := s1 or s2;
  s4: Set := s1 or (d => True, others => False); -- <- Line 10

begin
  null;
end;
---8<----8<----8<----8<--
Gautier's Ada programming 
http://gautiersblog.blogspot.com/search/label/Ada 
NB: follow the above link for a valid e-mail address 




             reply	other threads:[~2012-08-29 15:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-29 15:38 gautier_niouzes [this message]
2012-08-29 16:44 ` Mystery with "others" Adam Beneschan
replies disabled

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