(j3.2006) Problem with default expressions for kind type parameters?

Van Snyder Van.Snyder
Thu Sep 20 23:17:50 EDT 2012


A type parameter name in a type definition is a valid primary in a
constant expression (7.1.12p1(9)).

One need not specify kind type parameter values in the declarations of
objects of a type if there is a default in the type definition.

There appears to be a problem with this:

  type :: T(J=k+1,K=j+1)
    integer, kind :: J, K
  end type T

  type(t) :: V

Do we need a constraint something like this?

C438a (R431) There shall not be a circular dependence between a
      <scalar-int-constant-expr> in a <type-param-decl> and any
      <type-param-name> in the same <type-param-decl-list>.

A bigger hammer, perhaps larger than necessary, is

C438a (R431) A <type-param-name> shall not appear in a
      <scalar-int-constant-expr> in the same <type-param-decl-list>.

A medium-size hammer, easier to check than the first one, is

C438a (R431) A <type-param-name> that appears in a
      <scalar-int-constant-expr> in a <type-param-decl-list> shall
      be declared earlier in that <type-param-decl-list>.

I think this is the tiniest hammer that works (maybe):

C485a (R453) If there is a circular dependence between a
      <scalar-int-constant-expr> in a <type-param-decl> and any
      <type-param-name> in the same <type-param-decl-list>, a
      <type-param-value> shall be provided for at least one of
      the <type-param-name>s in the circular dependency relationship.





More information about the J3 mailing list