A derived-type definition specifies the name of a user-defined type and the types of its components. It takes the following form:
TYPE [ [, access] :: ] name
component-definition
[component-definition] . . .
END TYPE [name]
The first component definition can be preceded by an optional PRIVATE or SEQUENCE statement. (Only one PRIVATE or SEQUENCE statement can appear in a given derived-type definition.)
If SEQUENCE is present, all derived types specified in component definitions must be sequence types.
A component definition takes the following form:
type [ [, attr] ::] component [(a-spec)] [ *char-len] [init-ex]
The POINTER or DIMENSION attribute can only appear once in a given component-definition.
If the array bounds are not specified here, they must be specified following the DIMENSION attribute.
If init-ex is specified, a double colon must appear in the component definition. The equals assignment symbol (=) can only be specified for nonpointer components.
The initialization expression is evaluated in the scoping unit of the type definition.
If a name is specified following the END TYPE statement, it must be the same name that follows TYPE in the derived type statement.
A derived type can be defined only once in a scoping unit. If the same derived-type name appears in a derived-type definition in another scoping unit, it is treated independently.
A component name has the scope of the derived-type definition only. Therefore, the same name can be used in another derived-type definition in the same scoping unit.
Two data entities have the same type if they are both declared to be of the same derived type (the derived-type definition can be accessed from a module or a host scoping unit).
If the entities are in different scoping units, they can also have the same derived type if they are declared with reference to different derived-type definitions, and if both derived-type definitions have all of the following: