From: Jeffrey Creem <jeff@thecreems.com>
Subject: Re: Cannot initialize entities of limited type?
Date: Fri, 12 Jan 2007 09:26:21 -0500
Date: 2007-01-12T09:26:21-05:00 [thread overview]
Message-ID: <tcik74-os3.ln1@newserver.thecreems.com> (raw)
In-Reply-To: <eo83q9$fpi$1@cernne03.cern.ch>
Maciej Sobczak wrote:
> Hi,
>
> procedure Hello is
>
> package P is
> type T is limited private;
> function Constructor return T;
> private
> type T is new Integer;
> end P;
>
> package body P is
> function Constructor return T is
> begin
> return 7;
> end Constructor;
> end P;
>
> X : P.T := P.Constructor; -- line 17
>
> begin
> null;
> end Hello;
>
> $ gnatmake hello
> gcc -c hello.adb
> hello.adb:17:16: cannot initialize entities of limited type
> gnatmake: "hello.adb" compilation error
> $
>
> I got lost. What's wrong in the code above?
>
Hmm.. I don't think anything is wrong with it. Obviously it is a little
odd to nest a package in the mainline procedure like that but I assume
this was just for demo purposes.
What version of gnat and/or gcc are you using? This appears to work for
me with a newer version of gcc (development version based on GCC SVN
trunk) and fails with an older version.
next prev parent reply other threads:[~2007-01-12 14:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-12 13:52 Cannot initialize entities of limited type? Maciej Sobczak
2007-01-12 14:04 ` Martin Krischik
2007-01-12 14:28 ` Maciej Sobczak
2007-01-12 15:06 ` Jean-Pierre Rosen
2007-01-12 20:56 ` Simon Wright
2007-01-13 17:39 ` Georg Bauhaus
2007-01-12 19:08 ` Jeffrey Creem
2007-01-12 14:23 ` Jean-Pierre Rosen
2007-01-12 14:26 ` Jeffrey Creem [this message]
2007-01-15 23:53 ` Jeffrey Carter
2007-01-16 8:35 ` Maciej Sobczak
2007-01-16 13:56 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox