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: a07f3367d7,556e5b18154df788 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.110.68 with SMTP id m4mr2262124qap.2.1364568443994; Fri, 29 Mar 2013 07:47:23 -0700 (PDT) X-Received: by 10.50.153.101 with SMTP id vf5mr230706igb.3.1364568443956; Fri, 29 Mar 2013 07:47:23 -0700 (PDT) Path: v17ni9qad.0!nntp.google.com!ca1no16270396qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 29 Mar 2013 07:47:23 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <61ece03f-9528-4371-b209-6046f975dc3b@googlegroups.com> Subject: Re: Interresting, possibly buggy behavior in GNAT generics w/ expression function. From: Shark8 Injection-Date: Fri, 29 Mar 2013 14:47:23 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-03-29T07:47:23-07:00 List-Id: On Friday, March 29, 2013 1:45:04 AM UTC-6, Simon Wright wrote: > In Generic_Attribute_Set, you have two Image functions: > > function Image(Value : Attribute_Values) return String > > (Attribute_Values is a generic formal scalar) and > > function Image(Value : Positive) return String > > and you instantiate the package with Attribute_Values => Integer. > > > What happens when you change the second Image's parameter to Integer is > that GNAT chooses the wrong Image to call! Yes; hence the 'interesting' and 'possibly buggy'. > > I don't know whether this is a language problem or a GNAT problem. Or, > of course, a user problem! This is precisely why I posted it here rather than instantly filing a bug-report. On the other hand it seems to violate the generic-parameters/principal that we can only apply operations (Attributes and Operations) which the formal is *known* to have.