From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: Rosetta Code task Proper divisors fails to compile Date: Wed, 26 Jul 2023 10:36:12 +0200 Organization: A noiseless patient Spider Message-ID: References: <71e087e7-bfb2-4659-b218-134fb265d479n@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 26 Jul 2023 08:36:12 -0000 (UTC) Injection-Info: dont-email.me; posting-host="9303d613505a01ab2b53e729460eace7"; logging-data="1529597"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Tvzmxxotgf3+rG8VmcZbsECbLKVPx1TE=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cancel-Lock: sha1:pKbgYq34O1q0akYN2sOKTlfo+F8= In-Reply-To: <71e087e7-bfb2-4659-b218-134fb265d479n@googlegroups.com> Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:65451 List-Id: On 2023-07-26 06:49, Kenneth Wolcott wrote: > > https://rosettacode.org/wiki/Proper_divisors#Ada > > gnatmake -vh ./proper_divisors.adb > > generic_divisors.ads:11:08: error: (Ada 2005) cannot copy object of a limited type (RM-2005 6.5(5.5/2)) > generic_divisors.ads:11:08: error: return by reference not permitted in Ada 2005 > > Why does this work for the the submitter of the Rosetta Code task and not for me? For some reason your gnatmake seems to be defaulting to -gnat05 mode. This code has an expression function, which is Ada 12, so try adding -gnat12 to the command. You also should not need to put "./" in front of the file name, though I don't see how that would make a difference. -- Jeff Carter "I'm a lumberjack and I'm OK." Monty Python's Flying Circus 54