comp.lang.ada
 help / color / mirror / Atom feed
* Bug with variant derived from interface?
@ 2009-06-03 17:09 Alex R. Mosteo
  2009-06-03 22:12 ` Adam Beneschan
  0 siblings, 1 reply; 3+ messages in thread
From: Alex R. Mosteo @ 2009-06-03 17:09 UTC (permalink / raw)


Before reporting a bug to Adacore I'd like to have your opinion. With the 
following test program I get the error below in both GPL2008/2009.

procedure Bugcase is
  
   --  type Base is abstract tagged null record;
   --  This works

   type Base is interface;
   --  This does not work.

   type Derived_Ok (X : Boolean) is new Base with null record;

   type Derived_Also_Ok (X : Boolean) is new Base with record
      Y : Integer;
   end record;

   type Derived_Bad (X : Boolean) is new Base with record
      --  Above line is the one failing.
      case X is
         when others => null;
      end case;
   end record;

begin
   null;
end Bugcase;


$ gnatmake bugcase.adb
gcc -c bugcase.adb
bugcase.adb:14:09: call to abstract function must be dispatching
gnatmake: "bugcase.adb" compilation error




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

* Re: Bug with variant derived from interface?
  2009-06-03 17:09 Bug with variant derived from interface? Alex R. Mosteo
@ 2009-06-03 22:12 ` Adam Beneschan
  2009-06-04  8:14   ` Alex R. Mosteo
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Beneschan @ 2009-06-03 22:12 UTC (permalink / raw)


On Jun 3, 10:09 am, "Alex R. Mosteo" <alejan...@mosteo.com> wrote:
> Before reporting a bug to Adacore I'd like to have your opinion. With the
> following test program I get the error below in both GPL2008/2009.
>
> procedure Bugcase is
>
>    --  type Base is abstract tagged null record;
>    --  This works
>
>    type Base is interface;
>    --  This does not work.
>
>    type Derived_Ok (X : Boolean) is new Base with null record;
>
>    type Derived_Also_Ok (X : Boolean) is new Base with record
>       Y : Integer;
>    end record;
>
>    type Derived_Bad (X : Boolean) is new Base with record
>       --  Above line is the one failing.
>       case X is
>          when others => null;
>       end case;
>    end record;
>
> begin
>    null;
> end Bugcase;
>
> $ gnatmake bugcase.adb
> gcc -c bugcase.adb
> bugcase.adb:14:09: call to abstract function must be dispatching
> gnatmake: "bugcase.adb" compilation error

I don't see any reason this program should be illegal.  The message
involving a "call to abstract function" is certainly wrong, because
there aren't any abstract function calls involved.  (Just as a wild
guess, I'm guessing that the abstract function GNAT is complaining
about is "=", and there's some special subroutine that tries to
compose the equality function for variant records that isn't handling
this case right...  did I come close???)

                               -- Adam



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

* Re: Bug with variant derived from interface?
  2009-06-03 22:12 ` Adam Beneschan
@ 2009-06-04  8:14   ` Alex R. Mosteo
  0 siblings, 0 replies; 3+ messages in thread
From: Alex R. Mosteo @ 2009-06-04  8:14 UTC (permalink / raw)


Adam Beneschan wrote:

> On Jun 3, 10:09 am, "Alex R. Mosteo" <alejan...@mosteo.com> wrote:
>> Before reporting a bug to Adacore I'd like to have your opinion. With the
>> following test program I get the error below in both GPL2008/2009.
>>
>> procedure Bugcase is
>>
>> --  type Base is abstract tagged null record;
>> --  This works
>>
>> type Base is interface;
>> --  This does not work.
>>
>> type Derived_Ok (X : Boolean) is new Base with null record;
>>
>> type Derived_Also_Ok (X : Boolean) is new Base with record
>> Y : Integer;
>> end record;
>>
>> type Derived_Bad (X : Boolean) is new Base with record
>> --  Above line is the one failing.
>> case X is
>> when others => null;
>> end case;
>> end record;
>>
>> begin
>> null;
>> end Bugcase;
>>
>> $ gnatmake bugcase.adb
>> gcc -c bugcase.adb
>> bugcase.adb:14:09: call to abstract function must be dispatching
>> gnatmake: "bugcase.adb" compilation error
> 
> I don't see any reason this program should be illegal.  The message
> involving a "call to abstract function" is certainly wrong, because
> there aren't any abstract function calls involved.  (Just as a wild
> guess, I'm guessing that the abstract function GNAT is complaining
> about is "=", and there's some special subroutine that tries to
> compose the equality function for variant records that isn't handling
> this case right...  did I come close???)

No idea... but certainly the error, which I've only seen before in 
statements and not in declarations, hints at the compiler being astray. I'll 
report it and see.




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

end of thread, other threads:[~2009-06-04  8:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-03 17:09 Bug with variant derived from interface? Alex R. Mosteo
2009-06-03 22:12 ` Adam Beneschan
2009-06-04  8:14   ` Alex R. Mosteo

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