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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,ba1efd580c7c1290 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!m7g2000prd.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Dynamic allocation of unconstrained types Date: Wed, 30 Sep 2009 08:03:57 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <1qy4b03u1mtz1.1ri6symgrtrgo$.dlg@40tude.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1254323037 1844 127.0.0.1 (30 Sep 2009 15:03:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 30 Sep 2009 15:03:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m7g2000prd.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8542 Date: 2009-09-30T08:03:57-07:00 List-Id: On Sep 30, 7:56=A0am, "Dmitry A. Kazakov" wrote: > On Wed, 30 Sep 2009 07:29:26 -0700 (PDT), Maciej Sobczak wrote: > > Consider: > > > procedure Test is > > > =A0 =A0package P is > > =A0 =A0 =A0 type T (<>) is limited private; > > =A0 =A0 =A0 function Create return T; > > =A0 =A0private > > =A0 =A0 =A0 type T is limited record > > =A0 =A0 =A0 =A0 =A0I : Integer; > > =A0 =A0 =A0 end record; > > =A0 =A0end P; > > > =A0 =A0package body P is > > =A0 =A0 =A0 function Create return T is > > =A0 =A0 =A0 begin > > =A0 =A0 =A0 =A0 =A0return T'(I =3D> 123); > > =A0 =A0 =A0 end Create; > > =A0 =A0end P; > > > =A0 =A0S : access P.T; > > > begin > > =A0 =A0S :=3D new P.T'(P.Create); =A0 -- ??? (this is line 22) > > end Test; > > > GNAT says: > > > test.adb:22:19: uninitialized unconstrained allocation not allowed > > test.adb:22:19: qualified expression required > > > Interestingly, it works with Strings. > > Because String is not a limited type. > > > Why doesn't GNAT recognize it as a qualified expression? > > Qualified expression is not allowed for a limited types, logically. Yes, they are; see 7.5(2.1-2.9). -- Adam