comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Dynamic allocation of unconstrained types
Date: Wed, 30 Sep 2009 08:03:57 -0700 (PDT)
Date: 2009-09-30T08:03:57-07:00	[thread overview]
Message-ID: <a44f923c-a9cb-46d3-aa3c-5f11bb515289@m7g2000prd.googlegroups.com> (raw)
In-Reply-To: 1qy4b03u1mtz1.1ri6symgrtrgo$.dlg@40tude.net

On Sep 30, 7:56 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Wed, 30 Sep 2009 07:29:26 -0700 (PDT), Maciej Sobczak wrote:
> > Consider:
>
> > procedure Test is
>
> >    package P is
> >       type T (<>) is limited private;
> >       function Create return T;
> >    private
> >       type T is limited record
> >          I : Integer;
> >       end record;
> >    end P;
>
> >    package body P is
> >       function Create return T is
> >       begin
> >          return T'(I => 123);
> >       end Create;
> >    end P;
>
> >    S : access P.T;
>
> > begin
> >    S := new P.T'(P.Create);   -- ??? (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



      reply	other threads:[~2009-09-30 15:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 14:29 Dynamic allocation of unconstrained types Maciej Sobczak
2009-09-30 14:50 ` Robert A Duff
2009-09-30 14:54 ` Adam Beneschan
2009-09-30 18:30   ` Jeffrey R. Carter
2009-09-30 19:15     ` Adam Beneschan
2009-09-30 14:56 ` Dmitry A. Kazakov
2009-09-30 15:03   ` Adam Beneschan [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox