From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:6214:3006:b0:496:ad87:6784 with SMTP id ke6-20020a056214300600b00496ad876784mr16303592qvb.7.1664182034475; Mon, 26 Sep 2022 01:47:14 -0700 (PDT) X-Received: by 2002:ac8:5cc1:0:b0:35c:eba0:bc37 with SMTP id s1-20020ac85cc1000000b0035ceba0bc37mr16676551qta.638.1664182034227; Mon, 26 Sep 2022 01:47:14 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 26 Sep 2022 01:47:13 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR NNTP-Posting-Host: 84.209.88.37 References: <7085edb5-688c-410c-b401-23ff3ca2a38fn@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4f8e27ad-03d7-400f-9901-92856e71f9d2n@googlegroups.com> Subject: Re: Compiler error (2) ? From: reinert Injection-Date: Mon, 26 Sep 2022 08:47:14 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 4382 Xref: reader01.eternal-september.org comp.lang.ada:64416 List-Id: This is what I (also) get: test1a.adb:16:42: error: expected type "Standard.Integer" test1a.adb:16:42: error: found type "Ada.Containers.Count_Type" compilation of test1a.adb failed gprbuild: *** compilation phase failed error: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/home/reinert/test1a/= test1a.gpr"] exited with code 4 error: Compilation failed. ---------------------------------------------------------------------------= ------------------------ **However, the following version goes through the compiler and runs=20 (using "subtype n_t is Positive range 3..Positive'Last;" for) in the package specification) - confirming what Simon says: 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 =3D> 0, S1 =3D> 1, S2 =3D> 2, S3 =3D> 3, S4 =3D> 4, S5 =3D> 5, S6 =3D> 6, S7 =3D> 7, S8 =3D> 8, S9 =3D> 9); subtype n_t is Positive range 3..Positive'Last; package s_names_p is new Ada.Containers.Vectors (Index_Type =3D> n_t, Element_Type =3D> s_name_type); k : integer :=3D 7; n : constant integer :=3D 7;=20 -- n : constant integer :=3D k; -- uncomment this line and comment out th= e line above. s_names: constant s_names_p.Vector :=3D [for i in 3..n =3D> S0]; begin Ada.Text_IO.Put_Line(s_names'Image); end test1a; reinert mandag 26. september 2022 kl. 10:34:18 UTC+2 skrev J-P. Rosen: > Please give the exact error message, and why you think it could be a=20 > compiler error. Otherwise, it's hard to help... > Le 26/09/2022 =C3=A0 08:54, reinert a =C3=A9crit :=20 > > Hello,=20 > >=20 > > This must reveal a compiler error :=20 > > -----------------------------------------------------------------------= --------------------------------=20 > > with Ada.Text_IO;=20 > > with Ada.Containers.Vectors;=20 > > procedure test1a is=20 > > type s_name_type is (s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);=20 > > for s_name_type use=20 > > (S0 =3D> 0, S1 =3D> 1, S2 =3D> 2, S3 =3D> 3, S4 =3D> 4,=20 > > S5 =3D> 5, S6 =3D> 6, S7 =3D> 7, S8 =3D> 8, S9 =3D> 9);=20 > > package s_names_p is new Ada.Containers.Vectors=20 > > (Index_Type =3D> Positive, Element_Type =3D> s_name_type);=20 > > k : integer :=3D 7;=20 > >=20 > > -- n : constant integer :=3D 7; -- uncomment this line and comment out = the line below.=20 > > n : constant integer :=3D k;=20 > >=20 > > s_names: constant s_names_p.Vector :=3D [for i in 3..n =3D> S0];=20 > > begin=20 > > Ada.Text_IO.Put_Line(s_names'Image);=20 > > end test1a;=20 > > -----------------------------------------------------------------------= --------------------------------=20 > > (compiled using alire and=20 > > package Compiler is=20 > > for Switches ("ada") use ("-gnatwa", "-gnata", "-gnatX", "-gnatwv");=20 > > end Compiler;=20 > > -----------------------------------------------------------------------= --------------------------------=20 > >=20 > > Right?=20 > >=20 > > reinert > --=20 > J-P. Rosen=20 > Adalog=20 > 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX=20 > Tel: +33 1 45 29 21 52=20 > https://www.adalog.fr