title: Accessing to components of derived types which extends main derived type by using inheritance rule
body: <p>I need a little help about using inheritance rules. My intention is to use one derived type array for storaging results of calculation but i want to use that array also for storaging components values from main and extended derived types. 
  For example, this is my example code which I want to transform:</p>
  
  <pre><code>MODULE DERIVED_TYPES
  
  IMPLICIT NONE
  
  ! FIRST DERIVED TYPE
  
  TYPE, PUBLIC :: DT_AA
  
    INTEGER, PRIVATE :: I_AA
  
    CONTAINS
  
    PROCEDURE, PUBLIC:: CALCULATE =&gt; CALC_DATA_I_AA
    PROCEDURE, PUBLIC::    T_I_AA =&gt; TAKE_DATA_I_AA
  
  END TYPE DT_AA
  
  PRIVATE :: CALC_DATA_I_AA
  PRIVATE :: TAKE_DATA_I_AA
  
  ! SECOND DERIVED TYPE
  
  TYPE, EXTENDS( DT_AA ), PUBLIC :: DT_BB
  
    INTEGER, PRIVATE :: I_BB
  
    CONTAINS
  
    PROCEDURE, PUBLIC:: CALCULATE =&gt; CALC_DATA_I_BB
    PROCEDURE, PUBLIC::    T_I_BB =&gt; TAKE_DATA_I_BB
  
  END TYPE DT_BB
  
  PRIVATE :: CALC_DATA_I_BB
  PRIVATE :: TAKE_DATA_I_BB
  
  CONTAINS
  
  ! TYPE DT_AA PROCEDURES
  
    SUBROUTINE CALC_DATA_I_AA( THIS, INDX )
  
      CLASS( DT_AA ) :: THIS
      INTEGER, INTENT( IN ) :: INDX
  
      THIS%I_AA = 1 + INDX
  
    END SUBROUTINE CALC_DATA_I_AA
  
    FUNCTION TAKE_DATA_I_AA( THIS ) RESULT( VALUE_I_AA )
  
      CLASS( DT_AA ) THIS
      INTEGER :: VALUE_I_AA
  
      VALUE_I_AA = THIS%I_AA
  
    END FUNCTION TAKE_DATA_I_AA
  
  ! TYPE DT_BB PROCEDURES
  
    SUBROUTINE CALC_DATA_I_BB( THIS, INDX )
  
      CLASS( DT_BB ) :: THIS
      INTEGER, INTENT( IN ) :: INDX
  
      THIS%I_BB = THIS%I_AA + INDX
  
    END SUBROUTINE CALC_DATA_I_BB
  
    FUNCTION TAKE_DATA_I_BB( THIS ) RESULT( VALUE_I_BB )
  
      CLASS( DT_BB ) THIS
      INTEGER :: VALUE_I_BB
  
      VALUE_I_BB = THIS%I_BB
  
    END FUNCTION TAKE_DATA_I_BB
  
  END MODULE DERIVED_TYPES
  
  PROGRAM INHERITANCE_RULE
  
  USE, NON_INTRINSIC :: DERIVED_TYPES
  
  IMPLICIT NONE
  
  INTEGER :: I
  INTEGER, PARAMETER :: N_CALC = 3
  
  CLASS( DT_AA ), POINTER :: P_INH
   TYPE( DT_AA ),  TARGET :: P_A_INH( N_CALC )
  
  DO I = 1, N_CALC
  
     P_INH =&gt; P_A_INH( I )
  
     CALL P_INH%CALCULATE( I )
  
     WRITE(*,*) P_INH%T_I_AA(), P_INH%T_I_BB()
  
  END DO
  
  END PROGRAM INHERITANCE_RULE 
  </code></pre>
  
  <p>In this case I can not use pointer <code>P_INH</code> and function for taking component <code>I_BB</code> values which is not member of extended derived type because I got this compile error message:</p>
  
  <p><code>'t_i_bb'  is not a member of the 'dt_aa' structure</code></p>
  
  <p>Which kind of change is useful for this case?</p>
  
  <p>My IDE is Code::Blocks 17.12 with Gfortran compiler. The version of compiler is: MinGW 6.3.0.</p>