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.181.13.179 with SMTP id ez19mr1252280wid.5.1365341465830; Sun, 07 Apr 2013 06:31:05 -0700 (PDT) MIME-Version: 1.0 Path: p18ni42846wiv.0!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feeder3.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!news.n-ix.net!news.bawue.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Interresting, possibly buggy behavior in GNAT generics w/ expression function. Date: Mon, 1 Apr 2013 19:46:06 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <65330bfe-39e4-4f7b-85f5-e06e9458bf29@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1364863571 9414 69.95.181.76 (2 Apr 2013 00:46:11 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 2 Apr 2013 00:46:11 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2013-04-01T19:46:06-05:00 List-Id: "Adam Beneschan" wrote in message news:65330bfe-39e4-4f7b-85f5-e06e9458bf29@googlegroups.com... On Friday, March 29, 2013 6:04:28 PM UTC-7, Randy Brukardt wrote: ... >Randy, it looks to me that the original code called Image(...) only from >inside the >generic specification or body, not outside. OK, I didn't see that, because the OP I got only had a description of the spec in it, no code at all. >I'm sure Randy already knows this, but for the benefit of anyone who >doesn't: When >a call to Image occurs inside the generic spec or body, the meaning of >Image (i.e. >which one is selected) depends only on the stuff the compiler knows when >the >generic is *compiled*; the actual types used in an *instantiation* don't >matter, >for this purpose. (Yes, I know things might be a bit more complicated when >dispatching is involved, but that's not an issue here.) For compilers that >use >"macro expansion" to implement generic instantiations (including GNAT, but >not >Janus/Ada), this poses challenges for the compiler writer, because it >doesn't work >to simply replace Attribute_Values with Integer when recompiling the >generic. This >looks like a case that fell through the cracks in GNAT. Right. Calls in the body *always* should treat Attr_Value and Natural/Positive as different types; the actuals don't matter. So if changing the subtypes is changing the called routines, you have a GNAT bug, pure and simple. Randy.