comp.lang.ada
 help / color / mirror / Atom feed
* It seems bug in GNAT with overloading in assignment
@ 2002-02-25  8:59 Maxim Reznik 2147483647
  0 siblings, 0 replies; 2+ messages in thread
From: Maxim Reznik 2147483647 @ 2002-02-25  8:59 UTC (permalink / raw)


Trying to understand overloading rules I wrote a following test.
I would like to see what error compiler reported.
But it didn't report any error. I tried with 3.13p and 3.14p
for Windows.
Then I setup ObjectAda to tried with it. ObjectAda
reported "Ambiguous assignment".
Finally I removed Dummy parameter from function declaration
and gnat crashed with message "GNAT BUG DETECTED"

Here is the test:
------ test.adb
with Ada.Text_IO;

procedure Test is

   type Int_A is new Integer;
   type Int_B is new Integer;

   type Int_A_Ptr is access all Int_A;
   type Int_B_Ptr is access all Int_B;

   function X (Dummy : Integer) return Int_A_Ptr is
   begin
      Ada.Text_IO.Put_Line ("First interpretation");
      return null;
   end X;

   function X (Dummy : Integer) return Int_B_Ptr is
   begin
      Ada.Text_IO.Put_Line ("Second interpretation");
      return null;
   end X;
begin
   X (1).all := 1;  -- Ambiguous assignment
end Test;






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

* Re: It seems bug in GNAT with overloading in assignment
@ 2002-02-25  9:37 Christoph Grein
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Grein @ 2002-02-25  9:37 UTC (permalink / raw)


This is definitely a Gnat bug, ObjectAda is correct.
Report it to report@gnat.com (not sure whether email address is correct).


> Trying to understand overloading rules I wrote a following test.
> I would like to see what error compiler reported.
> But it didn't report any error. I tried with 3.13p and 3.14p
> for Windows.
> Then I setup ObjectAda to tried with it. ObjectAda
> reported "Ambiguous assignment".
> Finally I removed Dummy parameter from function declaration
> and gnat crashed with message "GNAT BUG DETECTED"
> 
> Here is the test:
> ------ test.adb
> with Ada.Text_IO;
> 
> procedure Test is
> 
>    type Int_A is new Integer;
>    type Int_B is new Integer;
> 
>    type Int_A_Ptr is access all Int_A;
>    type Int_B_Ptr is access all Int_B;
> 
>    function X (Dummy : Integer) return Int_A_Ptr is
>    begin
>       Ada.Text_IO.Put_Line ("First interpretation");
>       return null;
>    end X;
> 
>    function X (Dummy : Integer) return Int_B_Ptr is
>    begin
>       Ada.Text_IO.Put_Line ("Second interpretation");
>       return null;
>    end X;
> begin
>    X (1).all := 1;  -- Ambiguous assignment
> end Test;
Rational messages:
10:36:17 *** X (1).all := 1; is ambiguous
10:36:17 *** X could be (in OVERLOAD) X
10:36:17 *** X could be (in OVERLOAD) X



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

end of thread, other threads:[~2002-02-25  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-25  8:59 It seems bug in GNAT with overloading in assignment Maxim Reznik 2147483647
  -- strict thread matches above, loose matches on Subject: below --
2002-02-25  9:37 Christoph Grein

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