comp.lang.ada
 help / color / mirror / Atom feed
* Operator Overloading Resolution
@ 1988-08-04 17:59 rds
  1988-08-08 14:20 ` wayne
  1988-08-09 13:58 ` Matti J{rvinen
  0 siblings, 2 replies; 4+ messages in thread
From: rds @ 1988-08-04 17:59 UTC (permalink / raw)


The following code segment was compiled using Telesoft 3.15.
According to LRM 6.6(3) "A call to an overloaded subprogram is
ambiguous (and therefore illegal) if...<the parameters>...are
not sufficient to determine exactly one (overloaded) subprogram
specification."

LRM 4.6(15) also states that a conversion can be applied
"if and only if the innermost complete context (see 8.7)
determines a unique (numeric) target type for the implicit
conversion." 


 WORD	: constant := 16;
 
 type INT_SCALAR is range -(2**15) .. (2**15)-1;
 for INT_SCALAR'size use WORD;
  
 left	: INTEGER range -127..128;
 result	: BOOLEAN;
 
 function "-"( right  : in INT_SCALAR) return INT_SCALAR is
     begin
 	return INT_SCALAR(-INTEGER( right ));
     end;
 
 begin
    result := left < -15;
                   -
>>>    Incompatible operand types or operator not visible <4.5 8.3 8.7>

--------------------------------------------------------------------
The expression -15 is evaluated to be of type INT_SCALAR.

Shouldn't this be an ERROR?

DECAda compiles this code without warning, implying the expression -15
is an INTEGER type.

My impression is NEITHER compiler follows the LRM.
Any comments on what is correct, or what other compilers do?

Richard DeSimine        (201) 386-2059
AT&T Bell Laboratories, Whippany, New Jersey 07054

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1988-08-10 13:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1988-08-04 17:59 Operator Overloading Resolution rds
1988-08-08 14:20 ` wayne
1988-08-09 13:58 ` Matti J{rvinen
1988-08-10 13:05   ` rds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox