language lawyer question

Martin Reinecke martin@MPA-Garching.MPG.DE
Fri Jan 21 10:33:00 GMT 2005


On Fri, Jan 21, 2005 at 07:10:12AM +0100, Paul Thomas wrote:
> The problem lies in this function:
> 
>   function getOa(ob) result(oa)
>      type(objB),target :: ob
>      type(objA), pointer :: oa
>      oa=>ob%oa
>   end function getOa
> 
> You return a pointer to a derived type component that is declared within 
> the scope of the ultimate caller.  I think, therefore that it is legal 
> fortran because the returned pointer is pointing to allocated memory.

That's what I thought as well. I just wanted a second opinion because
the new Intel compilers show exactly the same behaviour.

> There are various PR's on passing character pointer arguments: 
> 15809/17207/18991/16939.  I think that this is the first involving derived 
> types?

I think so. This is now PR19561.

Thanks,
  Martin

-- 



More information about the Fortran mailing list