I need a little help about using derived type public procedure array declaration in other derived type with DIMENSION
attribute. In my fortran project I have a lot derived types with components whose values are integers and these values are result of numerous calculation. In other module i have a other derived type with integer component which is array. My intention in example code is to declare array with public procedure from another derived type and this is my example:
MODULE DERIVED_TYPE
TYPE , PUBLIC :: DT_AA
INTEGER , PRIVATE :: I_00
CONTAINS
PROCEDURE, PUBLIC :: C_I_00 => CALC_DATA_I_00
PROCEDURE, PUBLIC :: T_I_00 => TAKE_DATA_I_00
END TYPE DT_AA
PRIVATE :: CALC_DATA_I_00
PRIVATE :: TAKE_DATA_I_01
TYPE( DT_AA ) :: A_DT_AA
CONTAINS
SUBROUTINE CALC_DATA_I_00( THIS, INDX )
CLASS( DT_AA ) :: THIS
INTEGER, INTENT( IN ) :: INDX
THIS%I_00 = 4 + INDX
END SUBROUTINE CALC_DATA_I_00
FUNCTION TAKE_DATA_I_00( THIS ) RESULT( RES )
CLASS( DT_AA ) :: THIS
INTEGER :: RES
RES = THIS%I_00
END FUNCTION TAKE_DATA_I_00
END MODULE DERIVED_TYPE
MODULE DERIVED_TYPE_01
USE, NON_INTRINSIC :: DERIVED_TYPE
IMPLICIT NONE
TYPE , PUBLIC :: DT_AB
INTEGER , DIMENSION( A_DT_AA%T_I_00() ) :: SERT
END TYPE DT_AB
END MODULE DERIVED_TYPE_01
PROGRAM MAIN_PROGRAM
USE, NON_INTRINSIC :: DERIVED_TYPE
IMPLICIT NONE
CALL A_DT_AA%C_I_00(1)
END PROGRAM MAIN_PROGRAM
Afther the end of compiling process I got this message:
Function TAKE_DATA_I_00
must be PURE
What is wrong with this kind of array declaration with public procedure from derived type?
My IDE is Code::Blocks 17.12 with Gfortran compiler. The version of compiler is: MinGW 6.3.0.