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,28ba56f6631ee6c9,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: James Alan Farrell Newsgroups: comp.lang.ada Subject: Question on operator overloading Date: Thu, 07 Apr 2005 12:24:32 -0400 Message-ID: <9bna519q4shdp4vrjlap1pbeps4u8565m8@4ax.com> X-Newsreader: Forte Free Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: fw.grammatech.com X-Trace: newsfeed.slurp.net 1112891156 209.4.89.67 (7 Apr 2005 11:25:56 -0500) X-Original-NNTP-Posting-Host: 209.4.89.67 Path: g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.slurp.net!not-for-mail Xref: g2news1.google.com comp.lang.ada:10316 Date: 2005-04-07T12:24:32-04:00 List-Id: Hi all, I'm looking at ARM 6.6 (and 4.5). I don't see anything that disallows in/out or out parameters when overloading an operator. When I try to use an in/out parameter in gnat, I get an error. Is this disallowed? Could there be compilers that allow it? I'm not trying to do this. I'm working on software to analyze Ada programs (using ASIS) and need to cover all possible bases. Thanks, James Alan Farrell with Ada.Text_IO; use Ada.Text_IO; procedure Proc1 is type MyInt is new Integer range 0 .. 1000; function "+" (Left : MyInt; Right : in out MyInt) return MyInt is begin return MyInt(Integer(Left) + Integer(Right) + 3); end; A, B, Y : MyInt; begin -- proc1 A := 1; B := 2; Y := A + B; Put_Line(Integer'Image(Integer(Y))); end Proc1; end mod1; ===== $> gnatmake main gcc -c mod1.adb mod1.adb:10:35: functions can only have "in" parameters gnatmake: "mod1.adb" compilation error (main simply declares a procedure that calls Proc1)