comp.lang.ada
 help / color / mirror / Atom feed
From: Andrew Hoddinott <andrew@golter.demon.co.uk>
Subject: Disagreement between GNAT and Cohen?
Date: Tue, 11 Jun 2002 09:33:49 +0900
Date: 2002-06-11T00:33:49+00:00	[thread overview]
Message-ID: <3D05456D.7050001@golter.demon.co.uk> (raw)

With the declaration

package Test is
   type Set_Type is array (1 .. 3) of Boolean; -- for example
   function Union (Set_1, Set_2 : Set_Type) return Set_Type;
end Test;

the following code

package body Test is
   function Union (Set_1, Set_2 : Set_Type) return Set_Type is
   begin
      return Set_1 or Set_2;
   end Union;
end Test;

compiles without problem, but for

package body Test is
   function Union (Set_1, Set_2 : Set_Type) return Set_Type
      renames "or";
end Test;

GNAT (3.14p) gives an error:

test.adb:2:04: not subtype conformant with declaration in package Standard
test.adb:2:04: return type does not match
test.adb:3:15: subprogram used in renaming_as_body cannot be intrinsic

This kind of renaming is explicitly used by Cohen in a generics example
in section 15.2.3.2 of "Ada as a second language". (Cohen's full example
doesn't compile either, although only the first 2 lines of the error
message are generated).

Am I missing something obvious here? Or is Cohen wrong? Or GNAT? Is
there something in the RM that supports GNAT's claim that "subprogram
used in renaming_as_body cannot be intrinsic"?




             reply	other threads:[~2002-06-11  0:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-11  0:33 Andrew Hoddinott [this message]
2002-06-11  1:00 ` Disagreement between GNAT and Cohen? Robert A Duff
2002-06-11  7:23   ` Andrew Hoddinott
2002-06-13  1:52     ` Robert A Duff
2002-06-11  1:12 ` Preben Randhol
replies disabled

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