comp.lang.ada
 help / color / mirror / Atom feed
* GNAT GPL 2011 bug ?
@ 2012-02-07 12:05 David
  2012-02-07 15:50 ` Adam Beneschan
  0 siblings, 1 reply; 3+ messages in thread
From: David @ 2012-02-07 12:05 UTC (permalink / raw)


Hi all,

The compiler accept the line mark by a arrow of the adb bellow and
refuse the line mark by "****". I think it must not accept the first
line to. What do you think ?

Thanks

-------  ads  --------

  type I is interface;

   procedure set (Self  :    out I;
                       Value : in     Natural) is abstract;


   type A is abstract tagged null record;

   procedure set (Self  :    out A;
                       Value : in     Natural) is abstract;


   type Implement_I is new I with null record;

   overriding procedure set (Self  :    out Implement_I;
                                      Value : in     Natural) is
null;

   Null_Implement_I : constant Implement_I := Implement_I'(null
record);

   type Implement_A is new A with null record;

   overriding procedure set (Self  :    out Implement_A;
                                     Value : in     Natural) is null;

   Null_Implement_A : constant Implement_A := Implement_A'(null
record);

   procedure Test;



---   adb   ---

procedure Test
is
   L_I   : constant test.I'Class    := Null_Implement_I;
   L_A : constant test.A'Class   := Null_Implement_A;
begin
   L_I.set (Value => 2); <--------
   L_A.set (Value => 2); *******
end;



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

* Re: GNAT GPL 2011 bug ?
  2012-02-07 12:05 GNAT GPL 2011 bug ? David
@ 2012-02-07 15:50 ` Adam Beneschan
  2012-02-07 16:01   ` Adam Beneschan
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Beneschan @ 2012-02-07 15:50 UTC (permalink / raw)


On Feb 7, 4:05 am, David <d.combesdhen...@gmail.com> wrote:
> Hi all,
>
> The compiler accept the line mark by a arrow of the adb bellow and
> refuse the line mark by "****". I think it must not accept the first
> line to. What do you think ?

I agree, it's a bug.  It shouldn't allow a constant L_I to be passed
as an OUT parameter.

                      -- Adam
>
> Thanks
>
> -------  ads  --------
>
>   type I is interface;
>
>    procedure set (Self  :    out I;
>                        Value : in     Natural) is abstract;
>
>    type A is abstract tagged null record;
>
>    procedure set (Self  :    out A;
>                        Value : in     Natural) is abstract;
>
>    type Implement_I is new I with null record;
>
>    overriding procedure set (Self  :    out Implement_I;
>                                       Value : in     Natural) is
> null;
>
>    Null_Implement_I : constant Implement_I := Implement_I'(null
> record);
>
>    type Implement_A is new A with null record;
>
>    overriding procedure set (Self  :    out Implement_A;
>                                      Value : in     Natural) is null;
>
>    Null_Implement_A : constant Implement_A := Implement_A'(null
> record);
>
>    procedure Test;
>
> ---   adb   ---
>
> procedure Test
> is
>    L_I   : constant test.I'Class    := Null_Implement_I;
>    L_A : constant test.A'Class   := Null_Implement_A;
> begin
>    L_I.set (Value => 2); <--------
>    L_A.set (Value => 2); *******
> end;




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

* Re: GNAT GPL 2011 bug ?
  2012-02-07 15:50 ` Adam Beneschan
@ 2012-02-07 16:01   ` Adam Beneschan
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Beneschan @ 2012-02-07 16:01 UTC (permalink / raw)


On Feb 7, 7:50 am, Adam Beneschan <a...@irvine.com> wrote:
> On Feb 7, 4:05 am, David <d.combesdhen...@gmail.com> wrote:
>
> > Hi all,
>
> > The compiler accept the line mark by a arrow of the adb bellow and
> > refuse the line mark by "****". I think it must not accept the first
> > line to. What do you think ?
>
> I agree, it's a bug.  It shouldn't allow a constant L_I to be passed
> as an OUT parameter.

Before somebody else nitpicks, I don't think it's possible for the
Test procedure to declare an object of type Test.L_I'Class since L_I
isn't declared inside Test.  I stuck the code in a package and changed
Test.L_I to use the package name before trying it.

                    -- Adam



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

end of thread, other threads:[~2012-02-07 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-07 12:05 GNAT GPL 2011 bug ? David
2012-02-07 15:50 ` Adam Beneschan
2012-02-07 16:01   ` Adam Beneschan

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