From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9e1394d0159e1c9a,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 X-Received: by 10.180.98.102 with SMTP id eh6mr3423460wib.7.1362622324528; Wed, 06 Mar 2013 18:12:04 -0800 (PST) X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63 Path: g1ni50796wig.0!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!nntpfeed.proxad.net!news.muarf.org!news.ecp.fr!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: GNAT 4.8 bug with subtype predicate Date: Thu, 07 Mar 2013 03:11:55 +0100 Organization: Ada @ Home Message-ID: NNTP-Posting-Host: 2LxnHgvKpADqRhp9m0TZ+A.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.14 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2013-03-07T03:11:55+01:00 List-Id: Just out of curiosity, tell me what you get if you try this in a package= = specification: type T is range 1 .. 100 with Dynamic_Predicate =3D> T not in 10 .. 15; function F (I : T) return Positive is (Positive'Val (T'Pos (I))); Do you get an error from GNAT complaining about =E2=80=9Cinvalid use of = subtype = mark in expression or call=E2=80=9D on the line holding the predicate? That's what I get with GNAT from GCC 4.8. The error disappears if I change `F` into: function F (I : T) return Positive is (Positive (I)); But that may not be allowed, if say T is a range, and the function retur= ns = Character (the direct conversion is not allowed, and requires 'Val/'Pos)= . The error also disappears if I only have this in the public part function F (I : T) return Positive; =E2=80=A6then have this in the private part: function F (I : T) return Positive is (Positive'Val (T'Pos (I))); -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity