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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,556e5b18154df788 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.67.8.97 with SMTP id dj1mr2088409pad.17.1365187873732; Fri, 05 Apr 2013 11:51:13 -0700 (PDT) From: Bill Findlay Newsgroups: comp.lang.ada Subject: Re: Interresting, possibly buggy behavior in GNAT generics w/ expression function. Date: Fri, 29 Mar 2013 15:26:51 +0000 Message-ID: References: <615039cc-f33b-486a-b242-2c87292271d6@googlegroups.com> Mime-Version: 1.0 X-Trace: individual.net kxnpDrSHQqeV7Y9wJMJjEQmxz49XljQFaU4SZrsNXHzXuGr5hQ Cancel-Lock: sha1:PK06QR2gvYgCW0PtvHz5g3U8vc4= User-Agent: Microsoft-Entourage/12.33.0.120411 Thread-Topic: Interresting, possibly buggy behavior in GNAT generics w/ expression function. Thread-Index: Ac4skdXZZ3kpCrzkQkiZbhxo8whWVw== Path: jv11ni947pbb.0!nntp.google.com!border1.nntp.dca.giganews.com!backlog1.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.stben.net!talisker.lacave.net!lacave.net!eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail X-Original-Bytes: 2718 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: 2013-03-29T15:26:51+00:00 List-Id: On 29/03/2013 14:54, in article 615039cc-f33b-486a-b242-2c87292271d6@googlegroups.com, "Shark8" wrote: > On Friday, March 29, 2013 8:47:36 AM UTC-6, Simon Wright wrote: >> Shark8 writes: >> >> >> >>> Function Image(Value : Positive) Return String is >> >>> ( --if Value not in positive then "" else >> >>> Units.Constant_Reference( Attribute_Units, Value ) ); >> >> >> >> Or, of course, Attribute_Units (Value) ! > > That doesn't work. > That I'm pretty sure is a bug; in any case at least the [compile-time] error > it gives is utterly useless: > generic_attribute_set.ads:36:07: "" is undefined Type resolution in conditional expressions by GNAT GPL 2012 is not all it should be. E.g. I had to make the second 0 into a qualified expression in: function XR (X : M.i04) return M.i64 is begin return (if X = 0 then M.i64'(0) else GR(X)); end XR; because GNAT could not otherwise deduce its intended type, even though GR(X) is of type M.i64. Further to bijou buglettes in Ada 2012 mode, I had to write this: for s in slice'Range loop exit when slice(s) = all_blanks_code; h := rotate_left(h, 2) + slice(s); end loop; To avoid this: for s of slice loop exit when s = all_blanks_code; | >>> warning: variable "s" is not modified in loop body >>> warning: possible infinite loop h := rotate_left(h, 2) + s; end loop; -- Bill Findlay with blueyonder.co.uk; use surname & forename;