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!news4.google.com!news2.volia.net!solnet.ch!solnet.ch!news-zh.switch.ch!switch.ch!news.ip-plus.net!newsfeed.ip-plus.net!news.post.ch!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Cannot initialize entities of limited type? Date: Fri, 12 Jan 2007 15:04:28 +0100 Organization: Swisscom IP+ (post doesn't reflect views of Swisscom) Message-ID: <45a7956e$1@news.post.ch> References: NNTP-Posting-Host: 194.41.146.1 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Trace: atlas.ip-plus.net 1168610917 2615 194.41.146.1 (12 Jan 2007 14:08:37 GMT) X-Complaints-To: abuse@ip-plus.net NNTP-Posting-Date: Fri, 12 Jan 2007 14:08:37 +0000 (UTC) User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) In-Reply-To: X-Original-NNTP-Posting-Host: w01iwt.pnet.ch X-Original-Trace: 12 Jan 2007 15:04:30 +0200, w01iwt.pnet.ch Xref: g2news2.google.com comp.lang.ada:8114 Date: 2007-01-12T15:04:28+01:00 List-Id: Maciej Sobczak schrieb: > 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? You are using a new Ada 2005 feature which your compiler may not yet support. Update your compiler or use: procedure Constructor (X: in out T); Martin