comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Another problem with "interface"
Date: Mon, 16 Feb 2009 14:56:11 +0100
Date: 2009-02-16T14:56:11+01:00	[thread overview]
Message-ID: <4999707b$0$32674$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <k5psg6d5qlud$.1bdvok5hkszh4.dlg@40tude.net>

Dmitry A. Kazakov schrieb:
> On Mon, 16 Feb 2009 09:53:59 +0000, Robert_Matthews wrote:
> 
>> In using interface types with GNAT I have encountered another problem.
>> Consider the following package:
>>
>> package Test is
>>
>>    type A_Type is limited interface;
>>
>>    procedure P (A : in out A_Type; D : Integer) is abstract;
>>
>>    protected type New_A_Type is new A_Type
>>    with
>>       procedure P (D : Integer);
>>       --  other subprograms...
>>    private
>>       F : Integer;
>>    end New_A_Type;
>>
>>    function Set_A return New_A_Type;
>>
>> end Test;
>>
>> GNAT gives an error for the function Set_A: 
>> "operation can be dispatching in only one type",
>> which leaves me mystified. Am I making another
>> dumb mistake? Please help!
>>
>> The version of GNAT is GNAT GPL 2008 (20080521).
> 
> This looks like a compiler bug to me. The compiler thinks that Set_A is a
> protected function of New_A_Type and thus has the hidden argument
> New_A_Type and the result New_A_Type, so it complains. But protected type
> is not tagged so Set_A cannot be dispatching.

Maybe illustrating this point,


procedure R is
   type I is Synchronized Interface;

   protected type T is new I with
     function Make_T return I'class;
   end T;

   protected body T is
      function Make_T return I'class is
      begin
         return (I with null record);
      end;
   end T;

   X: constant T := T.Make_T;
begin
   null;
end;


+===========================GNAT BUG DETECTED==============================+
| 4.3.0 20070903 (experimental) [trunk revision 128061]
(i686-apple-darwin8) |
| Assert_Failure atree.adb:3812                                            |
| Error detected at r.adb:15:22                                            |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.





  reply	other threads:[~2009-02-16 13:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16  9:53 Another problem with "interface" Robert_Matthews
2009-02-16 10:26 ` christoph.grein
2009-02-16 10:40   ` Georg Bauhaus
2009-02-16 11:27     ` Robert_Matthews
2009-02-16 11:45       ` Egil Høvik
2009-02-16 11:54     ` christoph.grein
2009-02-16 13:29 ` Dmitry A. Kazakov
2009-02-16 13:56   ` Georg Bauhaus [this message]
2009-02-17 16:28 ` Robert_Matthews
replies disabled

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