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,74166d5f7afa0c82 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news.maxwell.syr.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Tue, 04 Jan 2005 17:25:35 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <$xgF7TJy$z4V@eisner.encompasserve.org> Subject: Re: Return_By_Reference or Return_By_Copy (GNAT bug?) Date: Tue, 4 Jan 2005 17:27:09 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-DrgH75aQ5FphcGkoi2ltdfhwoqWJjYfZ4oCjqkSrR+v3LqhIPqE329UQ5j2XPhSSI0p0xpIz49Xgfsu!YX44oZp6k8u+MvdNuUgOq4yzK7HgYIdUwJayv0BeKCEbJn138R50R8pdURWGn3wt/lq/7VIoU64V X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.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.22 Xref: g2news1.google.com comp.lang.ada:7447 Date: 2005-01-04T17:27:09-06:00 List-Id: "Larry Kilgallen" wrote in message news:$xgF7TJy$z4V@eisner.encompasserve.org... > >> package body B is > >> > >> The_A : A_Type; > >> > >> function Get_The_A return A_Type is > >> begin > >> return The_A; > > > > -- This return will be illegal in Ada 2005 (the return expression is not an > > aggregate or function call). > > Even though nothing in that sample says protected ? It's nothing to do with protected; the rules for all functions returning *limited* types have changed. (Both to make constructor functions possible, and to make limited interfaces be near universal.) The incompatibility is fairly rare (such functions are rarely useful in Ada 95), and the workaround is easy -- with one possible exception: functions returning limited private types. (Those seem more common.) Note, however, that such a function, while legal in Ada 95, probably would raise Program_Error if instantiated with a really limited type. So we're just making a run-time problem into a compile-time one: that is, detecting an error earlier. Randy.