From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f5fe096935d4de21 X-Google-Attributes: gid103376,public From: Dale Stanbrough Subject: Re: argument of conversion cannot be an allocator Date: 1997/05/16 Message-ID: <5lganc$gjp$1@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 241838534 Distribution: world References: <5lbccj$7vk$1@goanna.cs.rmit.edu.au> X-XXMessage-ID: Organization: Royal Melbourne Institute of Technology Newsgroups: comp.lang.ada Date: 1997-05-16T00:00:00+00:00 List-Id: Robert Dewar writes: "The reason is obvious, a conversion provides no context for its operand, so you have to be able to tell what the type of the operand is by looking at it, but an allocator is no good, since it only knows its type from context. The fix is far simpler than what you have: a_ptr (b_ptr'(new b)) although I am a little surprised that just plain a_ptr'(new b) does not work, why do you need a conversion here at all?" Ah, so are you saying the the type conversion (a_ptr) only "looks at" the "new", and can't deduce (or doesn't have to) the resultant type from the "new b"? I've since found out that i don't need the conversion at all. The function i was writing was defined as returning a pointer (or access type :-) to a parent type, while the body was returning pointers to derived types. I figured you should be able to do this, but didn't realise there would be automatic type conversion b/w b_ptr and a_ptr (even though this is quite safe) (or is it a view conversion?). Dale