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: 103376,31b3d1f7b3516357 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 12 Jan 2007 08:38:31 -0600 Date: Fri, 12 Jan 2007 09:26:21 -0500 From: Jeffrey Creem User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Cannot initialize entities of limited type? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.74.171 X-Trace: sv3-Cax1RqJe0fqC7jObbLJ0Muk69jhUvqxC//WRzCSOTmGs6lEq32jXWq5gznLRcJOyVuJOn3VIW+vmcVs!AtodGAdLmJIXgYTtKeMthEHg1Ui8ULGB3E4bHj0Gw1vcamhP6MwRqIOODpmoUvrVZjRrkdptKWVU!uoM= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:8116 Date: 2007-01-12T09:26:21-05:00 List-Id: 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.