comp.lang.ada
 help / color / mirror / Atom feed
* Did I find a bug here?
@ 2021-04-02  6:30 reinert
  2021-04-02  7:30 ` J-P. Rosen
  0 siblings, 1 reply; 8+ messages in thread
From: reinert @ 2021-04-02  6:30 UTC (permalink / raw)


Assume this simple program:

procedure test0 is
  type ABC_Type is (A,B,C);
  subtype AB_Type is ABC_Type with Static_Predicate => AB_Type in A | B;
  X : ABC_type    := A;
begin
-- alternative 1:  
case AB_Type(X) is
    when A => null;
    when B => null;
    when others => null; -- ??? should the compiler complain here?
  end case;
--alternative 2:
  case AB_Type(X) is
    when A => null;
    when B => null;
  end case;
end test0;

Should the compiler complain about "when others => null" here?
My compiler does not (running debian 10, updated, gnat-8).
I find it strange that both alternatives goes through.

reinert

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Did I find a bug here?
@ 2021-04-02  6:15 reinert
  0 siblings, 0 replies; 8+ messages in thread
From: reinert @ 2021-04-02  6:15 UTC (permalink / raw)


Assume this simple program:

procedure test0 is
  type A_Type is (A,B,C);
  subtype A_sub_Type is A_Type with Static_Predicate => A_sub_Type in A | B;
  X : A_type      := A;
  Y : A_sub_Type  := A;
begin
  case A_sub_Type(X) is
    when A => null;
    when B => null;
    when others => null;  -- ???? Should the compiler complain here?
  end case;
end test0;

Should the compiler complain about "when others => null" ? My compiler does not (running debian 10 updated, gnat-8).

reinert


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

end of thread, other threads:[~2021-04-03 12:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02  6:30 Did I find a bug here? reinert
2021-04-02  7:30 ` J-P. Rosen
2021-04-02  8:33   ` Niklas Holsti
2021-04-03  5:46     ` reinert
2021-04-03  6:41       ` J-P. Rosen
2021-04-03  8:18         ` Niklas Holsti
2021-04-03 12:37           ` J-P. Rosen
  -- strict thread matches above, loose matches on Subject: below --
2021-04-02  6:15 reinert

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