comp.lang.ada
 help / color / mirror / Atom feed
* Mystery with "others"
@ 2012-08-29 15:38 gautier_niouzes
  2012-08-29 16:44 ` Adam Beneschan
  0 siblings, 1 reply; 2+ messages in thread
From: gautier_niouzes @ 2012-08-29 15:38 UTC (permalink / 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 




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

end of thread, other threads:[~2012-08-29 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-29 15:38 Mystery with "others" gautier_niouzes
2012-08-29 16:44 ` Adam Beneschan

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