module module_try 
    implicit none
    
    type A_type
        character(len=5) :: A_char      
        double precision, dimension(:), allocatable :: A_double
    endtype A_type
    
    type B_type
        character(len=5) :: B_char
        type(A_type)     :: A
    end type B_type
    
    type(B_type), dimension(:), allocatable :: B
    
contains
    
    subroutine try
        allocate(B(2))              ! no errors
        allocate(B%A%A_double(3))   ! no errors
        B(1)%A%A_double(:) = 1.d0   ! no errros
        B(2)%A%A_double(:) = 2.d0   ! no errors
        print*, 'Hello World_1'
        print*, B(1)%A%A_double(:)
        print*, 'Hello World_2'
        print*, B(2)%A%A_double(:)  ! nothing printed
        print*, 'Hello World_3' 
        !B(2)%A%A_double(1) = 2.d0   ! gives error
    end subroutine try

end module module_try
    