comp.lang.ada
 help / color / mirror / Atom feed
* Compiler error (2) ?
@ 2022-09-26  6:54 reinert
  2022-09-26  8:12 ` Simon Wright
  2022-09-26  8:34 ` J-P. Rosen
  0 siblings, 2 replies; 5+ messages in thread
From: reinert @ 2022-09-26  6:54 UTC (permalink / raw)


Hello,

This must reveal a compiler error :
-------------------------------------------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Containers.Vectors;
procedure test1a is
   type s_name_type is (s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
   for s_name_type use
      (S0 => 0, S1 => 1, S2 => 2, S3 => 3, S4 => 4,
       S5 => 5, S6 => 6, S7 => 7, S8 => 8, S9 => 9);
   package s_names_p is new Ada.Containers.Vectors
     (Index_Type => Positive, Element_Type => s_name_type);
   k : integer := 7;

-- n : constant integer := 7; -- uncomment this line and comment out the line below.
   n : constant integer := k; 

   s_names: constant s_names_p.Vector := [for i in 3..n => S0];
begin
   Ada.Text_IO.Put_Line(s_names'Image);
end test1a;
-------------------------------------------------------------------------------------------------------
(compiled using alire and  
package Compiler is
      for Switches ("ada") use ("-gnatwa", "-gnata", "-gnatX", "-gnatwv");
   end Compiler;
-------------------------------------------------------------------------------------------------------

Right?

reinert

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

end of thread, other threads:[~2022-09-26  9:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26  6:54 Compiler error (2) ? reinert
2022-09-26  8:12 ` Simon Wright
2022-09-26  8:34 ` J-P. Rosen
2022-09-26  8:47   ` reinert
2022-09-26  9:59     ` reinert

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