comp.lang.ada
 help / color / mirror / Atom feed
From: sbelmont700@gmail.com
Subject: Re: A Gnother Gnasty bug
Date: Sat, 7 Apr 2012 05:48:48 -0700 (PDT)
Date: 2012-04-07T05:48:48-07:00	[thread overview]
Message-ID: <15240998.2014.1333802928507.JavaMail.geo-discussion-forums@vbsf4> (raw)
In-Reply-To: <87mx6nvlwo.fsf@ludovic-brenta.org>

Hi,

I'm no language lawyer, but the same section from the LRM:

> 3.3(23): [...] A class-wide subtype is defined to have unknown 
> discriminants, and is therefore an indefinite subtype. An indefinite 
> subtype does not by itself provide enough information to create an 
> object; an additional constraint or explicit initialization expression 
> is necessary (see *note 3.3.1). 

seems to imply that it is legal, given an initializer ("an ... explicit initialization expression is necessary").  Given 

> 4.8(4): An initialized allocator is an allocator with a 
> qualified_expression. [...] 

Then I would read it as being acceptable.  After all, the fundamental problem is the same (how much room to make) whether you do it on the heap or the stack, and Ada has no problem with

o : T'Class := Make_D;

(Where an abstract T is extended by D), or any other indefinite types returned from functions (i.e. arrays, discriminated records).

-sb



  reply	other threads:[~2012-04-07 12:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-07  0:44 A Gnother Gnasty bug sbelmont700
2012-04-07 11:09 ` Ludovic Brenta
2012-04-07 12:48   ` sbelmont700 [this message]
2012-04-07 13:55   ` Robert A Duff
2012-04-09 21:09     ` Adam Beneschan
2012-04-09 21:39       ` Robert A Duff
2012-04-07 11:54 ` Simon Wright
replies disabled

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