On 10/11/2017 10:40 AM, Vipul Parekh wrote:
> Is the following simple code standard-conforming?
>
> module m
>
> type :: t
> integer, pointer :: i
> end type
>
> contains
>
> subroutine sub( o )
> type(t), pointer, intent(in) :: o
> !o => null() !<--- A
> o%i => null() !<--- B
> end subroutine
>
> end module
>
It is not. Note 5.16 even gives an explicit example of this:
NOTE 5.16
If a dummy argument is a derived-type object with a pointer component,
then the pointer as a pointer is
a subobject of the dummy argument, but the target of the pointer is not.
Therefore, the restrictions on
subobjects of the dummy argument apply to the pointer in contexts where
it is used as a pointer, but not in
contexts where it is dereferenced to indicate its target. For example,
if X is a dummy argument of derived
type with an integer pointer component P, and X is INTENT (IN), then the
statement
X%P => NEW_TARGET
is prohibited, ...
Steve
|