comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <nobody@nowhere.fi>
Subject: Re: Odd error with access to derived types
Date: Thu, 14 Oct 2004 22:17:38 +0300
Date: 2004-10-14T22:17:38+03:00	[thread overview]
Message-ID: <416ED0D2.706@nowhere.fi> (raw)
In-Reply-To: feusm0hpbe5frsvljam7jbllqvftusc10v@4ax.com

A. Imran wrote:
> Hello,
> 
> I'm getting a very odd error from my compiler (GNAT 3.15p, also tried
> the latest GCC based GNAT).
> 
> Would anyone point out why the following is / is not valid ada? TIA.

The following works for me with GNAT 3.15p, Debian:

package testp is

    type a_type is tagged record
       foo : natural;
    end record;

end testp;

package testp.b is

     type b_type is new a_type with private;

     type b_access is access all b_type;

private

     type b_type is new a_type with record
         dummy : boolean;
     end record;

end testp.b;


Did I misunderstand which variant of your code fails?

Niklas Holsti
Tidorum Ltd

niklas holsti tidorum fi
       .      @       .

> 
> -- begin testp-b.adb --
> package testp.b is
> 
>     -- TO FAIL: Comment the next line and leave 
>     -- the line after that uncommented.
> 
>     -- XXX 0    
> --  type b_type is new a_type with null record;
>     type b_type is new a_type with private;
> 
>     type b_access is access all b_type;
> 
> private
> 
>     -- TO FAIL: Keep the following uncommented
>     -- XXX 1
>     type b_type is new a_type with record
>         dummy : boolean;
>     end record;
> 
> end testp.b;
> -- end testp-b.adb --
> 
> I'm getting an error that says that the definition of the private type
> (XXX 1)  conflicts with the access type (XXX 0).  Any ideas?
> 
> 
> 
> Here is the rest of the code:
> 
> -- begin testp.adb --
> package testp is
> 
>     task type a_task;
>     
>     type a_type is abstract tagged limited record
>         dummy_task : a_task;
>     end record; 
> 
> end testp;
> -- end testp.adb --
> 
> -- begin test.adb --
> -- Just used for compiling library units
> with testp;
> with testp.b;
> 
> procedure test is
> begin
>     null;
> end test;
> -- end test.adb --
> 
> 




       reply	other threads:[~2004-10-14 19:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <feusm0hpbe5frsvljam7jbllqvftusc10v@4ax.com>
2004-10-14 19:17 ` Niklas Holsti [this message]
2004-10-15  1:28 ` Odd error with access to derived types Stephen Leake
2004-10-16  0:30   ` A. Imran
2004-10-16 12:58     ` Stephen Leake
2004-10-17  0:19       ` Brian May
2004-10-17  0:32         ` Stephen Leake
2004-10-17 12:14           ` A. Imran
replies disabled

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