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,WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: representation clauses ok in generics when the formal type in tagged with known ancestor, but not ok when only know to be tagged ? ... said the compiler. Date: Mon, 26 Mar 2018 17:31:52 -0500 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Mon, 26 Mar 2018 22:31:53 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="8213"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:51207 Date: 2018-03-26T17:31:52-05:00 List-Id: No idea. It doesn't look right, but I don't know if that is an Ada or a compiler problem. Perhaps there is some rule which should have a special case for generic tagged private types, and doesn't. Randy. "Mehdi Saada" <00120260a@gmail.com> wrote in message news:d24fd816-10f4-48b3-b584-fe6589d38a62@googlegroups.com... > This is a translation from fr.c.l.a. > > I wonder why in some cases where a generic formal type is a tagged type > and has a known ancestor, one can alter the representation: > > package AAA is > type Type_A is tagged > record > INT: INTEGER; > end record; > end AAA; > with AAA; use AAA; > generic > type NT is new type_A with private; > package TENTATIVE is > type B_Type is new Nt with null record with SIZE => 300; > procedure P1 (B : B_Type) is NULL; > end TENTATIVE; > with AAA, TENTATIVE; use AAA; > procedure MAIN is > package TEST is new TENTATIVE(Type_A); > begin Null; end; > > It only gives me "main.adb:3:01: warning: in instantiation at > tentative.ads:5 > main.adb:3:01: warning: 172 bits of "B_Type" unused" > > It compiles, while when the contract states that NT has only to be tagged, > it failed. > To change "type NT is new TYPE_A with private" into "type NT is tagged > private" gives "tentative.ads:5:48: representation item not allowed for > generic type" > > JPRosen couldn't help on this, and said you Randy could saw to it better > ;-)