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,3c256edee673e6 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Problem with controlled types Date: 1998/12/14 Message-ID: #1/1 X-Deja-AN: 422203160 Sender: matt@mheaney.ni.net References: <753cnv$3sq$1@nnrp1.dejanews.com> NNTP-Posting-Date: Mon, 14 Dec 1998 10:29:04 PDT Newsgroups: comp.lang.ada Date: 1998-12-14T00:00:00+00:00 List-Id: bourguet@my-dejanews.com writes: > with ada.finalization; > > package Pkg is > > type A is private; > -- operations on B > > type B is private; > > function Get_B (I: A) return B; > -- other operations on B > > private > > type A is new Ada.Finalization.Controlled with record > ... > end record; > > type B is new Ada.Finalization.Controlled with record > ... > end record; > > end pkg; > > ObjectAda complain that the Get_B function is primitive on two tagged > types, and that is not allowed. > > Gnat compile and run correctly (as A'Class contains only A and > B'Class only B, this is not strange). > > Now, which one is correct? GNAT is correct; ObjectAda is incorrect. An operation cannot be primitive for more that one type is only true for (publicly) tagged types. Since A and B and not publically tagged, Get_B is a legal operation.