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: a07f3367d7,fea6327f1cf0116,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!y8g2000prd.googlegroups.com!not-for-mail From: ytomino Newsgroups: comp.lang.ada Subject: question about visibility rule for renamed generic package Date: Sat, 6 Aug 2011 00:01:36 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 123.224.129.105 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1312614096 30163 127.0.0.1 (6 Aug 2011 07:01:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 6 Aug 2011 07:01:36 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y8g2000prd.googlegroups.com; posting-host=123.224.129.105; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HNKRUAELSC X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20483 Date: 2011-08-06T00:01:36-07:00 List-Id: Hello. A generic child package looking private part of its parent, is renamed. Can this renamed package look private part of the original parent, or not ? I tried and got error with gcc (4.6.1), but I think it should be compiled... -- p.ads package p is type t is private; private type t is record f : integer; end record; end p; -- p.child.ads generic package p.child is type u is new t; function get_f (x : u) return Integer; end p.child; -- p.child.adb package body p.child is function get_f (x : u) return Integer is begin return x.f; -- look the private part end get_f; end p.child; -- renamed.adb with p.child; generic package renamed renames p.child; -- main.adb with p.child; with renamed; procedure main is package instance1 is new p.child; -- 1. correct case -- it's ok. package instance2 is new renamed; -- 2. error case -- main.adb:9:09: instantiation error at p-child.adb:4 -- main.adb:9:09: invalid prefix in selected component "x" begin null; end main; Thank you.