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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1ea19776e3073a96 X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: C/C++ programmer giving Ada95 a chance -- writing an emulator. Date: 2000/04/01 Message-ID: <38E621C2.87B64ED9@averstar.com>#1/1 X-Deja-AN: 605297863 Content-Transfer-Encoding: 7bit References: <38E3DBD7.27F5B246@acenet.com.au> <2YSE4.251$sy6.25957@news.pacbell.net> <38E44CC7.4206E027@acenet.com.au> Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@inmet2.burl.averstar.com X-Trace: inmet2.burl.averstar.com 954605879 27965 141.199.15.19 (1 Apr 2000 16:17:59 GMT) Organization: AverStar (formerly Intermetrics) Mime-Version: 1.0 NNTP-Posting-Date: 1 Apr 2000 16:17:59 GMT Newsgroups: comp.lang.ada Date: 2000-04-01T16:17:59+00:00 List-Id: Geoff Bull wrote: > > If I Initialise the array like so: > > Op_Table : array (Opcode) of Op_Root > := (0 => Op_Root (O0), > others => OU); > > then make the assignments: > Op_Table (1) := Op_Root (O1); > Op_Table (2) := Op_Root (O2); > Op_Table (3) := Op_Root (O3); > > I get the output: > > opcode 00 > undefined opcode > undefined opcode > undefined opcode > undefined opcode > > What is going on here? > It look like the assigments throw away the tag (like Cohen > says it should) but the initializer keeps the tag. That would be a bug. The tag is *not* determined by the initial value if the target type is "specific" (as opposed to classwide). The tag *is* determined by the initial value if the target type is classwide. > Indeed the RM says in section 3.9 (22): > "The tag of an object of a class-wide tagged type is that of its > initialization expression. " > The trouble is Op_Table components are not of a class wide type. > > Instead section 3.9 (20) applies: > "The tag of a stand-alone object, a component, or an aggregate of a > specific tagged type T identifies T" > > > I think we have here both an error in Gnat and an error in > > Cohen's book! > > Unless somebody can show me where the RM says otherwise, I agree. > I guess I'd better report this. Definitely a bug. It looks like GNAT is copying the tag from the initial value, which it shouldn't do in this case. > > Thanks for the enlightenment. > Cheers > Geoff -Tucker Taft stt@averstar.com