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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.28.135 with SMTP id c129mr4652225itc.6.1520102380962; Sat, 03 Mar 2018 10:39:40 -0800 (PST) X-Received: by 10.157.14.214 with SMTP id 80mr475920otj.9.1520102380860; Sat, 03 Mar 2018 10:39:40 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!newsfeed.datemas.de!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!w142no777559ita.0!news-out.google.com!a25ni1952itj.0!nntp.google.com!e10no781893itf.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 3 Mar 2018 10:39:40 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.218.250; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.218.250 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <60f20df9-4b33-4f29-829e-2fccb89a650a@googlegroups.com> Subject: expression functions and raise expressions From: Jere Injection-Date: Sat, 03 Mar 2018 18:39:40 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:50808 Date: 2018-03-03T10:39:40-08:00 List-Id: I wanted to double check if I am reading the RM correctly. >From 6.8 2/4, I see that a function expression can consist entirely of an (expression) Section 4.4 2 says that an expression can be made up of a single (relation) Section 4.4 3/4 further says a relation can be a raise expression. Given that, I expect that the following declaration/definition is correct: function Reference (Container : aliased in out Container_Type; Cursor : Cursor_Type) return Reference_Type is (raise My_Exception with "Reference not supported for Ordered_Sets") with Inline; GNAT GPL 2017 accepts it, but FSF GNAT 7.2 for mingw64 on Win10 gives some errors: test.ads:328:11: (Ada 2005) cannot copy object of a limited type (RM-2005 6.5(5.5/2)) test.ads:328:11: return by reference not permitted in Ada 2005 NOTE: Reference_Type is untagged limited discriminated null record with Implicit_Dereference defined. Also note that a similar function that returns an aggregate initialization compiles fine on both versions. I am compiling with Ada2012 mode (-gnat12 option) I believe this to be a bug in GCC 7.2 for mingw64, but wanted to make sure I wasn't misreading the RM.