|Fortran Language Reference Manual, Volume 1 - S-3692-51|
|Prev Section||Chapter 4. Data Types||Next Section|
A type alias allows you to define another name for an intrinsic data type or user-defined data type. Thus, the type alias and the type specification it aliases are interchangeable. Type aliases do not define a new type.
This is the form for type aliases:
For more information about type_spec, see Section 5.1.
This example shows how a type alias can define another name for an intrinsic type, a user-defined type, and another type alias:
TYPEALIAS :: INTEGER_64 => INTEGER(KIND = 8), & TYPE_ALIAS => TYPE(USER_DERIVED_TYPE), & ALIAS_OF_TYPE_ALIAS => TYPE(TYPE_ALIAS) INTEGER(KIND = 8) :: I TYPE(INTEGER_64) :: X, Y TYPE(TYPE_ALIAS) :: S TYPE(ALIAS_OF_TYPE_ALIAS) :: T
You can use a type alias or the data type it aliases interchangeably. That is, explicit or implicit declarations that use a type alias have the same effect as if the data type being aliased was used. For example, the above declarations of I, X, and Y are the same. Also, S and T are the same.
If the type being aliased is a derived type, the type alias name can be used to declare a structure constructor for the type.
These restrictions apply to type aliases:
The name of a type alias must be unique. That is, it cannot have the same name as any of these:
Any intrinsic type defined by the Cray Fortran Compiler.
Any type alias in the same scoping unit.
Any derived type in the same scoping unit.
The type_spec cannot not have any deferred or assumed type parameters.