On Thu, Aug 17, 2017 at 10:36 AM, Anton Shterenlikht <[log in to unmask]> wrote:
> I think this module is conforming:
>
> module m
> type :: t( l )
> integer, len :: l=30
> contains
> procedure :: s
> end type t
> contains
> subroutine s( a )
> class( t ) :: a
> end subroutine s
> end module m
>
> One compiler rejects it with:
>
> All length type parameters of the passed object dummy argument must be assumed. [A]
> subroutine s( a )
> ----------------^
> .. Are there different rules for dummy arguments of derived types with length type parameters, for type-bound and non type-bound procedures?
I'm unsure about this particular aspect.
If you go through N2137 document and look in section 7.5.4.5 on The
passed-object dummy argument, you will see constraint C761 coming into
effect which states:
--------------
C761 The passed-object dummy argument shall be a scalar, nonpointer,
nonallocatable dummy data object with the same declared type as the
type being defined; all of its length type parameters shall be
assumed; it shall be polymorphic (7.3.2.3) if and only if the type
being defined is extensible (7.5.7). It shall not have the VALUE
attribute.
--------------
Note the "all of its length type parameters shall be assumed". I
think at this point it gets into standard-speak on what "shall" means.
My own simple-minded read is that the compiler that rejects the code
without the asterisk to denote the assumed aspect of the length-type
parameter is correct in doing so but I may be wrong about it.
Nonetheless, that compiler presently helps me out with reinforcing my
own coding *style* of always including the asterisk for length-type
parameters, so I'm not complaining!
Vipul Parekh
|