comp.lang.ada
 help / color / mirror / Atom feed
From: Dale Stanbrough <dale@goanna.cs.rmit.EDU.AU>
Subject: argument of conversion cannot be an allocator
Date: 1997/05/14
Date: 1997-05-14T00:00:00+00:00	[thread overview]
Message-ID: <5lbccj$7vk$1@goanna.cs.rmit.edu.au> (raw)


I came across the following problem...


	type a is tagged private;
	type a_ptr is access all a'class;
	
	type b is new a with private;
	type b_ptr is acces all b'class;
	
	...
	
	
	return a'(new b);

which results in the error message (from GNAT)

	"argument of conversion cannot be an allocator"

The work around is...

	declare
	   temp : b_Ptr := new b;
	begin
	   return a_ptr(temp);
	end;


I presume there is a good reason for this; can anyone provide enlightenment
on this point (or even a simpler way to accomplish the above)?

Dale




             reply	other threads:[~1997-05-14  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-14  0:00 Dale Stanbrough [this message]
1997-05-14  0:00 ` argument of conversion cannot be an allocator Peter Hermann
1997-05-16  0:00 ` Dale Stanbrough
1997-05-16  0:00   ` Robert Dewar
1997-05-17  0:00 ` John G. Volan
replies disabled

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