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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,70414f56d810c10c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.22.198 with SMTP id g6mr1663324pbf.29.1316443575619; Mon, 19 Sep 2011 07:46:15 -0700 (PDT) Path: lh7ni501pbb.0!nntp.google.com!news1.google.com!postnews.google.com!s7g2000yqd.googlegroups.com!not-for-mail From: ytomino Newsgroups: comp.lang.ada Subject: Re: discriminant questions Date: Mon, 19 Sep 2011 07:46:15 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <9f37b726-d80b-4d24-bf3f-28a14255f7fd@s20g2000yql.googlegroups.com> <708a1202-d480-451b-9b55-00b31ad9c452@w28g2000yqw.googlegroups.com> NNTP-Posting-Host: 122.29.183.131 Mime-Version: 1.0 X-Trace: posting.google.com 1316443575 29676 127.0.0.1 (19 Sep 2011 14:46:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 19 Sep 2011 14:46:15 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s7g2000yqd.googlegroups.com; posting-host=122.29.183.131; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HNKUARELSC X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.163 Safari/535.1,gzip(gfe) Xref: news1.google.com comp.lang.ada:18030 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-09-19T07:46:15-07:00 List-Id: Please look below: procedure q1 is generic type e is private; package the_package_like_ada2012_vector is type ref (element : not null access e) is null record; end the_package_like_ada2012_vector; generic type e is private; type ref (element : not null access e) is private; package the_package_use_ref is end the_package_use_ref; package inst1 is new the_package_like_ada2012_vector (integer); package inst2 is new the_package_use_ref (integer, inst1.ref); -- error (line 13) -- additional from here type int_ref (element : not null access Integer) is null record; package inst3 is new the_package_use_ref (integer, int_ref); -- ok !?!? begin null; end q1; -- q1.adb:13:65: types of actual discriminants must match formal -- q1.adb:13:65: instantiation abandoned I can not understand the reason that inst1 is error and inst2 is ok. It seems bug to me. Can someone tell me which is this bug or specified in RM? If this is actual bug, I'd like to report it to gcc. Quick fix for the time being: (is this fix correct?) Index: gcc/ada/sem_ch12.adb =================================================================== --- gcc/ada/sem_ch12.adb (revision 178831) +++ gcc/ada/sem_ch12.adb (working copy) @@ -10158,10 +10158,10 @@ if Ekind (Base_Type (Formal_Subt)) = E_Anonymous_Access_Type and then (Ekind (Base_Type (Etype (Actual_Discr)))) = E_Anonymous_Access_Type - and then + and then Subtypes_Match ( Get_Instance_Of - (Designated_Type (Base_Type (Formal_Subt))) = - Designated_Type (Base_Type (Etype (Actual_Discr))) + (Designated_Type (Base_Type (Formal_Subt))), + Designated_Type (Base_Type (Etype (Actual_Discr)))) then null;