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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e947872b350ada8e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-03 04:24:49 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!gatech!gt-news!acmey.gatech.edu!jm21 From: jm21@acmey.gatech.edu (Jim Marks) Newsgroups: comp.lang.ada Subject: Re: GNAT-Problem '+'-operator with Count Date: 3 Dec 1994 12:24:11 GMT Organization: Georgia Institute of Technology Message-ID: <3bpo1b$771@mordred.gatech.edu> References: <3bn74o$go5@tucs6.rz.tu-cottbus.de> NNTP-Posting-Host: acmey.gatech.edu X-Newsreader: TIN [version 1.2 PL2] Date: 1994-12-03T12:24:11+00:00 List-Id: Andreas Krohn (ak@informatik.tu-cottbus.de) wrote: : I have a problem with the '+' operator in GNAT. I have posted the part with : the error message. Could someone give me a hint, how to solve this : problem. : 147. : 148. procedure solve_matrix(source: in matrix;target: in out matrix) is : 149. x,y,i,j:Count; --akt. Pos. in Matrix : 150. nachbarn:INTEGER; --Anzahl der Nachbarn jeder Zelle : 151. a,b:Count; : 152. Where is type Count defined? If it was defined in another package, then you might not have visibility to the "+" operator for it. On the other hand, if it is a subtype of Integer, then I'm not sure what the problem is. ... : 159. a:=i+x-2; : | : invalid operand types for operator "+" : z : z 160. b:=j+y-2; : | : invalid operand types for operator "+" : z : I tried to reconstruct this using GNAT 1.83 and the Count type defined in Text_IO. I had the following code: with text_IO; procedure test_plus is subtype Count is text_io.count; package iio is new text_io.integer_io(count); x : count := 5; y : count := 6; i : count; begin i := x+y-2; <---- error here text_io.put("x = "); iio.put(x); text_io.new_line; text_io.put("y = "); iio.put(y); text_io.new_line; text_io.put("i = "); iio.put(i); text_io.put_line(" (x+y-2)"); end; In this code, I get the same error you did at the point indicated. If, however, I include renaming declarations for the functions "+" and "-" function "+"(left, right : text_io.count) return text_io.count renames text_io."+"; function "-"(left, right : text_io.count) return text_io.count renames text_io."-"; then it compiles OK. Alternatively, if I make the definition of Count to be a distinct type (not a subtype) type Count is new text_io.count; then I don't need the renaming declarations because the declaration of type Count includes these functions. Not knowing where your type (or subtype) Count comes from, I'm not sure if this is your problem or not. Still, I hope this helps. -- ************************************************************************ *Jim Marks | Georgia Tech Research Institute * *jim.marks@gtri.gatech.edu | ELSYS/CAD * ************************************************************************