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:620a:b88:b0:6ce:ec98:e7f8 with SMTP id k8-20020a05620a0b8800b006ceec98e7f8mr13910333qkh.338.1664186364924; Mon, 26 Sep 2022 02:59:24 -0700 (PDT) X-Received: by 2002:ac8:7dc6:0:b0:35c:c9b1:9f98 with SMTP id c6-20020ac87dc6000000b0035cc9b19f98mr17442740qte.170.1664186364714; Mon, 26 Sep 2022 02:59:24 -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 02:59:24 -0700 (PDT) In-Reply-To: <4f8e27ad-03d7-400f-9901-92856e71f9d2n@googlegroups.com> 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> <4f8e27ad-03d7-400f-9901-92856e71f9d2n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <734dd652-f1e4-438c-900e-021cdadc3edcn@googlegroups.com> Subject: Re: Compiler error (2) ? From: reinert Injection-Date: Mon, 26 Sep 2022 09:59:24 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 4795 Xref: reader01.eternal-september.org comp.lang.ada:64422 List-Id: Sorry for some typos in my latest post, but the intelligent reader should u= nderstand :-) reinert mandag 26. september 2022 kl. 10:47:16 UTC+2 skrev reinert: > This is what I (also) get:=20 >=20 > test1a.adb:16:42: error: expected type "Standard.Integer"=20 > test1a.adb:16:42: error: found type "Ada.Containers.Count_Type"=20 >=20 > compilation of test1a.adb failed=20 >=20 > gprbuild: *** compilation phase failed=20 > error: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/home/reinert/test1= a/test1a.gpr"] exited with code 4=20 > error: Compilation failed.=20 > -------------------------------------------------------------------------= --------------------------=20 > **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:=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); > 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);=20 > k : integer :=3D 7; > n : constant integer :=3D 7; > -- 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];=20 > begin=20 > Ada.Text_IO.Put_Line(s_names'Image);=20 > end test1a; > reinert > mandag 26. september 2022 kl. 10:34:18 UTC+2 skrev J-P. Rosen:=20 > > Please give the exact error message, and why you think it could be a=20 > > compiler error. Otherwise, it's hard to help...=20 > > 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 ou= t 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 > > --=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